18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * rt5651.h  --  RT5651 ALSA SoC audio driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright 2011 Realtek Microelectronics
68c2ecf20Sopenharmony_ci * Author: Johnny Hsu <johnnyhsu@realtek.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __RT5651_H__
108c2ecf20Sopenharmony_ci#define __RT5651_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <dt-bindings/sound/rt5651.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/* Info */
158c2ecf20Sopenharmony_ci#define RT5651_RESET				0x00
168c2ecf20Sopenharmony_ci#define RT5651_VERSION_ID			0xfd
178c2ecf20Sopenharmony_ci#define RT5651_VENDOR_ID			0xfe
188c2ecf20Sopenharmony_ci#define RT5651_DEVICE_ID			0xff
198c2ecf20Sopenharmony_ci/*  I/O - Output */
208c2ecf20Sopenharmony_ci#define RT5651_HP_VOL				0x02
218c2ecf20Sopenharmony_ci#define RT5651_LOUT_CTRL1			0x03
228c2ecf20Sopenharmony_ci#define RT5651_LOUT_CTRL2			0x05
238c2ecf20Sopenharmony_ci/* I/O - Input */
248c2ecf20Sopenharmony_ci#define RT5651_IN1_IN2				0x0d
258c2ecf20Sopenharmony_ci#define RT5651_IN3				0x0e
268c2ecf20Sopenharmony_ci#define RT5651_INL1_INR1_VOL			0x0f
278c2ecf20Sopenharmony_ci#define RT5651_INL2_INR2_VOL			0x10
288c2ecf20Sopenharmony_ci/* I/O - ADC/DAC/DMIC */
298c2ecf20Sopenharmony_ci#define RT5651_DAC1_DIG_VOL			0x19
308c2ecf20Sopenharmony_ci#define RT5651_DAC2_DIG_VOL			0x1a
318c2ecf20Sopenharmony_ci#define RT5651_DAC2_CTRL			0x1b
328c2ecf20Sopenharmony_ci#define RT5651_ADC_DIG_VOL			0x1c
338c2ecf20Sopenharmony_ci#define RT5651_ADC_DATA				0x1d
348c2ecf20Sopenharmony_ci#define RT5651_ADC_BST_VOL			0x1e
358c2ecf20Sopenharmony_ci/* Mixer - D-D */
368c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_MIXER			0x27
378c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_MIXER			0x28
388c2ecf20Sopenharmony_ci#define RT5651_AD_DA_MIXER			0x29
398c2ecf20Sopenharmony_ci#define RT5651_STO_DAC_MIXER			0x2a
408c2ecf20Sopenharmony_ci#define RT5651_DD_MIXER				0x2b
418c2ecf20Sopenharmony_ci#define RT5651_DIG_INF_DATA			0x2f
428c2ecf20Sopenharmony_ci/* PDM */
438c2ecf20Sopenharmony_ci#define RT5651_PDM_CTL				0x30
448c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CTL1			0x31
458c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CTL2			0x32
468c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_DATA_W			0x33
478c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_DATA_R			0x34
488c2ecf20Sopenharmony_ci/* Mixer - ADC */
498c2ecf20Sopenharmony_ci#define RT5651_REC_L1_MIXER			0x3b
508c2ecf20Sopenharmony_ci#define RT5651_REC_L2_MIXER			0x3c
518c2ecf20Sopenharmony_ci#define RT5651_REC_R1_MIXER			0x3d
528c2ecf20Sopenharmony_ci#define RT5651_REC_R2_MIXER			0x3e
538c2ecf20Sopenharmony_ci/* Mixer - DAC */
548c2ecf20Sopenharmony_ci#define RT5651_HPO_MIXER			0x45
558c2ecf20Sopenharmony_ci#define RT5651_OUT_L1_MIXER			0x4d
568c2ecf20Sopenharmony_ci#define RT5651_OUT_L2_MIXER			0x4e
578c2ecf20Sopenharmony_ci#define RT5651_OUT_L3_MIXER			0x4f
588c2ecf20Sopenharmony_ci#define RT5651_OUT_R1_MIXER			0x50
598c2ecf20Sopenharmony_ci#define RT5651_OUT_R2_MIXER			0x51
608c2ecf20Sopenharmony_ci#define RT5651_OUT_R3_MIXER			0x52
618c2ecf20Sopenharmony_ci#define RT5651_LOUT_MIXER			0x53
628c2ecf20Sopenharmony_ci/* Power */
638c2ecf20Sopenharmony_ci#define RT5651_PWR_DIG1				0x61
648c2ecf20Sopenharmony_ci#define RT5651_PWR_DIG2				0x62
658c2ecf20Sopenharmony_ci#define RT5651_PWR_ANLG1			0x63
668c2ecf20Sopenharmony_ci#define RT5651_PWR_ANLG2			0x64
678c2ecf20Sopenharmony_ci#define RT5651_PWR_MIXER			0x65
688c2ecf20Sopenharmony_ci#define RT5651_PWR_VOL				0x66
698c2ecf20Sopenharmony_ci/* Private Register Control */
708c2ecf20Sopenharmony_ci#define RT5651_PRIV_INDEX			0x6a
718c2ecf20Sopenharmony_ci#define RT5651_PRIV_DATA			0x6c
728c2ecf20Sopenharmony_ci/* Format - ADC/DAC */
738c2ecf20Sopenharmony_ci#define RT5651_I2S1_SDP				0x70
748c2ecf20Sopenharmony_ci#define RT5651_I2S2_SDP				0x71
758c2ecf20Sopenharmony_ci#define RT5651_ADDA_CLK1			0x73
768c2ecf20Sopenharmony_ci#define RT5651_ADDA_CLK2			0x74
778c2ecf20Sopenharmony_ci#define RT5651_DMIC				0x75
788c2ecf20Sopenharmony_ci/* TDM Control */
798c2ecf20Sopenharmony_ci#define RT5651_TDM_CTL_1			0x77
808c2ecf20Sopenharmony_ci#define RT5651_TDM_CTL_2			0x78
818c2ecf20Sopenharmony_ci#define RT5651_TDM_CTL_3			0x79
828c2ecf20Sopenharmony_ci/* Function - Analog */
838c2ecf20Sopenharmony_ci#define RT5651_GLB_CLK				0x80
848c2ecf20Sopenharmony_ci#define RT5651_PLL_CTRL1			0x81
858c2ecf20Sopenharmony_ci#define RT5651_PLL_CTRL2			0x82
868c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_1			0x83
878c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_2			0x84
888c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_3			0x85
898c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_4			0x86
908c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_5			0x87
918c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_6			0x89
928c2ecf20Sopenharmony_ci#define RT5651_PLL_MODE_7			0x8a
938c2ecf20Sopenharmony_ci#define RT5651_DEPOP_M1				0x8e
948c2ecf20Sopenharmony_ci#define RT5651_DEPOP_M2				0x8f
958c2ecf20Sopenharmony_ci#define RT5651_DEPOP_M3				0x90
968c2ecf20Sopenharmony_ci#define RT5651_CHARGE_PUMP			0x91
978c2ecf20Sopenharmony_ci#define RT5651_MICBIAS				0x93
988c2ecf20Sopenharmony_ci#define RT5651_A_JD_CTL1			0x94
998c2ecf20Sopenharmony_ci/* Function - Digital */
1008c2ecf20Sopenharmony_ci#define RT5651_EQ_CTRL1				0xb0
1018c2ecf20Sopenharmony_ci#define RT5651_EQ_CTRL2				0xb1
1028c2ecf20Sopenharmony_ci#define RT5651_ALC_1				0xb4
1038c2ecf20Sopenharmony_ci#define RT5651_ALC_2				0xb5
1048c2ecf20Sopenharmony_ci#define RT5651_ALC_3				0xb6
1058c2ecf20Sopenharmony_ci#define RT5651_JD_CTRL1				0xbb
1068c2ecf20Sopenharmony_ci#define RT5651_JD_CTRL2				0xbc
1078c2ecf20Sopenharmony_ci#define RT5651_IRQ_CTRL1			0xbd
1088c2ecf20Sopenharmony_ci#define RT5651_IRQ_CTRL2			0xbe
1098c2ecf20Sopenharmony_ci#define RT5651_INT_IRQ_ST			0xbf
1108c2ecf20Sopenharmony_ci#define RT5651_GPIO_CTRL1			0xc0
1118c2ecf20Sopenharmony_ci#define RT5651_GPIO_CTRL2			0xc1
1128c2ecf20Sopenharmony_ci#define RT5651_GPIO_CTRL3			0xc2
1138c2ecf20Sopenharmony_ci#define RT5651_PGM_REG_ARR1			0xc8
1148c2ecf20Sopenharmony_ci#define RT5651_PGM_REG_ARR2			0xc9
1158c2ecf20Sopenharmony_ci#define RT5651_PGM_REG_ARR3			0xca
1168c2ecf20Sopenharmony_ci#define RT5651_PGM_REG_ARR4			0xcb
1178c2ecf20Sopenharmony_ci#define RT5651_PGM_REG_ARR5			0xcc
1188c2ecf20Sopenharmony_ci#define RT5651_SCB_FUNC				0xcd
1198c2ecf20Sopenharmony_ci#define RT5651_SCB_CTRL				0xce
1208c2ecf20Sopenharmony_ci#define RT5651_BASE_BACK			0xcf
1218c2ecf20Sopenharmony_ci#define RT5651_MP3_PLUS1			0xd0
1228c2ecf20Sopenharmony_ci#define RT5651_MP3_PLUS2			0xd1
1238c2ecf20Sopenharmony_ci#define RT5651_ADJ_HPF_CTRL1			0xd3
1248c2ecf20Sopenharmony_ci#define RT5651_ADJ_HPF_CTRL2			0xd4
1258c2ecf20Sopenharmony_ci#define RT5651_HP_CALIB_AMP_DET			0xd6
1268c2ecf20Sopenharmony_ci#define RT5651_HP_CALIB2			0xd7
1278c2ecf20Sopenharmony_ci#define RT5651_SV_ZCD1				0xd9
1288c2ecf20Sopenharmony_ci#define RT5651_SV_ZCD2				0xda
1298c2ecf20Sopenharmony_ci#define RT5651_D_MISC				0xfa
1308c2ecf20Sopenharmony_ci/* Dummy Register */
1318c2ecf20Sopenharmony_ci#define RT5651_DUMMY2				0xfb
1328c2ecf20Sopenharmony_ci#define RT5651_DUMMY3				0xfc
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* Index of Codec Private Register definition */
1368c2ecf20Sopenharmony_ci#define RT5651_BIAS_CUR1			0x12
1378c2ecf20Sopenharmony_ci#define RT5651_BIAS_CUR3			0x14
1388c2ecf20Sopenharmony_ci#define RT5651_BIAS_CUR4			0x15
1398c2ecf20Sopenharmony_ci#define RT5651_CLSD_INT_REG1			0x1c
1408c2ecf20Sopenharmony_ci#define RT5651_CHPUMP_INT_REG1			0x24
1418c2ecf20Sopenharmony_ci#define RT5651_MAMP_INT_REG2			0x37
1428c2ecf20Sopenharmony_ci#define RT5651_CHOP_DAC_ADC			0x3d
1438c2ecf20Sopenharmony_ci#define RT5651_3D_SPK				0x63
1448c2ecf20Sopenharmony_ci#define RT5651_WND_1				0x6c
1458c2ecf20Sopenharmony_ci#define RT5651_WND_2				0x6d
1468c2ecf20Sopenharmony_ci#define RT5651_WND_3				0x6e
1478c2ecf20Sopenharmony_ci#define RT5651_WND_4				0x6f
1488c2ecf20Sopenharmony_ci#define RT5651_WND_5				0x70
1498c2ecf20Sopenharmony_ci#define RT5651_WND_8				0x73
1508c2ecf20Sopenharmony_ci#define RT5651_DIP_SPK_INF			0x75
1518c2ecf20Sopenharmony_ci#define RT5651_HP_DCC_INT1			0x77
1528c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_LOP			0xa0
1538c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_LOP			0xa1
1548c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_BP1			0xa2
1558c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_BP1			0xa3
1568c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_BP1			0xa4
1578c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_BP2			0xa5
1588c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_BP2			0xa6
1598c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_BP2			0xa7
1608c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_BP3			0xa8
1618c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_BP3			0xa9
1628c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_BP3			0xaa
1638c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_BP4			0xab
1648c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_BP4			0xac
1658c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_BP4			0xad
1668c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_HIP1			0xae
1678c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_HIP1			0xaf
1688c2ecf20Sopenharmony_ci#define RT5651_EQ_FC_HIP2			0xb0
1698c2ecf20Sopenharmony_ci#define RT5651_EQ_BW_HIP2			0xb1
1708c2ecf20Sopenharmony_ci#define RT5651_EQ_GN_HIP2			0xb2
1718c2ecf20Sopenharmony_ci#define RT5651_EQ_PRE_VOL			0xb3
1728c2ecf20Sopenharmony_ci#define RT5651_EQ_PST_VOL			0xb4
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ci/* global definition */
1768c2ecf20Sopenharmony_ci#define RT5651_L_MUTE				(0x1 << 15)
1778c2ecf20Sopenharmony_ci#define RT5651_L_MUTE_SFT			15
1788c2ecf20Sopenharmony_ci#define RT5651_VOL_L_MUTE			(0x1 << 14)
1798c2ecf20Sopenharmony_ci#define RT5651_VOL_L_SFT			14
1808c2ecf20Sopenharmony_ci#define RT5651_R_MUTE				(0x1 << 7)
1818c2ecf20Sopenharmony_ci#define RT5651_R_MUTE_SFT			7
1828c2ecf20Sopenharmony_ci#define RT5651_VOL_R_MUTE			(0x1 << 6)
1838c2ecf20Sopenharmony_ci#define RT5651_VOL_R_SFT			6
1848c2ecf20Sopenharmony_ci#define RT5651_L_VOL_MASK			(0x3f << 8)
1858c2ecf20Sopenharmony_ci#define RT5651_L_VOL_SFT			8
1868c2ecf20Sopenharmony_ci#define RT5651_R_VOL_MASK			(0x3f)
1878c2ecf20Sopenharmony_ci#define RT5651_R_VOL_SFT			0
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* LOUT Control 2(0x05) */
1908c2ecf20Sopenharmony_ci#define RT5651_EN_DFO				(0x1 << 15)
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/* IN1 and IN2 Control (0x0d) */
1938c2ecf20Sopenharmony_ci/* IN3 and IN4 Control (0x0e) */
1948c2ecf20Sopenharmony_ci#define RT5651_BST_MASK1			(0xf<<12)
1958c2ecf20Sopenharmony_ci#define RT5651_BST_SFT1				12
1968c2ecf20Sopenharmony_ci#define RT5651_BST_MASK2			(0xf<<8)
1978c2ecf20Sopenharmony_ci#define RT5651_BST_SFT2				8
1988c2ecf20Sopenharmony_ci#define RT5651_IN_DF1				(0x1 << 7)
1998c2ecf20Sopenharmony_ci#define RT5651_IN_SFT1				7
2008c2ecf20Sopenharmony_ci#define RT5651_IN_DF2				(0x1 << 6)
2018c2ecf20Sopenharmony_ci#define RT5651_IN_SFT2				6
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/* INL1 and INR1 Volume Control (0x0f) */
2048c2ecf20Sopenharmony_ci/* INL2 and INR2 Volume Control (0x10) */
2058c2ecf20Sopenharmony_ci#define RT5651_INL_SEL_MASK			(0x1 << 15)
2068c2ecf20Sopenharmony_ci#define RT5651_INL_SEL_SFT			15
2078c2ecf20Sopenharmony_ci#define RT5651_INL_SEL_IN4P			(0x0 << 15)
2088c2ecf20Sopenharmony_ci#define RT5651_INL_SEL_MONOP			(0x1 << 15)
2098c2ecf20Sopenharmony_ci#define RT5651_INL_VOL_MASK			(0x1f << 8)
2108c2ecf20Sopenharmony_ci#define RT5651_INL_VOL_SFT			8
2118c2ecf20Sopenharmony_ci#define RT5651_INR_SEL_MASK			(0x1 << 7)
2128c2ecf20Sopenharmony_ci#define RT5651_INR_SEL_SFT			7
2138c2ecf20Sopenharmony_ci#define RT5651_INR_SEL_IN4N			(0x0 << 7)
2148c2ecf20Sopenharmony_ci#define RT5651_INR_SEL_MONON			(0x1 << 7)
2158c2ecf20Sopenharmony_ci#define RT5651_INR_VOL_MASK			(0x1f)
2168c2ecf20Sopenharmony_ci#define RT5651_INR_VOL_SFT			0
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* DAC1 Digital Volume (0x19) */
2198c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_VOL_MASK			(0xff << 8)
2208c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_VOL_SFT			8
2218c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_VOL_MASK			(0xff)
2228c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_VOL_SFT			0
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci/* DAC2 Digital Volume (0x1a) */
2258c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_VOL_MASK			(0xff << 8)
2268c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_VOL_SFT			8
2278c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_VOL_MASK			(0xff)
2288c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_VOL_SFT			0
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* DAC2 Control (0x1b) */
2318c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_VOL			(0x1 << 13)
2328c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_VOL_SFT			13
2338c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_VOL			(0x1 << 12)
2348c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_VOL_SFT			12
2358c2ecf20Sopenharmony_ci#define RT5651_SEL_DAC_L2			(0x1 << 11)
2368c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_L2			(0x1 << 11)
2378c2ecf20Sopenharmony_ci#define RT5651_IF1_DAC_L2			(0x0 << 11)
2388c2ecf20Sopenharmony_ci#define RT5651_SEL_DAC_L2_SFT			11
2398c2ecf20Sopenharmony_ci#define RT5651_SEL_DAC_R2			(0x1 << 10)
2408c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_R2			(0x1 << 11)
2418c2ecf20Sopenharmony_ci#define RT5651_IF1_DAC_R2			(0x0 << 11)
2428c2ecf20Sopenharmony_ci#define RT5651_SEL_DAC_R2_SFT			10
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/* ADC Digital Volume Control (0x1c) */
2458c2ecf20Sopenharmony_ci#define RT5651_ADC_L_VOL_MASK			(0x7f << 8)
2468c2ecf20Sopenharmony_ci#define RT5651_ADC_L_VOL_SFT			8
2478c2ecf20Sopenharmony_ci#define RT5651_ADC_R_VOL_MASK			(0x7f)
2488c2ecf20Sopenharmony_ci#define RT5651_ADC_R_VOL_SFT			0
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci/* Mono ADC Digital Volume Control (0x1d) */
2518c2ecf20Sopenharmony_ci#define RT5651_M_MONO_ADC_L			(0x1 << 15)
2528c2ecf20Sopenharmony_ci#define RT5651_M_MONO_ADC_L_SFT			15
2538c2ecf20Sopenharmony_ci#define RT5651_MONO_ADC_L_VOL_MASK		(0x7f << 8)
2548c2ecf20Sopenharmony_ci#define RT5651_MONO_ADC_L_VOL_SFT		8
2558c2ecf20Sopenharmony_ci#define RT5651_M_MONO_ADC_R			(0x1 << 7)
2568c2ecf20Sopenharmony_ci#define RT5651_M_MONO_ADC_R_SFT			7
2578c2ecf20Sopenharmony_ci#define RT5651_MONO_ADC_R_VOL_MASK		(0x7f)
2588c2ecf20Sopenharmony_ci#define RT5651_MONO_ADC_R_VOL_SFT		0
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci/* ADC Boost Volume Control (0x1e) */
2618c2ecf20Sopenharmony_ci#define RT5651_ADC_L_BST_MASK			(0x3 << 14)
2628c2ecf20Sopenharmony_ci#define RT5651_ADC_L_BST_SFT			14
2638c2ecf20Sopenharmony_ci#define RT5651_ADC_R_BST_MASK			(0x3 << 12)
2648c2ecf20Sopenharmony_ci#define RT5651_ADC_R_BST_SFT			12
2658c2ecf20Sopenharmony_ci#define RT5651_ADC_COMP_MASK			(0x3 << 10)
2668c2ecf20Sopenharmony_ci#define RT5651_ADC_COMP_SFT			10
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* Stereo ADC1 Mixer Control (0x27) */
2698c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_L1			(0x1 << 14)
2708c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_L1_SFT		14
2718c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_L2			(0x1 << 13)
2728c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_L2_SFT		13
2738c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_1_SRC_MASK		(0x1 << 12)
2748c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_1_SRC_SFT		12
2758c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_1_SRC_ADC		(0x1 << 12)
2768c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_1_SRC_DACMIX		(0x0 << 12)
2778c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_2_SRC_MASK		(0x1 << 11)
2788c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_2_SRC_SFT		11
2798c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_2_SRC_DMIC		(0x0 << 11)
2808c2ecf20Sopenharmony_ci#define RT5651_STO1_ADC_2_SRC_DACMIXR	(0x1 << 11)
2818c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_R1			(0x1 << 6)
2828c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_R1_SFT		6
2838c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_R2			(0x1 << 5)
2848c2ecf20Sopenharmony_ci#define RT5651_M_STO1_ADC_R2_SFT		5
2858c2ecf20Sopenharmony_ci
2868c2ecf20Sopenharmony_ci/* Stereo ADC2 Mixer Control (0x28) */
2878c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_L1			(0x1 << 14)
2888c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_L1_SFT		14
2898c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_L2			(0x1 << 13)
2908c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_L2_SFT		13
2918c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L1_SRC_MASK		(0x1 << 12)
2928c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L1_SRC_SFT		12
2938c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L1_SRC_DACMIXL		(0x0 << 12)
2948c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L1_SRC_ADCL		(0x1 << 12)
2958c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L2_SRC_MASK		(0x1 << 11)
2968c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L2_SRC_SFT		11
2978c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L2_SRC_DMIC		(0x0 << 11)
2988c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_L2_SRC_DACMIXR		(0x1 << 11)
2998c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_R1			(0x1 << 6)
3008c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_R1_SFT		6
3018c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_R2			(0x1 << 5)
3028c2ecf20Sopenharmony_ci#define RT5651_M_STO2_ADC_R2_SFT		5
3038c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R1_SRC_MASK		(0x1 << 4)
3048c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R1_SRC_SFT		4
3058c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R1_SRC_ADCR		(0x1 << 4)
3068c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R1_SRC_DACMIXR		(0x0 << 4)
3078c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R2_SRC_MASK		(0x1 << 3)
3088c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R2_SRC_SFT		3
3098c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R2_SRC_DMIC		(0x0 << 3)
3108c2ecf20Sopenharmony_ci#define RT5651_STO2_ADC_R2_SRC_DACMIXR		(0x1 << 3)
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/* ADC Mixer to DAC Mixer Control (0x29) */
3138c2ecf20Sopenharmony_ci#define RT5651_M_ADCMIX_L			(0x1 << 15)
3148c2ecf20Sopenharmony_ci#define RT5651_M_ADCMIX_L_SFT			15
3158c2ecf20Sopenharmony_ci#define RT5651_M_IF1_DAC_L			(0x1 << 14)
3168c2ecf20Sopenharmony_ci#define RT5651_M_IF1_DAC_L_SFT			14
3178c2ecf20Sopenharmony_ci#define RT5651_M_ADCMIX_R			(0x1 << 7)
3188c2ecf20Sopenharmony_ci#define RT5651_M_ADCMIX_R_SFT			7
3198c2ecf20Sopenharmony_ci#define RT5651_M_IF1_DAC_R			(0x1 << 6)
3208c2ecf20Sopenharmony_ci#define RT5651_M_IF1_DAC_R_SFT			6
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci/* Stereo DAC Mixer Control (0x2a) */
3238c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_MIXL			(0x1 << 14)
3248c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_MIXL_SFT		14
3258c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_STO_L_VOL_MASK		(0x1 << 13)
3268c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_STO_L_VOL_SFT		13
3278c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_MIXL			(0x1 << 12)
3288c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_MIXL_SFT		12
3298c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_STO_L_VOL_MASK		(0x1 << 11)
3308c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_STO_L_VOL_SFT		11
3318c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_MIXL			(0x1 << 9)
3328c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_MIXL_SFT		9
3338c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_STO_L_VOL_MASK		(0x1 << 8)
3348c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_STO_L_VOL_SFT		8
3358c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_MIXR			(0x1 << 6)
3368c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_MIXR_SFT		6
3378c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_STO_R_VOL_MASK		(0x1 << 5)
3388c2ecf20Sopenharmony_ci#define RT5651_DAC_R1_STO_R_VOL_SFT		5
3398c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_MIXR			(0x1 << 4)
3408c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_MIXR_SFT		4
3418c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_STO_R_VOL_MASK		(0x1 << 3)
3428c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_STO_R_VOL_SFT		3
3438c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_MIXR			(0x1 << 1)
3448c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_MIXR_SFT		1
3458c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_STO_R_VOL_MASK		(0x1)
3468c2ecf20Sopenharmony_ci#define RT5651_DAC_L1_STO_R_VOL_SFT		0
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/* DD Mixer Control (0x2b) */
3498c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L1			(0x1 << 14)
3508c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L1_SFT			14
3518c2ecf20Sopenharmony_ci#define RT5651_STO_DD_L1_VOL_MASK		(0x1 << 13)
3528c2ecf20Sopenharmony_ci#define RT5651_DAC_DD_L1_VOL_SFT		13
3538c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L2			(0x1 << 12)
3548c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L2_SFT			12
3558c2ecf20Sopenharmony_ci#define RT5651_STO_DD_L2_VOL_MASK		(0x1 << 11)
3568c2ecf20Sopenharmony_ci#define RT5651_STO_DD_L2_VOL_SFT		11
3578c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R2_L			(0x1 << 10)
3588c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R2_L_SFT		10
3598c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R2_L_VOL_MASK		(0x1 << 9)
3608c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R2_L_VOL_SFT		9
3618c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R1			(0x1 << 6)
3628c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R1_SFT			6
3638c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R1_VOL_MASK		(0x1 << 5)
3648c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R1_VOL_SFT		5
3658c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R2			(0x1 << 4)
3668c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_R2_SFT			4
3678c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R2_VOL_MASK		(0x1 << 3)
3688c2ecf20Sopenharmony_ci#define RT5651_STO_DD_R2_VOL_SFT		3
3698c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L2_R			(0x1 << 2)
3708c2ecf20Sopenharmony_ci#define RT5651_M_STO_DD_L2_R_SFT		2
3718c2ecf20Sopenharmony_ci#define RT5651_STO_DD_L2_R_VOL_MASK		(0x1 << 1)
3728c2ecf20Sopenharmony_ci#define RT5651_STO_DD_L2_R_VOL_SFT		1
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci/* Digital Mixer Control (0x2c) */
3758c2ecf20Sopenharmony_ci#define RT5651_M_STO_L_DAC_L			(0x1 << 15)
3768c2ecf20Sopenharmony_ci#define RT5651_M_STO_L_DAC_L_SFT		15
3778c2ecf20Sopenharmony_ci#define RT5651_STO_L_DAC_L_VOL_MASK		(0x1 << 14)
3788c2ecf20Sopenharmony_ci#define RT5651_STO_L_DAC_L_VOL_SFT		14
3798c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_DAC_L			(0x1 << 13)
3808c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_DAC_L_SFT		13
3818c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_DAC_L_VOL_MASK		(0x1 << 12)
3828c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_DAC_L_VOL_SFT		12
3838c2ecf20Sopenharmony_ci#define RT5651_M_STO_R_DAC_R			(0x1 << 11)
3848c2ecf20Sopenharmony_ci#define RT5651_M_STO_R_DAC_R_SFT		11
3858c2ecf20Sopenharmony_ci#define RT5651_STO_R_DAC_R_VOL_MASK		(0x1 << 10)
3868c2ecf20Sopenharmony_ci#define RT5651_STO_R_DAC_R_VOL_SFT		10
3878c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_DAC_R			(0x1 << 9)
3888c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_DAC_R_SFT		9
3898c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_DAC_R_VOL_MASK		(0x1 << 8)
3908c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_DAC_R_VOL_SFT		8
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* DSP Path Control 1 (0x2d) */
3938c2ecf20Sopenharmony_ci#define RT5651_RXDP_SRC_MASK			(0x1 << 15)
3948c2ecf20Sopenharmony_ci#define RT5651_RXDP_SRC_SFT			15
3958c2ecf20Sopenharmony_ci#define RT5651_RXDP_SRC_NOR			(0x0 << 15)
3968c2ecf20Sopenharmony_ci#define RT5651_RXDP_SRC_DIV3			(0x1 << 15)
3978c2ecf20Sopenharmony_ci#define RT5651_TXDP_SRC_MASK			(0x1 << 14)
3988c2ecf20Sopenharmony_ci#define RT5651_TXDP_SRC_SFT			14
3998c2ecf20Sopenharmony_ci#define RT5651_TXDP_SRC_NOR			(0x0 << 14)
4008c2ecf20Sopenharmony_ci#define RT5651_TXDP_SRC_DIV3			(0x1 << 14)
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_ci/* DSP Path Control 2 (0x2e) */
4038c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_MASK			(0x3 << 14)
4048c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_SFT			14
4058c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_IF2			(0x0 << 14)
4068c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_IF3			(0x1 << 14)
4078c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_TXDC			(0x2 << 14)
4088c2ecf20Sopenharmony_ci#define RT5651_DAC_L2_SEL_BASS			(0x3 << 14)
4098c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_SEL_MASK			(0x3 << 12)
4108c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_SEL_SFT			12
4118c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_SEL_IF2			(0x0 << 12)
4128c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_SEL_IF3			(0x1 << 12)
4138c2ecf20Sopenharmony_ci#define RT5651_DAC_R2_SEL_TXDC			(0x2 << 12)
4148c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_L_SEL_MASK		(0x1 << 11)
4158c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_L_SEL_SFT		11
4168c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_L_SEL_TXDP		(0x0 << 11)
4178c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_L_SEL_PASS		(0x1 << 11)
4188c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_R_SEL_MASK		(0x1 << 10)
4198c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_R_SEL_SFT		10
4208c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_R_SEL_TXDP		(0x0 << 10)
4218c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_R_SEL_PASS		(0x1 << 10)
4228c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_MASK			(0x3 << 8)
4238c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_SFT			8
4248c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_NOR			(0x0 << 8)
4258c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_L2R			(0x1 << 8)
4268c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_R2L			(0x2 << 8)
4278c2ecf20Sopenharmony_ci#define RT5651_RXDC_SEL_SWAP			(0x3 << 8)
4288c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_MASK			(0x3 << 6)
4298c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_SFT			6
4308c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_NOR			(0x0 << 6)
4318c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_L2R			(0x1 << 6)
4328c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_R2L			(0x2 << 6)
4338c2ecf20Sopenharmony_ci#define RT5651_RXDP_SEL_SWAP			(0x3 << 6)
4348c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_MASK			(0x3 << 4)
4358c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_SFT			4
4368c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_NOR			(0x0 << 4)
4378c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_L2R			(0x1 << 4)
4388c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_R2L			(0x2 << 4)
4398c2ecf20Sopenharmony_ci#define RT5651_TXDC_SEL_SWAP			(0x3 << 4)
4408c2ecf20Sopenharmony_ci#define RT5651_TXDP_SEL_MASK			(0x3 << 2)
4418c2ecf20Sopenharmony_ci#define RT5651_TXDP_SEL_SFT			2
4428c2ecf20Sopenharmony_ci#define RT5651_TXDP_SEL_NOR			(0x0 << 2)
4438c2ecf20Sopenharmony_ci#define RT5651_TXDP_SEL_L2R			(0x1 << 2)
4448c2ecf20Sopenharmony_ci#define RT5651_TXDP_SEL_R2L			(0x2 << 2)
4458c2ecf20Sopenharmony_ci#define RT5651_TRXDP_SEL_SWAP			(0x3 << 2)
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_ci/* Digital Interface Data Control (0x2f) */
4488c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_MASK			(0x3 << 10)
4498c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_SFT			10
4508c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_NOR			(0x0 << 10)
4518c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_SWAP			(0x1 << 10)
4528c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_L2R			(0x2 << 10)
4538c2ecf20Sopenharmony_ci#define RT5651_IF2_DAC_SEL_R2L			(0x3 << 10)
4548c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_MASK			(0x3 << 8)
4558c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_SFT			8
4568c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_NOR			(0x0 << 8)
4578c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_SWAP			(0x1 << 8)
4588c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_L2R			(0x2 << 8)
4598c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SEL_R2L			(0x3 << 8)
4608c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SRC_MASK			(0x1 << 7)
4618c2ecf20Sopenharmony_ci#define RT5651_IF2_ADC_SRC_SFT			7
4628c2ecf20Sopenharmony_ci#define RT5651_IF1_ADC1				(0x0 << 7)
4638c2ecf20Sopenharmony_ci#define RT5651_IF1_ADC2				(0x1 << 7)
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/* PDM Output Control (0x30) */
4668c2ecf20Sopenharmony_ci#define RT5651_PDM_L_SEL_MASK			(0x1 << 15)
4678c2ecf20Sopenharmony_ci#define RT5651_PDM_L_SEL_SFT			15
4688c2ecf20Sopenharmony_ci#define RT5651_PDM_L_SEL_DD_L			(0x0 << 15)
4698c2ecf20Sopenharmony_ci#define RT5651_PDM_L_SEL_STO_L			(0x1 << 15)
4708c2ecf20Sopenharmony_ci#define RT5651_M_PDM_L				(0x1 << 14)
4718c2ecf20Sopenharmony_ci#define RT5651_M_PDM_L_SFT			14
4728c2ecf20Sopenharmony_ci#define RT5651_PDM_R_SEL_MASK			(0x1 << 13)
4738c2ecf20Sopenharmony_ci#define RT5651_PDM_R_SEL_SFT			13
4748c2ecf20Sopenharmony_ci#define RT5651_PDM_R_SEL_DD_L			(0x0 << 13)
4758c2ecf20Sopenharmony_ci#define RT5651_PDM_R_SEL_STO_L			(0x1 << 13)
4768c2ecf20Sopenharmony_ci#define RT5651_M_PDM_R				(0x1 << 12)
4778c2ecf20Sopenharmony_ci#define RT5651_M_PDM_R_SFT			12
4788c2ecf20Sopenharmony_ci#define RT5651_PDM_BUSY				(0x1 << 6)
4798c2ecf20Sopenharmony_ci#define RT5651_PDM_BUSY_SFT			6
4808c2ecf20Sopenharmony_ci#define RT5651_PDM_PATTERN_SEL_MASK		(0x1 << 5)
4818c2ecf20Sopenharmony_ci#define RT5651_PDM_PATTERN_SEL_64		(0x0 << 5)
4828c2ecf20Sopenharmony_ci#define RT5651_PDM_PATTERN_SEL_128		(0x1 << 5)
4838c2ecf20Sopenharmony_ci#define RT5651_PDM_VOL_MASK			(0x1 << 4)
4848c2ecf20Sopenharmony_ci#define RT5651_PDM_VOL_SFT			4
4858c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_MASK			(0x3)
4868c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_SFT			0
4878c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_1			0
4888c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_2			1
4898c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_3			2
4908c2ecf20Sopenharmony_ci#define RT5651_PDM_DIV_4			3
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_ci/* PDM I2C/Data Control 1 (0x31) */
4938c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_ID_MASK			(0xf << 12)
4948c2ecf20Sopenharmony_ci#define PT5631_PDM_CMD_EXE			(0x1 << 11)
4958c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CMD_MASK			(0x1 << 10)
4968c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CMD_R			(0x0 << 10)
4978c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CMD_W			(0x1 << 10)
4988c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CMD_EXE			(0x1 << 9)
4998c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_NORMAL			(0x0 << 8)
5008c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_BUSY			(0x1 << 8)
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci/* PDM I2C/Data Control 2 (0x32) */
5038c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_ADDR			(0xff << 8)
5048c2ecf20Sopenharmony_ci#define RT5651_PDM_I2C_CMD_PATTERN		(0xff)
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci/* REC Left Mixer Control 1 (0x3b) */
5088c2ecf20Sopenharmony_ci#define RT5651_G_LN_L2_RM_L_MASK		(0x7 << 13)
5098c2ecf20Sopenharmony_ci#define RT5651_G_IN_L2_RM_L_SFT			13
5108c2ecf20Sopenharmony_ci#define RT5651_G_LN_L1_RM_L_MASK		(0x7 << 10)
5118c2ecf20Sopenharmony_ci#define RT5651_G_IN_L1_RM_L_SFT			10
5128c2ecf20Sopenharmony_ci#define RT5651_G_BST3_RM_L_MASK			(0x7 << 4)
5138c2ecf20Sopenharmony_ci#define RT5651_G_BST3_RM_L_SFT			4
5148c2ecf20Sopenharmony_ci#define RT5651_G_BST2_RM_L_MASK			(0x7 << 1)
5158c2ecf20Sopenharmony_ci#define RT5651_G_BST2_RM_L_SFT			1
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/* REC Left Mixer Control 2 (0x3c) */
5188c2ecf20Sopenharmony_ci#define RT5651_G_BST1_RM_L_MASK			(0x7 << 13)
5198c2ecf20Sopenharmony_ci#define RT5651_G_BST1_RM_L_SFT			13
5208c2ecf20Sopenharmony_ci#define RT5651_G_OM_L_RM_L_MASK			(0x7 << 10)
5218c2ecf20Sopenharmony_ci#define RT5651_G_OM_L_RM_L_SFT			10
5228c2ecf20Sopenharmony_ci#define RT5651_M_IN2_L_RM_L			(0x1 << 6)
5238c2ecf20Sopenharmony_ci#define RT5651_M_IN2_L_RM_L_SFT			6
5248c2ecf20Sopenharmony_ci#define RT5651_M_IN1_L_RM_L			(0x1 << 5)
5258c2ecf20Sopenharmony_ci#define RT5651_M_IN1_L_RM_L_SFT			5
5268c2ecf20Sopenharmony_ci#define RT5651_M_BST3_RM_L			(0x1 << 3)
5278c2ecf20Sopenharmony_ci#define RT5651_M_BST3_RM_L_SFT			3
5288c2ecf20Sopenharmony_ci#define RT5651_M_BST2_RM_L			(0x1 << 2)
5298c2ecf20Sopenharmony_ci#define RT5651_M_BST2_RM_L_SFT			2
5308c2ecf20Sopenharmony_ci#define RT5651_M_BST1_RM_L			(0x1 << 1)
5318c2ecf20Sopenharmony_ci#define RT5651_M_BST1_RM_L_SFT			1
5328c2ecf20Sopenharmony_ci#define RT5651_M_OM_L_RM_L			(0x1)
5338c2ecf20Sopenharmony_ci#define RT5651_M_OM_L_RM_L_SFT			0
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_ci/* REC Right Mixer Control 1 (0x3d) */
5368c2ecf20Sopenharmony_ci#define RT5651_G_IN2_R_RM_R_MASK		(0x7 << 13)
5378c2ecf20Sopenharmony_ci#define RT5651_G_IN2_R_RM_R_SFT			13
5388c2ecf20Sopenharmony_ci#define RT5651_G_IN1_R_RM_R_MASK		(0x7 << 10)
5398c2ecf20Sopenharmony_ci#define RT5651_G_IN1_R_RM_R_SFT			10
5408c2ecf20Sopenharmony_ci#define RT5651_G_BST3_RM_R_MASK			(0x7 << 4)
5418c2ecf20Sopenharmony_ci#define RT5651_G_BST3_RM_R_SFT			4
5428c2ecf20Sopenharmony_ci#define RT5651_G_BST2_RM_R_MASK			(0x7 << 1)
5438c2ecf20Sopenharmony_ci#define RT5651_G_BST2_RM_R_SFT			1
5448c2ecf20Sopenharmony_ci
5458c2ecf20Sopenharmony_ci/* REC Right Mixer Control 2 (0x3e) */
5468c2ecf20Sopenharmony_ci#define RT5651_G_BST1_RM_R_MASK			(0x7 << 13)
5478c2ecf20Sopenharmony_ci#define RT5651_G_BST1_RM_R_SFT			13
5488c2ecf20Sopenharmony_ci#define RT5651_G_OM_R_RM_R_MASK			(0x7 << 10)
5498c2ecf20Sopenharmony_ci#define RT5651_G_OM_R_RM_R_SFT			10
5508c2ecf20Sopenharmony_ci#define RT5651_M_IN2_R_RM_R			(0x1 << 6)
5518c2ecf20Sopenharmony_ci#define RT5651_M_IN2_R_RM_R_SFT			6
5528c2ecf20Sopenharmony_ci#define RT5651_M_IN1_R_RM_R			(0x1 << 5)
5538c2ecf20Sopenharmony_ci#define RT5651_M_IN1_R_RM_R_SFT			5
5548c2ecf20Sopenharmony_ci#define RT5651_M_BST3_RM_R			(0x1 << 3)
5558c2ecf20Sopenharmony_ci#define RT5651_M_BST3_RM_R_SFT			3
5568c2ecf20Sopenharmony_ci#define RT5651_M_BST2_RM_R			(0x1 << 2)
5578c2ecf20Sopenharmony_ci#define RT5651_M_BST2_RM_R_SFT			2
5588c2ecf20Sopenharmony_ci#define RT5651_M_BST1_RM_R			(0x1 << 1)
5598c2ecf20Sopenharmony_ci#define RT5651_M_BST1_RM_R_SFT			1
5608c2ecf20Sopenharmony_ci#define RT5651_M_OM_R_RM_R			(0x1)
5618c2ecf20Sopenharmony_ci#define RT5651_M_OM_R_RM_R_SFT			0
5628c2ecf20Sopenharmony_ci
5638c2ecf20Sopenharmony_ci/* HPMIX Control (0x45) */
5648c2ecf20Sopenharmony_ci#define RT5651_M_DAC1_HM			(0x1 << 14)
5658c2ecf20Sopenharmony_ci#define RT5651_M_DAC1_HM_SFT			14
5668c2ecf20Sopenharmony_ci#define RT5651_M_HPVOL_HM			(0x1 << 13)
5678c2ecf20Sopenharmony_ci#define RT5651_M_HPVOL_HM_SFT			13
5688c2ecf20Sopenharmony_ci#define RT5651_G_HPOMIX_MASK			(0x1 << 12)
5698c2ecf20Sopenharmony_ci#define RT5651_G_HPOMIX_SFT			12
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci/* SPK Left Mixer Control (0x46) */
5728c2ecf20Sopenharmony_ci#define RT5651_G_RM_L_SM_L_MASK			(0x3 << 14)
5738c2ecf20Sopenharmony_ci#define RT5651_G_RM_L_SM_L_SFT			14
5748c2ecf20Sopenharmony_ci#define RT5651_G_IN_L_SM_L_MASK			(0x3 << 12)
5758c2ecf20Sopenharmony_ci#define RT5651_G_IN_L_SM_L_SFT			12
5768c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L1_SM_L_MASK		(0x3 << 10)
5778c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L1_SM_L_SFT		10
5788c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L2_SM_L_MASK		(0x3 << 8)
5798c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L2_SM_L_SFT		8
5808c2ecf20Sopenharmony_ci#define RT5651_G_OM_L_SM_L_MASK			(0x3 << 6)
5818c2ecf20Sopenharmony_ci#define RT5651_G_OM_L_SM_L_SFT			6
5828c2ecf20Sopenharmony_ci#define RT5651_M_RM_L_SM_L			(0x1 << 5)
5838c2ecf20Sopenharmony_ci#define RT5651_M_RM_L_SM_L_SFT			5
5848c2ecf20Sopenharmony_ci#define RT5651_M_IN_L_SM_L			(0x1 << 4)
5858c2ecf20Sopenharmony_ci#define RT5651_M_IN_L_SM_L_SFT			4
5868c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_SM_L			(0x1 << 3)
5878c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_SM_L_SFT		3
5888c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_SM_L			(0x1 << 2)
5898c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_SM_L_SFT		2
5908c2ecf20Sopenharmony_ci#define RT5651_M_OM_L_SM_L			(0x1 << 1)
5918c2ecf20Sopenharmony_ci#define RT5651_M_OM_L_SM_L_SFT			1
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci/* SPK Right Mixer Control (0x47) */
5948c2ecf20Sopenharmony_ci#define RT5651_G_RM_R_SM_R_MASK			(0x3 << 14)
5958c2ecf20Sopenharmony_ci#define RT5651_G_RM_R_SM_R_SFT			14
5968c2ecf20Sopenharmony_ci#define RT5651_G_IN_R_SM_R_MASK			(0x3 << 12)
5978c2ecf20Sopenharmony_ci#define RT5651_G_IN_R_SM_R_SFT			12
5988c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R1_SM_R_MASK		(0x3 << 10)
5998c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R1_SM_R_SFT		10
6008c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R2_SM_R_MASK		(0x3 << 8)
6018c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R2_SM_R_SFT		8
6028c2ecf20Sopenharmony_ci#define RT5651_G_OM_R_SM_R_MASK			(0x3 << 6)
6038c2ecf20Sopenharmony_ci#define RT5651_G_OM_R_SM_R_SFT			6
6048c2ecf20Sopenharmony_ci#define RT5651_M_RM_R_SM_R			(0x1 << 5)
6058c2ecf20Sopenharmony_ci#define RT5651_M_RM_R_SM_R_SFT			5
6068c2ecf20Sopenharmony_ci#define RT5651_M_IN_R_SM_R			(0x1 << 4)
6078c2ecf20Sopenharmony_ci#define RT5651_M_IN_R_SM_R_SFT			4
6088c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SM_R			(0x1 << 3)
6098c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SM_R_SFT		3
6108c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_SM_R			(0x1 << 2)
6118c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_SM_R_SFT		2
6128c2ecf20Sopenharmony_ci#define RT5651_M_OM_R_SM_R			(0x1 << 1)
6138c2ecf20Sopenharmony_ci#define RT5651_M_OM_R_SM_R_SFT			1
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci/* SPOLMIX Control (0x48) */
6168c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SPM_L			(0x1 << 15)
6178c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SPM_L_SFT		15
6188c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_SPM_L			(0x1 << 14)
6198c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_SPM_L_SFT		14
6208c2ecf20Sopenharmony_ci#define RT5651_M_SV_R_SPM_L			(0x1 << 13)
6218c2ecf20Sopenharmony_ci#define RT5651_M_SV_R_SPM_L_SFT			13
6228c2ecf20Sopenharmony_ci#define RT5651_M_SV_L_SPM_L			(0x1 << 12)
6238c2ecf20Sopenharmony_ci#define RT5651_M_SV_L_SPM_L_SFT			12
6248c2ecf20Sopenharmony_ci#define RT5651_M_BST1_SPM_L			(0x1 << 11)
6258c2ecf20Sopenharmony_ci#define RT5651_M_BST1_SPM_L_SFT			11
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci/* SPORMIX Control (0x49) */
6288c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SPM_R			(0x1 << 13)
6298c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_SPM_R_SFT		13
6308c2ecf20Sopenharmony_ci#define RT5651_M_SV_R_SPM_R			(0x1 << 12)
6318c2ecf20Sopenharmony_ci#define RT5651_M_SV_R_SPM_R_SFT			12
6328c2ecf20Sopenharmony_ci#define RT5651_M_BST1_SPM_R			(0x1 << 11)
6338c2ecf20Sopenharmony_ci#define RT5651_M_BST1_SPM_R_SFT			11
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci/* SPOLMIX / SPORMIX Ratio Control (0x4a) */
6368c2ecf20Sopenharmony_ci#define RT5651_SPO_CLSD_RATIO_MASK		(0x7)
6378c2ecf20Sopenharmony_ci#define RT5651_SPO_CLSD_RATIO_SFT		0
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci/* Mono Output Mixer Control (0x4c) */
6408c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_MM			(0x1 << 15)
6418c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R2_MM_SFT			15
6428c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_MM			(0x1 << 14)
6438c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L2_MM_SFT			14
6448c2ecf20Sopenharmony_ci#define RT5651_M_OV_R_MM			(0x1 << 13)
6458c2ecf20Sopenharmony_ci#define RT5651_M_OV_R_MM_SFT			13
6468c2ecf20Sopenharmony_ci#define RT5651_M_OV_L_MM			(0x1 << 12)
6478c2ecf20Sopenharmony_ci#define RT5651_M_OV_L_MM_SFT			12
6488c2ecf20Sopenharmony_ci#define RT5651_M_BST1_MM			(0x1 << 11)
6498c2ecf20Sopenharmony_ci#define RT5651_M_BST1_MM_SFT			11
6508c2ecf20Sopenharmony_ci#define RT5651_G_MONOMIX_MASK			(0x1 << 10)
6518c2ecf20Sopenharmony_ci#define RT5651_G_MONOMIX_SFT			10
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci/* Output Left Mixer Control 1 (0x4d) */
6548c2ecf20Sopenharmony_ci#define RT5651_G_BST2_OM_L_MASK			(0x7 << 10)
6558c2ecf20Sopenharmony_ci#define RT5651_G_BST2_OM_L_SFT			10
6568c2ecf20Sopenharmony_ci#define RT5651_G_BST1_OM_L_MASK			(0x7 << 7)
6578c2ecf20Sopenharmony_ci#define RT5651_G_BST1_OM_L_SFT			7
6588c2ecf20Sopenharmony_ci#define RT5651_G_IN1_L_OM_L_MASK		(0x7 << 4)
6598c2ecf20Sopenharmony_ci#define RT5651_G_IN1_L_OM_L_SFT			4
6608c2ecf20Sopenharmony_ci#define RT5651_G_RM_L_OM_L_MASK			(0x7 << 1)
6618c2ecf20Sopenharmony_ci#define RT5651_G_RM_L_OM_L_SFT			1
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci/* Output Left Mixer Control 2 (0x4e) */
6648c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L1_OM_L_MASK		(0x7 << 7)
6658c2ecf20Sopenharmony_ci#define RT5651_G_DAC_L1_OM_L_SFT		7
6668c2ecf20Sopenharmony_ci#define RT5651_G_IN2_L_OM_L_MASK		(0x7 << 4)
6678c2ecf20Sopenharmony_ci#define RT5651_G_IN2_L_OM_L_SFT			4
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci/* Output Left Mixer Control 3 (0x4f) */
6708c2ecf20Sopenharmony_ci#define RT5651_M_IN2_L_OM_L			(0x1 << 9)
6718c2ecf20Sopenharmony_ci#define RT5651_M_IN2_L_OM_L_SFT			9
6728c2ecf20Sopenharmony_ci#define RT5651_M_BST2_OM_L			(0x1 << 6)
6738c2ecf20Sopenharmony_ci#define RT5651_M_BST2_OM_L_SFT			6
6748c2ecf20Sopenharmony_ci#define RT5651_M_BST1_OM_L			(0x1 << 5)
6758c2ecf20Sopenharmony_ci#define RT5651_M_BST1_OM_L_SFT			5
6768c2ecf20Sopenharmony_ci#define RT5651_M_IN1_L_OM_L			(0x1 << 4)
6778c2ecf20Sopenharmony_ci#define RT5651_M_IN1_L_OM_L_SFT			4
6788c2ecf20Sopenharmony_ci#define RT5651_M_RM_L_OM_L			(0x1 << 3)
6798c2ecf20Sopenharmony_ci#define RT5651_M_RM_L_OM_L_SFT			3
6808c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_OM_L			(0x1)
6818c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_OM_L_SFT		0
6828c2ecf20Sopenharmony_ci
6838c2ecf20Sopenharmony_ci/* Output Right Mixer Control 1 (0x50) */
6848c2ecf20Sopenharmony_ci#define RT5651_G_BST2_OM_R_MASK			(0x7 << 10)
6858c2ecf20Sopenharmony_ci#define RT5651_G_BST2_OM_R_SFT			10
6868c2ecf20Sopenharmony_ci#define RT5651_G_BST1_OM_R_MASK			(0x7 << 7)
6878c2ecf20Sopenharmony_ci#define RT5651_G_BST1_OM_R_SFT			7
6888c2ecf20Sopenharmony_ci#define RT5651_G_IN1_R_OM_R_MASK		(0x7 << 4)
6898c2ecf20Sopenharmony_ci#define RT5651_G_IN1_R_OM_R_SFT			4
6908c2ecf20Sopenharmony_ci#define RT5651_G_RM_R_OM_R_MASK			(0x7 << 1)
6918c2ecf20Sopenharmony_ci#define RT5651_G_RM_R_OM_R_SFT			1
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/* Output Right Mixer Control 2 (0x51) */
6948c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R1_OM_R_MASK		(0x7 << 7)
6958c2ecf20Sopenharmony_ci#define RT5651_G_DAC_R1_OM_R_SFT		7
6968c2ecf20Sopenharmony_ci#define RT5651_G_IN2_R_OM_R_MASK		(0x7 << 4)
6978c2ecf20Sopenharmony_ci#define RT5651_G_IN2_R_OM_R_SFT			4
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_ci/* Output Right Mixer Control 3 (0x52) */
7008c2ecf20Sopenharmony_ci#define RT5651_M_IN2_R_OM_R			(0x1 << 9)
7018c2ecf20Sopenharmony_ci#define RT5651_M_IN2_R_OM_R_SFT			9
7028c2ecf20Sopenharmony_ci#define RT5651_M_BST2_OM_R			(0x1 << 6)
7038c2ecf20Sopenharmony_ci#define RT5651_M_BST2_OM_R_SFT			6
7048c2ecf20Sopenharmony_ci#define RT5651_M_BST1_OM_R			(0x1 << 5)
7058c2ecf20Sopenharmony_ci#define RT5651_M_BST1_OM_R_SFT			5
7068c2ecf20Sopenharmony_ci#define RT5651_M_IN1_R_OM_R			(0x1 << 4)
7078c2ecf20Sopenharmony_ci#define RT5651_M_IN1_R_OM_R_SFT			4
7088c2ecf20Sopenharmony_ci#define RT5651_M_RM_R_OM_R			(0x1 << 3)
7098c2ecf20Sopenharmony_ci#define RT5651_M_RM_R_OM_R_SFT			3
7108c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_OM_R			(0x1)
7118c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_OM_R_SFT		0
7128c2ecf20Sopenharmony_ci
7138c2ecf20Sopenharmony_ci/* LOUT Mixer Control (0x53) */
7148c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_LM			(0x1 << 15)
7158c2ecf20Sopenharmony_ci#define RT5651_M_DAC_L1_LM_SFT			15
7168c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_LM			(0x1 << 14)
7178c2ecf20Sopenharmony_ci#define RT5651_M_DAC_R1_LM_SFT			14
7188c2ecf20Sopenharmony_ci#define RT5651_M_OV_L_LM			(0x1 << 13)
7198c2ecf20Sopenharmony_ci#define RT5651_M_OV_L_LM_SFT			13
7208c2ecf20Sopenharmony_ci#define RT5651_M_OV_R_LM			(0x1 << 12)
7218c2ecf20Sopenharmony_ci#define RT5651_M_OV_R_LM_SFT			12
7228c2ecf20Sopenharmony_ci#define RT5651_G_LOUTMIX_MASK			(0x1 << 11)
7238c2ecf20Sopenharmony_ci#define RT5651_G_LOUTMIX_SFT			11
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci/* Power Management for Digital 1 (0x61) */
7268c2ecf20Sopenharmony_ci#define RT5651_PWR_I2S1				(0x1 << 15)
7278c2ecf20Sopenharmony_ci#define RT5651_PWR_I2S1_BIT			15
7288c2ecf20Sopenharmony_ci#define RT5651_PWR_I2S2				(0x1 << 14)
7298c2ecf20Sopenharmony_ci#define RT5651_PWR_I2S2_BIT			14
7308c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_L1			(0x1 << 12)
7318c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_L1_BIT			12
7328c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_R1			(0x1 << 11)
7338c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_R1_BIT			11
7348c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_L			(0x1 << 2)
7358c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_L_BIT			2
7368c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_R			(0x1 << 1)
7378c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_R_BIT			1
7388c2ecf20Sopenharmony_ci
7398c2ecf20Sopenharmony_ci/* Power Management for Digital 2 (0x62) */
7408c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_STO1_F			(0x1 << 15)
7418c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_STO1_F_BIT			15
7428c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_STO2_F			(0x1 << 14)
7438c2ecf20Sopenharmony_ci#define RT5651_PWR_ADC_STO2_F_BIT		14
7448c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_STO1_F			(0x1 << 11)
7458c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_STO1_F_BIT			11
7468c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_STO2_F			(0x1 << 10)
7478c2ecf20Sopenharmony_ci#define RT5651_PWR_DAC_STO2_F_BIT		10
7488c2ecf20Sopenharmony_ci#define RT5651_PWR_PDM				(0x1 << 9)
7498c2ecf20Sopenharmony_ci#define RT5651_PWR_PDM_BIT			9
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci/* Power Management for Analog 1 (0x63) */
7528c2ecf20Sopenharmony_ci#define RT5651_PWR_VREF1			(0x1 << 15)
7538c2ecf20Sopenharmony_ci#define RT5651_PWR_VREF1_BIT			15
7548c2ecf20Sopenharmony_ci#define RT5651_PWR_FV1				(0x1 << 14)
7558c2ecf20Sopenharmony_ci#define RT5651_PWR_FV1_BIT			14
7568c2ecf20Sopenharmony_ci#define RT5651_PWR_MB				(0x1 << 13)
7578c2ecf20Sopenharmony_ci#define RT5651_PWR_MB_BIT			13
7588c2ecf20Sopenharmony_ci#define RT5651_PWR_LM				(0x1 << 12)
7598c2ecf20Sopenharmony_ci#define RT5651_PWR_LM_BIT			12
7608c2ecf20Sopenharmony_ci#define RT5651_PWR_BG				(0x1 << 11)
7618c2ecf20Sopenharmony_ci#define RT5651_PWR_BG_BIT			11
7628c2ecf20Sopenharmony_ci#define RT5651_PWR_HP_L				(0x1 << 7)
7638c2ecf20Sopenharmony_ci#define RT5651_PWR_HP_L_BIT			7
7648c2ecf20Sopenharmony_ci#define RT5651_PWR_HP_R				(0x1 << 6)
7658c2ecf20Sopenharmony_ci#define RT5651_PWR_HP_R_BIT			6
7668c2ecf20Sopenharmony_ci#define RT5651_PWR_HA				(0x1 << 5)
7678c2ecf20Sopenharmony_ci#define RT5651_PWR_HA_BIT			5
7688c2ecf20Sopenharmony_ci#define RT5651_PWR_VREF2			(0x1 << 4)
7698c2ecf20Sopenharmony_ci#define RT5651_PWR_VREF2_BIT			4
7708c2ecf20Sopenharmony_ci#define RT5651_PWR_FV2				(0x1 << 3)
7718c2ecf20Sopenharmony_ci#define RT5651_PWR_FV2_BIT			3
7728c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO				(0x1 << 2)
7738c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_BIT			2
7748c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_DVO_MASK			(0x3)
7758c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_DVO_1_0V			0
7768c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_DVO_1_1V			1
7778c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_DVO_1_2V			2
7788c2ecf20Sopenharmony_ci#define RT5651_PWR_LDO_DVO_1_3V			3
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_ci/* Power Management for Analog 2 (0x64) */
7818c2ecf20Sopenharmony_ci#define RT5651_PWR_BST1				(0x1 << 15)
7828c2ecf20Sopenharmony_ci#define RT5651_PWR_BST1_BIT			15
7838c2ecf20Sopenharmony_ci#define RT5651_PWR_BST2				(0x1 << 14)
7848c2ecf20Sopenharmony_ci#define RT5651_PWR_BST2_BIT			14
7858c2ecf20Sopenharmony_ci#define RT5651_PWR_BST3				(0x1 << 13)
7868c2ecf20Sopenharmony_ci#define RT5651_PWR_BST3_BIT			13
7878c2ecf20Sopenharmony_ci#define RT5651_PWR_MB1				(0x1 << 11)
7888c2ecf20Sopenharmony_ci#define RT5651_PWR_MB1_BIT			11
7898c2ecf20Sopenharmony_ci#define RT5651_PWR_PLL				(0x1 << 9)
7908c2ecf20Sopenharmony_ci#define RT5651_PWR_PLL_BIT			9
7918c2ecf20Sopenharmony_ci#define RT5651_PWR_BST1_OP2			(0x1 << 5)
7928c2ecf20Sopenharmony_ci#define RT5651_PWR_BST1_OP2_BIT			5
7938c2ecf20Sopenharmony_ci#define RT5651_PWR_BST2_OP2			(0x1 << 4)
7948c2ecf20Sopenharmony_ci#define RT5651_PWR_BST2_OP2_BIT			4
7958c2ecf20Sopenharmony_ci#define RT5651_PWR_BST3_OP2			(0x1 << 3)
7968c2ecf20Sopenharmony_ci#define RT5651_PWR_BST3_OP2_BIT			3
7978c2ecf20Sopenharmony_ci#define RT5651_PWR_JD_M				(0x1 << 2)
7988c2ecf20Sopenharmony_ci#define RT5651_PWM_JD_M_BIT			2
7998c2ecf20Sopenharmony_ci#define RT5651_PWR_JD2				(0x1 << 1)
8008c2ecf20Sopenharmony_ci#define RT5651_PWM_JD2_BIT			1
8018c2ecf20Sopenharmony_ci#define RT5651_PWR_JD3				(0x1)
8028c2ecf20Sopenharmony_ci#define RT5651_PWM_JD3_BIT			0
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci/* Power Management for Mixer (0x65) */
8058c2ecf20Sopenharmony_ci#define RT5651_PWR_OM_L				(0x1 << 15)
8068c2ecf20Sopenharmony_ci#define RT5651_PWR_OM_L_BIT			15
8078c2ecf20Sopenharmony_ci#define RT5651_PWR_OM_R				(0x1 << 14)
8088c2ecf20Sopenharmony_ci#define RT5651_PWR_OM_R_BIT			14
8098c2ecf20Sopenharmony_ci#define RT5651_PWR_RM_L				(0x1 << 11)
8108c2ecf20Sopenharmony_ci#define RT5651_PWR_RM_L_BIT			11
8118c2ecf20Sopenharmony_ci#define RT5651_PWR_RM_R				(0x1 << 10)
8128c2ecf20Sopenharmony_ci#define RT5651_PWR_RM_R_BIT			10
8138c2ecf20Sopenharmony_ci
8148c2ecf20Sopenharmony_ci/* Power Management for Volume (0x66) */
8158c2ecf20Sopenharmony_ci#define RT5651_PWR_OV_L				(0x1 << 13)
8168c2ecf20Sopenharmony_ci#define RT5651_PWR_OV_L_BIT			13
8178c2ecf20Sopenharmony_ci#define RT5651_PWR_OV_R				(0x1 << 12)
8188c2ecf20Sopenharmony_ci#define RT5651_PWR_OV_R_BIT			12
8198c2ecf20Sopenharmony_ci#define RT5651_PWR_HV_L				(0x1 << 11)
8208c2ecf20Sopenharmony_ci#define RT5651_PWR_HV_L_BIT			11
8218c2ecf20Sopenharmony_ci#define RT5651_PWR_HV_R				(0x1 << 10)
8228c2ecf20Sopenharmony_ci#define RT5651_PWR_HV_R_BIT			10
8238c2ecf20Sopenharmony_ci#define RT5651_PWR_IN1_L			(0x1 << 9)
8248c2ecf20Sopenharmony_ci#define RT5651_PWR_IN1_L_BIT			9
8258c2ecf20Sopenharmony_ci#define RT5651_PWR_IN1_R			(0x1 << 8)
8268c2ecf20Sopenharmony_ci#define RT5651_PWR_IN1_R_BIT			8
8278c2ecf20Sopenharmony_ci#define RT5651_PWR_IN2_L			(0x1 << 7)
8288c2ecf20Sopenharmony_ci#define RT5651_PWR_IN2_L_BIT			7
8298c2ecf20Sopenharmony_ci#define RT5651_PWR_IN2_R			(0x1 << 6)
8308c2ecf20Sopenharmony_ci#define RT5651_PWR_IN2_R_BIT			6
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ci/* I2S1/2/3 Audio Serial Data Port Control (0x70 0x71) */
8338c2ecf20Sopenharmony_ci#define RT5651_I2S_MS_MASK			(0x1 << 15)
8348c2ecf20Sopenharmony_ci#define RT5651_I2S_MS_SFT			15
8358c2ecf20Sopenharmony_ci#define RT5651_I2S_MS_M				(0x0 << 15)
8368c2ecf20Sopenharmony_ci#define RT5651_I2S_MS_S				(0x1 << 15)
8378c2ecf20Sopenharmony_ci#define RT5651_I2S_O_CP_MASK			(0x3 << 10)
8388c2ecf20Sopenharmony_ci#define RT5651_I2S_O_CP_SFT			10
8398c2ecf20Sopenharmony_ci#define RT5651_I2S_O_CP_OFF			(0x0 << 10)
8408c2ecf20Sopenharmony_ci#define RT5651_I2S_O_CP_U_LAW			(0x1 << 10)
8418c2ecf20Sopenharmony_ci#define RT5651_I2S_O_CP_A_LAW			(0x2 << 10)
8428c2ecf20Sopenharmony_ci#define RT5651_I2S_I_CP_MASK			(0x3 << 8)
8438c2ecf20Sopenharmony_ci#define RT5651_I2S_I_CP_SFT			8
8448c2ecf20Sopenharmony_ci#define RT5651_I2S_I_CP_OFF			(0x0 << 8)
8458c2ecf20Sopenharmony_ci#define RT5651_I2S_I_CP_U_LAW			(0x1 << 8)
8468c2ecf20Sopenharmony_ci#define RT5651_I2S_I_CP_A_LAW			(0x2 << 8)
8478c2ecf20Sopenharmony_ci#define RT5651_I2S_BP_MASK			(0x1 << 7)
8488c2ecf20Sopenharmony_ci#define RT5651_I2S_BP_SFT			7
8498c2ecf20Sopenharmony_ci#define RT5651_I2S_BP_NOR			(0x0 << 7)
8508c2ecf20Sopenharmony_ci#define RT5651_I2S_BP_INV			(0x1 << 7)
8518c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_MASK			(0x3 << 2)
8528c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_SFT			2
8538c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_16			(0x0 << 2)
8548c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_20			(0x1 << 2)
8558c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_24			(0x2 << 2)
8568c2ecf20Sopenharmony_ci#define RT5651_I2S_DL_8				(0x3 << 2)
8578c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_MASK			(0x3)
8588c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_SFT			0
8598c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_I2S			(0x0)
8608c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_LEFT			(0x1)
8618c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_PCM_A			(0x2)
8628c2ecf20Sopenharmony_ci#define RT5651_I2S_DF_PCM_B			(0x3)
8638c2ecf20Sopenharmony_ci
8648c2ecf20Sopenharmony_ci/* ADC/DAC Clock Control 1 (0x73) */
8658c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_MASK			(0x7 << 12)
8668c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_SFT			12
8678c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_1			(0x0 << 12)
8688c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_2			(0x1 << 12)
8698c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_3			(0x2 << 12)
8708c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_4			(0x3 << 12)
8718c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_6			(0x4 << 12)
8728c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_8			(0x5 << 12)
8738c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_12			(0x6 << 12)
8748c2ecf20Sopenharmony_ci#define RT5651_I2S_PD1_16			(0x7 << 12)
8758c2ecf20Sopenharmony_ci#define RT5651_I2S_BCLK_MS2_MASK		(0x1 << 11)
8768c2ecf20Sopenharmony_ci#define RT5651_I2S_BCLK_MS2_SFT			11
8778c2ecf20Sopenharmony_ci#define RT5651_I2S_BCLK_MS2_32			(0x0 << 11)
8788c2ecf20Sopenharmony_ci#define RT5651_I2S_BCLK_MS2_64			(0x1 << 11)
8798c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_MASK			(0x7 << 8)
8808c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_SFT			8
8818c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_1			(0x0 << 8)
8828c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_2			(0x1 << 8)
8838c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_3			(0x2 << 8)
8848c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_4			(0x3 << 8)
8858c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_6			(0x4 << 8)
8868c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_8			(0x5 << 8)
8878c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_12			(0x6 << 8)
8888c2ecf20Sopenharmony_ci#define RT5651_I2S_PD2_16			(0x7 << 8)
8898c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_MASK			(0x3 << 2)
8908c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_SFT			2
8918c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_128			(0x0 << 2)
8928c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_64			(0x1 << 2)
8938c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_32			(0x2 << 2)
8948c2ecf20Sopenharmony_ci#define RT5651_DAC_OSR_128_3			(0x3 << 2)
8958c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_MASK			(0x3)
8968c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_SFT			0
8978c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_128			(0x0)
8988c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_64			(0x1)
8998c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_32			(0x2)
9008c2ecf20Sopenharmony_ci#define RT5651_ADC_OSR_128_3			(0x3)
9018c2ecf20Sopenharmony_ci
9028c2ecf20Sopenharmony_ci/* ADC/DAC Clock Control 2 (0x74) */
9038c2ecf20Sopenharmony_ci#define RT5651_DAHPF_EN				(0x1 << 11)
9048c2ecf20Sopenharmony_ci#define RT5651_DAHPF_EN_SFT			11
9058c2ecf20Sopenharmony_ci#define RT5651_ADHPF_EN				(0x1 << 10)
9068c2ecf20Sopenharmony_ci#define RT5651_ADHPF_EN_SFT			10
9078c2ecf20Sopenharmony_ci
9088c2ecf20Sopenharmony_ci/* Digital Microphone Control (0x75) */
9098c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_EN_MASK			(0x1 << 15)
9108c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_EN_SFT			15
9118c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_DIS			(0x0 << 15)
9128c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_EN			(0x1 << 15)
9138c2ecf20Sopenharmony_ci#define RT5651_DMIC_1L_LH_MASK			(0x1 << 13)
9148c2ecf20Sopenharmony_ci#define RT5651_DMIC_1L_LH_SFT			13
9158c2ecf20Sopenharmony_ci#define RT5651_DMIC_1L_LH_FALLING		(0x0 << 13)
9168c2ecf20Sopenharmony_ci#define RT5651_DMIC_1L_LH_RISING		(0x1 << 13)
9178c2ecf20Sopenharmony_ci#define RT5651_DMIC_1R_LH_MASK			(0x1 << 12)
9188c2ecf20Sopenharmony_ci#define RT5651_DMIC_1R_LH_SFT			12
9198c2ecf20Sopenharmony_ci#define RT5651_DMIC_1R_LH_FALLING		(0x0 << 12)
9208c2ecf20Sopenharmony_ci#define RT5651_DMIC_1R_LH_RISING		(0x1 << 12)
9218c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_DP_MASK			(0x3 << 10)
9228c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_DP_SFT			10
9238c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_DP_GPIO6			(0x0 << 10)
9248c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_DP_IN1P			(0x1 << 10)
9258c2ecf20Sopenharmony_ci#define RT5651_DMIC_2_DP_GPIO8			(0x2 << 10)
9268c2ecf20Sopenharmony_ci#define RT5651_DMIC_CLK_MASK			(0x7 << 5)
9278c2ecf20Sopenharmony_ci#define RT5651_DMIC_CLK_SFT			5
9288c2ecf20Sopenharmony_ci
9298c2ecf20Sopenharmony_ci/* TDM Control 1 (0x77) */
9308c2ecf20Sopenharmony_ci#define RT5651_TDM_INTEL_SEL_MASK		(0x1 << 15)
9318c2ecf20Sopenharmony_ci#define RT5651_TDM_INTEL_SEL_SFT		15
9328c2ecf20Sopenharmony_ci#define RT5651_TDM_INTEL_SEL_64			(0x0 << 15)
9338c2ecf20Sopenharmony_ci#define RT5651_TDM_INTEL_SEL_50			(0x1 << 15)
9348c2ecf20Sopenharmony_ci#define RT5651_TDM_MODE_SEL_MASK		(0x1 << 14)
9358c2ecf20Sopenharmony_ci#define RT5651_TDM_MODE_SEL_SFT			14
9368c2ecf20Sopenharmony_ci#define RT5651_TDM_MODE_SEL_NOR			(0x0 << 14)
9378c2ecf20Sopenharmony_ci#define RT5651_TDM_MODE_SEL_TDM			(0x1 << 14)
9388c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_MASK		(0x3 << 12)
9398c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_SFT		12
9408c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_2			(0x0 << 12)
9418c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_4			(0x1 << 12)
9428c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_6			(0x2 << 12)
9438c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_NUM_SEL_8			(0x3 << 12)
9448c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_MASK		(0x3 << 10)
9458c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_SFT		10
9468c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_16		(0x0 << 10)
9478c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_20		(0x1 << 10)
9488c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_24		(0x2 << 10)
9498c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_LEN_SEL_32		(0x3 << 10)
9508c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_SEL_MASK			(0x1 << 9)
9518c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_SEL_SFT			9
9528c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_SEL_NOR			(0x0 << 9)
9538c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_SEL_SWAP			(0x1 << 9)
9548c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_START_SEL_MASK		(0x1 << 8)
9558c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_START_SEL_SFT		8
9568c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_START_SEL_SL0		(0x0 << 8)
9578c2ecf20Sopenharmony_ci#define RT5651_TDM_ADC_START_SEL_SL4		(0x1 << 8)
9588c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_MASK		(0x3 << 6)
9598c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_SFT		6
9608c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_LR		(0x0 << 6)
9618c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_RL		(0x1 << 6)
9628c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_LL		(0x2 << 6)
9638c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH2_SEL_RR		(0x3 << 6)
9648c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_MASK		(0x3 << 4)
9658c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_SFT		4
9668c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_LR		(0x0 << 4)
9678c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_RL		(0x1 << 4)
9688c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_LL		(0x2 << 4)
9698c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH4_SEL_RR		(0x3 << 4)
9708c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_MASK		(0x3 << 2)
9718c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_SFT		2
9728c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_LR		(0x0 << 2)
9738c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_RL		(0x1 << 2)
9748c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_LL		(0x2 << 2)
9758c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH6_SEL_RR		(0x3 << 2)
9768c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_MASK		(0x3)
9778c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_SFT		0
9788c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_LR		(0x0)
9798c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_RL		(0x1)
9808c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_LL		(0x2)
9818c2ecf20Sopenharmony_ci#define RT5651_TDM_I2S_CH8_SEL_RR		(0x3)
9828c2ecf20Sopenharmony_ci
9838c2ecf20Sopenharmony_ci/* TDM Control 2 (0x78) */
9848c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_POL_SEL_MASK		(0x1 << 15)
9858c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_POL_SEL_SFT		15
9868c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_POL_SEL_NOR		(0x0 << 15)
9878c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_POL_SEL_INV		(0x1 << 15)
9888c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_SEL_MASK		(0x1 << 14)
9898c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_SEL_SFT		14
9908c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_SEL_CH01		(0x0 << 14)
9918c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_SEL_CH0123		(0x1 << 14)
9928c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_EN			(0x1 << 13)
9938c2ecf20Sopenharmony_ci#define RT5651_TDM_CH_VAL_SFT			13
9948c2ecf20Sopenharmony_ci#define RT5651_TDM_LPBK_EN			(0x1 << 12)
9958c2ecf20Sopenharmony_ci#define RT5651_TDM_LPBK_SFT			12
9968c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_PULSE_SEL_MASK		(0x1 << 11)
9978c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_PULSE_SEL_SFT		11
9988c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_PULSE_SEL_BCLK		(0x0 << 11)
9998c2ecf20Sopenharmony_ci#define RT5651_TDM_LRCK_PULSE_SEL_CH		(0x1 << 11)
10008c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_SEL_MASK		(0x1 << 10)
10018c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_SEL_SFT		10
10028c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_SEL_POS		(0x0 << 10)
10038c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_SEL_NEG		(0x1 << 10)
10048c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_EN			(0x1 << 9)
10058c2ecf20Sopenharmony_ci#define RT5651_TDM_END_EDGE_EN_SFT		9
10068c2ecf20Sopenharmony_ci#define RT5651_TDM_TRAN_EDGE_SEL_MASK		(0x1 << 8)
10078c2ecf20Sopenharmony_ci#define RT5651_TDM_TRAN_EDGE_SEL_SFT		8
10088c2ecf20Sopenharmony_ci#define RT5651_TDM_TRAN_EDGE_SEL_POS		(0x0 << 8)
10098c2ecf20Sopenharmony_ci#define RT5651_TDM_TRAN_EDGE_SEL_NEG		(0x1 << 8)
10108c2ecf20Sopenharmony_ci#define RT5651_M_TDM2_L				(0x1 << 7)
10118c2ecf20Sopenharmony_ci#define RT5651_M_TDM2_L_SFT			7
10128c2ecf20Sopenharmony_ci#define RT5651_M_TDM2_R				(0x1 << 6)
10138c2ecf20Sopenharmony_ci#define RT5651_M_TDM2_R_SFT			6
10148c2ecf20Sopenharmony_ci#define RT5651_M_TDM4_L				(0x1 << 5)
10158c2ecf20Sopenharmony_ci#define RT5651_M_TDM4_L_SFT			5
10168c2ecf20Sopenharmony_ci#define RT5651_M_TDM4_R				(0x1 << 4)
10178c2ecf20Sopenharmony_ci#define RT5651_M_TDM4_R_SFT			4
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_ci/* TDM Control 3 (0x79) */
10208c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_MASK			(0x7 << 12)
10218c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SFT			12
10228c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL0			(0x0 << 12)
10238c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL1			(0x1 << 12)
10248c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL2			(0x2 << 12)
10258c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL3			(0x3 << 12)
10268c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL4			(0x4 << 12)
10278c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL5			(0x5 << 12)
10288c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL6			(0x6 << 12)
10298c2ecf20Sopenharmony_ci#define RT5651_CH2_L_SEL_SL7			(0x7 << 12)
10308c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_MASK			(0x7 << 8)
10318c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SFT			8
10328c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL0			(0x0 << 8)
10338c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL1			(0x1 << 8)
10348c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL2			(0x2 << 8)
10358c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL3			(0x3 << 8)
10368c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL4			(0x4 << 8)
10378c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL5			(0x5 << 8)
10388c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL6			(0x6 << 8)
10398c2ecf20Sopenharmony_ci#define RT5651_CH2_R_SEL_SL7			(0x7 << 8)
10408c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_MASK			(0x7 << 4)
10418c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SFT			4
10428c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL0			(0x0 << 4)
10438c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL1			(0x1 << 4)
10448c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL2			(0x2 << 4)
10458c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL3			(0x3 << 4)
10468c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL4			(0x4 << 4)
10478c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL5			(0x5 << 4)
10488c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL6			(0x6 << 4)
10498c2ecf20Sopenharmony_ci#define RT5651_CH4_L_SEL_SL7			(0x7 << 4)
10508c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_MASK			(0x7)
10518c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SFT			0
10528c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL0			(0x0)
10538c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL1			(0x1)
10548c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL2			(0x2)
10558c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL3			(0x3)
10568c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL4			(0x4)
10578c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL5			(0x5)
10588c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL6			(0x6)
10598c2ecf20Sopenharmony_ci#define RT5651_CH4_R_SEL_SL7			(0x7)
10608c2ecf20Sopenharmony_ci
10618c2ecf20Sopenharmony_ci/* Global Clock Control (0x80) */
10628c2ecf20Sopenharmony_ci#define RT5651_SCLK_SRC_MASK			(0x3 << 14)
10638c2ecf20Sopenharmony_ci#define RT5651_SCLK_SRC_SFT			14
10648c2ecf20Sopenharmony_ci#define RT5651_SCLK_SRC_MCLK			(0x0 << 14)
10658c2ecf20Sopenharmony_ci#define RT5651_SCLK_SRC_PLL1			(0x1 << 14)
10668c2ecf20Sopenharmony_ci#define RT5651_SCLK_SRC_RCCLK			(0x2 << 14)
10678c2ecf20Sopenharmony_ci#define RT5651_PLL1_SRC_MASK			(0x3 << 12)
10688c2ecf20Sopenharmony_ci#define RT5651_PLL1_SRC_SFT			12
10698c2ecf20Sopenharmony_ci#define RT5651_PLL1_SRC_MCLK			(0x0 << 12)
10708c2ecf20Sopenharmony_ci#define RT5651_PLL1_SRC_BCLK1			(0x1 << 12)
10718c2ecf20Sopenharmony_ci#define RT5651_PLL1_SRC_BCLK2			(0x2 << 12)
10728c2ecf20Sopenharmony_ci#define RT5651_PLL1_PD_MASK			(0x1 << 3)
10738c2ecf20Sopenharmony_ci#define RT5651_PLL1_PD_SFT			3
10748c2ecf20Sopenharmony_ci#define RT5651_PLL1_PD_1			(0x0 << 3)
10758c2ecf20Sopenharmony_ci#define RT5651_PLL1_PD_2			(0x1 << 3)
10768c2ecf20Sopenharmony_ci
10778c2ecf20Sopenharmony_ci#define RT5651_PLL_INP_MAX			40000000
10788c2ecf20Sopenharmony_ci#define RT5651_PLL_INP_MIN			256000
10798c2ecf20Sopenharmony_ci/* PLL M/N/K Code Control 1 (0x81) */
10808c2ecf20Sopenharmony_ci#define RT5651_PLL_N_MAX			0x1ff
10818c2ecf20Sopenharmony_ci#define RT5651_PLL_N_MASK			(RT5651_PLL_N_MAX << 7)
10828c2ecf20Sopenharmony_ci#define RT5651_PLL_N_SFT			7
10838c2ecf20Sopenharmony_ci#define RT5651_PLL_K_MAX			0x1f
10848c2ecf20Sopenharmony_ci#define RT5651_PLL_K_MASK			(RT5651_PLL_K_MAX)
10858c2ecf20Sopenharmony_ci#define RT5651_PLL_K_SFT			0
10868c2ecf20Sopenharmony_ci
10878c2ecf20Sopenharmony_ci/* PLL M/N/K Code Control 2 (0x82) */
10888c2ecf20Sopenharmony_ci#define RT5651_PLL_M_MAX			0xf
10898c2ecf20Sopenharmony_ci#define RT5651_PLL_M_MASK			(RT5651_PLL_M_MAX << 12)
10908c2ecf20Sopenharmony_ci#define RT5651_PLL_M_SFT			12
10918c2ecf20Sopenharmony_ci#define RT5651_PLL_M_BP				(0x1 << 11)
10928c2ecf20Sopenharmony_ci#define RT5651_PLL_M_BP_SFT			11
10938c2ecf20Sopenharmony_ci
10948c2ecf20Sopenharmony_ci/* PLL tracking mode 1 (0x83) */
10958c2ecf20Sopenharmony_ci#define RT5651_STO1_T_MASK			(0x1 << 15)
10968c2ecf20Sopenharmony_ci#define RT5651_STO1_T_SFT			15
10978c2ecf20Sopenharmony_ci#define RT5651_STO1_T_SCLK			(0x0 << 15)
10988c2ecf20Sopenharmony_ci#define RT5651_STO1_T_LRCK1			(0x1 << 15)
10998c2ecf20Sopenharmony_ci#define RT5651_STO2_T_MASK			(0x1 << 12)
11008c2ecf20Sopenharmony_ci#define RT5651_STO2_T_SFT			12
11018c2ecf20Sopenharmony_ci#define RT5651_STO2_T_I2S2			(0x0 << 12)
11028c2ecf20Sopenharmony_ci#define RT5651_STO2_T_LRCK2			(0x1 << 12)
11038c2ecf20Sopenharmony_ci#define RT5651_ASRC2_REF_MASK			(0x1 << 11)
11048c2ecf20Sopenharmony_ci#define RT5651_ASRC2_REF_SFT			11
11058c2ecf20Sopenharmony_ci#define RT5651_ASRC2_REF_LRCK2			(0x0 << 11)
11068c2ecf20Sopenharmony_ci#define RT5651_ASRC2_REF_LRCK1			(0x1 << 11)
11078c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_M_MASK			(0x1 << 9)
11088c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_M_SFT			9
11098c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_M_NOR			(0x0 << 9)
11108c2ecf20Sopenharmony_ci#define RT5651_DMIC_1_M_ASYN			(0x1 << 9)
11118c2ecf20Sopenharmony_ci
11128c2ecf20Sopenharmony_ci/* PLL tracking mode 2 (0x84) */
11138c2ecf20Sopenharmony_ci#define RT5651_STO1_ASRC_EN			(0x1 << 15)
11148c2ecf20Sopenharmony_ci#define RT5651_STO1_ASRC_EN_SFT			15
11158c2ecf20Sopenharmony_ci#define RT5651_STO2_ASRC_EN			(0x1 << 14)
11168c2ecf20Sopenharmony_ci#define RT5651_STO2_ASRC_EN_SFT			14
11178c2ecf20Sopenharmony_ci#define RT5651_STO1_DAC_M_MASK			(0x1 << 13)
11188c2ecf20Sopenharmony_ci#define RT5651_STO1_DAC_M_SFT			13
11198c2ecf20Sopenharmony_ci#define RT5651_STO1_DAC_M_NOR			(0x0 << 13)
11208c2ecf20Sopenharmony_ci#define RT5651_STO1_DAC_M_ASRC			(0x1 << 13)
11218c2ecf20Sopenharmony_ci#define RT5651_STO2_DAC_M_MASK			(0x1 << 12)
11228c2ecf20Sopenharmony_ci#define RT5651_STO2_DAC_M_SFT			12
11238c2ecf20Sopenharmony_ci#define RT5651_STO2_DAC_M_NOR			(0x0 << 12)
11248c2ecf20Sopenharmony_ci#define RT5651_STO2_DAC_M_ASRC			(0x1 << 12)
11258c2ecf20Sopenharmony_ci#define RT5651_ADC_M_MASK			(0x1 << 11)
11268c2ecf20Sopenharmony_ci#define RT5651_ADC_M_SFT			11
11278c2ecf20Sopenharmony_ci#define RT5651_ADC_M_NOR			(0x0 << 11)
11288c2ecf20Sopenharmony_ci#define RT5651_ADC_M_ASRC			(0x1 << 11)
11298c2ecf20Sopenharmony_ci#define RT5651_I2S1_R_D_MASK			(0x1 << 4)
11308c2ecf20Sopenharmony_ci#define RT5651_I2S1_R_D_SFT			4
11318c2ecf20Sopenharmony_ci#define RT5651_I2S1_R_D_DIS			(0x0 << 4)
11328c2ecf20Sopenharmony_ci#define RT5651_I2S1_R_D_EN			(0x1 << 4)
11338c2ecf20Sopenharmony_ci#define RT5651_I2S2_R_D_MASK			(0x1 << 3)
11348c2ecf20Sopenharmony_ci#define RT5651_I2S2_R_D_SFT			3
11358c2ecf20Sopenharmony_ci#define RT5651_I2S2_R_D_DIS			(0x0 << 3)
11368c2ecf20Sopenharmony_ci#define RT5651_I2S2_R_D_EN			(0x1 << 3)
11378c2ecf20Sopenharmony_ci#define RT5651_PRE_SCLK_MASK			(0x3)
11388c2ecf20Sopenharmony_ci#define RT5651_PRE_SCLK_SFT			0
11398c2ecf20Sopenharmony_ci#define RT5651_PRE_SCLK_512			(0x0)
11408c2ecf20Sopenharmony_ci#define RT5651_PRE_SCLK_1024			(0x1)
11418c2ecf20Sopenharmony_ci#define RT5651_PRE_SCLK_2048			(0x2)
11428c2ecf20Sopenharmony_ci
11438c2ecf20Sopenharmony_ci/* PLL tracking mode 3 (0x85) */
11448c2ecf20Sopenharmony_ci#define RT5651_I2S1_RATE_MASK			(0xf << 12)
11458c2ecf20Sopenharmony_ci#define RT5651_I2S1_RATE_SFT			12
11468c2ecf20Sopenharmony_ci#define RT5651_I2S2_RATE_MASK			(0xf << 8)
11478c2ecf20Sopenharmony_ci#define RT5651_I2S2_RATE_SFT			8
11488c2ecf20Sopenharmony_ci#define RT5651_G_ASRC_LP_MASK			(0x1 << 3)
11498c2ecf20Sopenharmony_ci#define RT5651_G_ASRC_LP_SFT			3
11508c2ecf20Sopenharmony_ci#define RT5651_ASRC_LP_F_M			(0x1 << 2)
11518c2ecf20Sopenharmony_ci#define RT5651_ASRC_LP_F_SFT			2
11528c2ecf20Sopenharmony_ci#define RT5651_ASRC_LP_F_NOR			(0x0 << 2)
11538c2ecf20Sopenharmony_ci#define RT5651_ASRC_LP_F_SB			(0x1 << 2)
11548c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_MASK			(0x3)
11558c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_SFT			0
11568c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_DIV1			(0x0)
11578c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_DIV2			(0x1)
11588c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_DIV4			(0x2)
11598c2ecf20Sopenharmony_ci#define RT5651_FTK_PH_DET_DIV8			(0x3)
11608c2ecf20Sopenharmony_ci
11618c2ecf20Sopenharmony_ci/*PLL tracking mode 6 (0x89) */
11628c2ecf20Sopenharmony_ci#define RT5651_I2S1_PD_MASK			(0x7 << 12)
11638c2ecf20Sopenharmony_ci#define RT5651_I2S1_PD_SFT			12
11648c2ecf20Sopenharmony_ci#define RT5651_I2S2_PD_MASK			(0x7 << 8)
11658c2ecf20Sopenharmony_ci#define RT5651_I2S2_PD_SFT			8
11668c2ecf20Sopenharmony_ci
11678c2ecf20Sopenharmony_ci/*PLL tracking mode 7 (0x8a) */
11688c2ecf20Sopenharmony_ci#define RT5651_FSI1_RATE_MASK			(0xf << 12)
11698c2ecf20Sopenharmony_ci#define RT5651_FSI1_RATE_SFT			12
11708c2ecf20Sopenharmony_ci#define RT5651_FSI2_RATE_MASK			(0xf << 8)
11718c2ecf20Sopenharmony_ci#define RT5651_FSI2_RATE_SFT			8
11728c2ecf20Sopenharmony_ci
11738c2ecf20Sopenharmony_ci/* HPOUT Over Current Detection (0x8b) */
11748c2ecf20Sopenharmony_ci#define RT5651_HP_OVCD_MASK			(0x1 << 10)
11758c2ecf20Sopenharmony_ci#define RT5651_HP_OVCD_SFT			10
11768c2ecf20Sopenharmony_ci#define RT5651_HP_OVCD_DIS			(0x0 << 10)
11778c2ecf20Sopenharmony_ci#define RT5651_HP_OVCD_EN			(0x1 << 10)
11788c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_MASK			(0x3 << 8)
11798c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_SFT			8
11808c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_90			(0x0 << 8)
11818c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_105			(0x1 << 8)
11828c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_120			(0x2 << 8)
11838c2ecf20Sopenharmony_ci#define RT5651_HP_OC_TH_135			(0x3 << 8)
11848c2ecf20Sopenharmony_ci
11858c2ecf20Sopenharmony_ci/* Depop Mode Control 1 (0x8e) */
11868c2ecf20Sopenharmony_ci#define RT5651_SMT_TRIG_MASK			(0x1 << 15)
11878c2ecf20Sopenharmony_ci#define RT5651_SMT_TRIG_SFT			15
11888c2ecf20Sopenharmony_ci#define RT5651_SMT_TRIG_DIS			(0x0 << 15)
11898c2ecf20Sopenharmony_ci#define RT5651_SMT_TRIG_EN			(0x1 << 15)
11908c2ecf20Sopenharmony_ci#define RT5651_HP_L_SMT_MASK			(0x1 << 9)
11918c2ecf20Sopenharmony_ci#define RT5651_HP_L_SMT_SFT			9
11928c2ecf20Sopenharmony_ci#define RT5651_HP_L_SMT_DIS			(0x0 << 9)
11938c2ecf20Sopenharmony_ci#define RT5651_HP_L_SMT_EN			(0x1 << 9)
11948c2ecf20Sopenharmony_ci#define RT5651_HP_R_SMT_MASK			(0x1 << 8)
11958c2ecf20Sopenharmony_ci#define RT5651_HP_R_SMT_SFT			8
11968c2ecf20Sopenharmony_ci#define RT5651_HP_R_SMT_DIS			(0x0 << 8)
11978c2ecf20Sopenharmony_ci#define RT5651_HP_R_SMT_EN			(0x1 << 8)
11988c2ecf20Sopenharmony_ci#define RT5651_HP_CD_PD_MASK			(0x1 << 7)
11998c2ecf20Sopenharmony_ci#define RT5651_HP_CD_PD_SFT			7
12008c2ecf20Sopenharmony_ci#define RT5651_HP_CD_PD_DIS			(0x0 << 7)
12018c2ecf20Sopenharmony_ci#define RT5651_HP_CD_PD_EN			(0x1 << 7)
12028c2ecf20Sopenharmony_ci#define RT5651_RSTN_MASK			(0x1 << 6)
12038c2ecf20Sopenharmony_ci#define RT5651_RSTN_SFT				6
12048c2ecf20Sopenharmony_ci#define RT5651_RSTN_DIS				(0x0 << 6)
12058c2ecf20Sopenharmony_ci#define RT5651_RSTN_EN				(0x1 << 6)
12068c2ecf20Sopenharmony_ci#define RT5651_RSTP_MASK			(0x1 << 5)
12078c2ecf20Sopenharmony_ci#define RT5651_RSTP_SFT				5
12088c2ecf20Sopenharmony_ci#define RT5651_RSTP_DIS				(0x0 << 5)
12098c2ecf20Sopenharmony_ci#define RT5651_RSTP_EN				(0x1 << 5)
12108c2ecf20Sopenharmony_ci#define RT5651_HP_CO_MASK			(0x1 << 4)
12118c2ecf20Sopenharmony_ci#define RT5651_HP_CO_SFT			4
12128c2ecf20Sopenharmony_ci#define RT5651_HP_CO_DIS			(0x0 << 4)
12138c2ecf20Sopenharmony_ci#define RT5651_HP_CO_EN				(0x1 << 4)
12148c2ecf20Sopenharmony_ci#define RT5651_HP_CP_MASK			(0x1 << 3)
12158c2ecf20Sopenharmony_ci#define RT5651_HP_CP_SFT			3
12168c2ecf20Sopenharmony_ci#define RT5651_HP_CP_PD				(0x0 << 3)
12178c2ecf20Sopenharmony_ci#define RT5651_HP_CP_PU				(0x1 << 3)
12188c2ecf20Sopenharmony_ci#define RT5651_HP_SG_MASK			(0x1 << 2)
12198c2ecf20Sopenharmony_ci#define RT5651_HP_SG_SFT			2
12208c2ecf20Sopenharmony_ci#define RT5651_HP_SG_DIS			(0x0 << 2)
12218c2ecf20Sopenharmony_ci#define RT5651_HP_SG_EN				(0x1 << 2)
12228c2ecf20Sopenharmony_ci#define RT5651_HP_DP_MASK			(0x1 << 1)
12238c2ecf20Sopenharmony_ci#define RT5651_HP_DP_SFT			1
12248c2ecf20Sopenharmony_ci#define RT5651_HP_DP_PD				(0x0 << 1)
12258c2ecf20Sopenharmony_ci#define RT5651_HP_DP_PU				(0x1 << 1)
12268c2ecf20Sopenharmony_ci#define RT5651_HP_CB_MASK			(0x1)
12278c2ecf20Sopenharmony_ci#define RT5651_HP_CB_SFT			0
12288c2ecf20Sopenharmony_ci#define RT5651_HP_CB_PD				(0x0)
12298c2ecf20Sopenharmony_ci#define RT5651_HP_CB_PU				(0x1)
12308c2ecf20Sopenharmony_ci
12318c2ecf20Sopenharmony_ci/* Depop Mode Control 2 (0x8f) */
12328c2ecf20Sopenharmony_ci#define RT5651_DEPOP_MASK			(0x1 << 13)
12338c2ecf20Sopenharmony_ci#define RT5651_DEPOP_SFT			13
12348c2ecf20Sopenharmony_ci#define RT5651_DEPOP_AUTO			(0x0 << 13)
12358c2ecf20Sopenharmony_ci#define RT5651_DEPOP_MAN			(0x1 << 13)
12368c2ecf20Sopenharmony_ci#define RT5651_RAMP_MASK			(0x1 << 12)
12378c2ecf20Sopenharmony_ci#define RT5651_RAMP_SFT				12
12388c2ecf20Sopenharmony_ci#define RT5651_RAMP_DIS				(0x0 << 12)
12398c2ecf20Sopenharmony_ci#define RT5651_RAMP_EN				(0x1 << 12)
12408c2ecf20Sopenharmony_ci#define RT5651_BPS_MASK				(0x1 << 11)
12418c2ecf20Sopenharmony_ci#define RT5651_BPS_SFT				11
12428c2ecf20Sopenharmony_ci#define RT5651_BPS_DIS				(0x0 << 11)
12438c2ecf20Sopenharmony_ci#define RT5651_BPS_EN				(0x1 << 11)
12448c2ecf20Sopenharmony_ci#define RT5651_FAST_UPDN_MASK			(0x1 << 10)
12458c2ecf20Sopenharmony_ci#define RT5651_FAST_UPDN_SFT			10
12468c2ecf20Sopenharmony_ci#define RT5651_FAST_UPDN_DIS			(0x0 << 10)
12478c2ecf20Sopenharmony_ci#define RT5651_FAST_UPDN_EN			(0x1 << 10)
12488c2ecf20Sopenharmony_ci#define RT5651_MRES_MASK			(0x3 << 8)
12498c2ecf20Sopenharmony_ci#define RT5651_MRES_SFT				8
12508c2ecf20Sopenharmony_ci#define RT5651_MRES_15MO			(0x0 << 8)
12518c2ecf20Sopenharmony_ci#define RT5651_MRES_25MO			(0x1 << 8)
12528c2ecf20Sopenharmony_ci#define RT5651_MRES_35MO			(0x2 << 8)
12538c2ecf20Sopenharmony_ci#define RT5651_MRES_45MO			(0x3 << 8)
12548c2ecf20Sopenharmony_ci#define RT5651_VLO_MASK				(0x1 << 7)
12558c2ecf20Sopenharmony_ci#define RT5651_VLO_SFT				7
12568c2ecf20Sopenharmony_ci#define RT5651_VLO_3V				(0x0 << 7)
12578c2ecf20Sopenharmony_ci#define RT5651_VLO_32V				(0x1 << 7)
12588c2ecf20Sopenharmony_ci#define RT5651_DIG_DP_MASK			(0x1 << 6)
12598c2ecf20Sopenharmony_ci#define RT5651_DIG_DP_SFT			6
12608c2ecf20Sopenharmony_ci#define RT5651_DIG_DP_DIS			(0x0 << 6)
12618c2ecf20Sopenharmony_ci#define RT5651_DIG_DP_EN			(0x1 << 6)
12628c2ecf20Sopenharmony_ci#define RT5651_DP_TH_MASK			(0x3 << 4)
12638c2ecf20Sopenharmony_ci#define RT5651_DP_TH_SFT			4
12648c2ecf20Sopenharmony_ci
12658c2ecf20Sopenharmony_ci/* Depop Mode Control 3 (0x90) */
12668c2ecf20Sopenharmony_ci#define RT5651_CP_SYS_MASK			(0x7 << 12)
12678c2ecf20Sopenharmony_ci#define RT5651_CP_SYS_SFT			12
12688c2ecf20Sopenharmony_ci#define RT5651_CP_FQ1_MASK			(0x7 << 8)
12698c2ecf20Sopenharmony_ci#define RT5651_CP_FQ1_SFT			8
12708c2ecf20Sopenharmony_ci#define RT5651_CP_FQ2_MASK			(0x7 << 4)
12718c2ecf20Sopenharmony_ci#define RT5651_CP_FQ2_SFT			4
12728c2ecf20Sopenharmony_ci#define RT5651_CP_FQ3_MASK			(0x7)
12738c2ecf20Sopenharmony_ci#define RT5651_CP_FQ3_SFT			0
12748c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_1_5_KHZ			0
12758c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_3_KHZ			1
12768c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_6_KHZ			2
12778c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_12_KHZ			3
12788c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_24_KHZ			4
12798c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_48_KHZ			5
12808c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_96_KHZ			6
12818c2ecf20Sopenharmony_ci#define RT5651_CP_FQ_192_KHZ			7
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci/* HPOUT charge pump (0x91) */
12848c2ecf20Sopenharmony_ci#define RT5651_OSW_L_MASK			(0x1 << 11)
12858c2ecf20Sopenharmony_ci#define RT5651_OSW_L_SFT			11
12868c2ecf20Sopenharmony_ci#define RT5651_OSW_L_DIS			(0x0 << 11)
12878c2ecf20Sopenharmony_ci#define RT5651_OSW_L_EN				(0x1 << 11)
12888c2ecf20Sopenharmony_ci#define RT5651_OSW_R_MASK			(0x1 << 10)
12898c2ecf20Sopenharmony_ci#define RT5651_OSW_R_SFT			10
12908c2ecf20Sopenharmony_ci#define RT5651_OSW_R_DIS			(0x0 << 10)
12918c2ecf20Sopenharmony_ci#define RT5651_OSW_R_EN				(0x1 << 10)
12928c2ecf20Sopenharmony_ci#define RT5651_PM_HP_MASK			(0x3 << 8)
12938c2ecf20Sopenharmony_ci#define RT5651_PM_HP_SFT			8
12948c2ecf20Sopenharmony_ci#define RT5651_PM_HP_LV				(0x0 << 8)
12958c2ecf20Sopenharmony_ci#define RT5651_PM_HP_MV				(0x1 << 8)
12968c2ecf20Sopenharmony_ci#define RT5651_PM_HP_HV				(0x2 << 8)
12978c2ecf20Sopenharmony_ci#define RT5651_IB_HP_MASK			(0x3 << 6)
12988c2ecf20Sopenharmony_ci#define RT5651_IB_HP_SFT			6
12998c2ecf20Sopenharmony_ci#define RT5651_IB_HP_125IL			(0x0 << 6)
13008c2ecf20Sopenharmony_ci#define RT5651_IB_HP_25IL			(0x1 << 6)
13018c2ecf20Sopenharmony_ci#define RT5651_IB_HP_5IL			(0x2 << 6)
13028c2ecf20Sopenharmony_ci#define RT5651_IB_HP_1IL			(0x3 << 6)
13038c2ecf20Sopenharmony_ci
13048c2ecf20Sopenharmony_ci/* Micbias Control (0x93) */
13058c2ecf20Sopenharmony_ci#define RT5651_MIC1_BS_MASK			(0x1 << 15)
13068c2ecf20Sopenharmony_ci#define RT5651_MIC1_BS_SFT			15
13078c2ecf20Sopenharmony_ci#define RT5651_MIC1_BS_9AV			(0x0 << 15)
13088c2ecf20Sopenharmony_ci#define RT5651_MIC1_BS_75AV			(0x1 << 15)
13098c2ecf20Sopenharmony_ci#define RT5651_MIC1_CLK_MASK			(0x1 << 13)
13108c2ecf20Sopenharmony_ci#define RT5651_MIC1_CLK_SFT			13
13118c2ecf20Sopenharmony_ci#define RT5651_MIC1_CLK_DIS			(0x0 << 13)
13128c2ecf20Sopenharmony_ci#define RT5651_MIC1_CLK_EN			(0x1 << 13)
13138c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVCD_MASK			(0x1 << 11)
13148c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVCD_SFT			11
13158c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVCD_DIS			(0x0 << 11)
13168c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVCD_EN			(0x1 << 11)
13178c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVTH_MASK			(0x3 << 9)
13188c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVTH_SFT			9
13198c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVTH_600UA			(0x0 << 9)
13208c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVTH_1500UA			(0x1 << 9)
13218c2ecf20Sopenharmony_ci#define RT5651_MIC1_OVTH_2000UA			(0x2 << 9)
13228c2ecf20Sopenharmony_ci#define RT5651_PWR_MB_MASK			(0x1 << 5)
13238c2ecf20Sopenharmony_ci#define RT5651_PWR_MB_SFT			5
13248c2ecf20Sopenharmony_ci#define RT5651_PWR_MB_PD			(0x0 << 5)
13258c2ecf20Sopenharmony_ci#define RT5651_PWR_MB_PU			(0x1 << 5)
13268c2ecf20Sopenharmony_ci#define RT5651_PWR_CLK12M_MASK			(0x1 << 4)
13278c2ecf20Sopenharmony_ci#define RT5651_PWR_CLK12M_SFT			4
13288c2ecf20Sopenharmony_ci#define RT5651_PWR_CLK12M_PD			(0x0 << 4)
13298c2ecf20Sopenharmony_ci#define RT5651_PWR_CLK12M_PU			(0x1 << 4)
13308c2ecf20Sopenharmony_ci
13318c2ecf20Sopenharmony_ci/* Analog JD Control 1 (0x94) */
13328c2ecf20Sopenharmony_ci#define RT5651_JD2_CMP_MASK			(0x7 << 12)
13338c2ecf20Sopenharmony_ci#define RT5651_JD2_CMP_SFT			12
13348c2ecf20Sopenharmony_ci#define RT5651_JD_PU				(0x1 << 11)
13358c2ecf20Sopenharmony_ci#define RT5651_JD_PU_SFT			11
13368c2ecf20Sopenharmony_ci#define RT5651_JD_PD				(0x1 << 10)
13378c2ecf20Sopenharmony_ci#define RT5651_JD_PD_SFT			10
13388c2ecf20Sopenharmony_ci#define RT5651_JD_MODE_SEL_MASK			(0x3 << 8)
13398c2ecf20Sopenharmony_ci#define RT5651_JD_MODE_SEL_SFT			8
13408c2ecf20Sopenharmony_ci#define RT5651_JD_MODE_SEL_M0			(0x0 << 8)
13418c2ecf20Sopenharmony_ci#define RT5651_JD_MODE_SEL_M1			(0x1 << 8)
13428c2ecf20Sopenharmony_ci#define RT5651_JD_MODE_SEL_M2			(0x2 << 8)
13438c2ecf20Sopenharmony_ci#define RT5651_JD_M_CMP				(0x7 << 4)
13448c2ecf20Sopenharmony_ci#define RT5651_JD_M_CMP_SFT			4
13458c2ecf20Sopenharmony_ci#define RT5651_JD_M_PU				(0x1 << 3)
13468c2ecf20Sopenharmony_ci#define RT5651_JD_M_PU_SFT			3
13478c2ecf20Sopenharmony_ci#define RT5651_JD_M_PD				(0x1 << 2)
13488c2ecf20Sopenharmony_ci#define RT5651_JD_M_PD_SFT			2
13498c2ecf20Sopenharmony_ci#define RT5651_JD_M_MODE_SEL_MASK		(0x3)
13508c2ecf20Sopenharmony_ci#define RT5651_JD_M_MODE_SEL_SFT		0
13518c2ecf20Sopenharmony_ci#define RT5651_JD_M_MODE_SEL_M0			(0x0)
13528c2ecf20Sopenharmony_ci#define RT5651_JD_M_MODE_SEL_M1			(0x1)
13538c2ecf20Sopenharmony_ci#define RT5651_JD_M_MODE_SEL_M2			(0x2)
13548c2ecf20Sopenharmony_ci
13558c2ecf20Sopenharmony_ci/* Analog JD Control 2 (0x95) */
13568c2ecf20Sopenharmony_ci#define RT5651_JD3_CMP_MASK			(0x7 << 12)
13578c2ecf20Sopenharmony_ci#define RT5651_JD3_CMP_SFT			12
13588c2ecf20Sopenharmony_ci
13598c2ecf20Sopenharmony_ci/* EQ Control 1 (0xb0) */
13608c2ecf20Sopenharmony_ci#define RT5651_EQ_SRC_MASK			(0x1 << 15)
13618c2ecf20Sopenharmony_ci#define RT5651_EQ_SRC_SFT			15
13628c2ecf20Sopenharmony_ci#define RT5651_EQ_SRC_DAC			(0x0 << 15)
13638c2ecf20Sopenharmony_ci#define RT5651_EQ_SRC_ADC			(0x1 << 15)
13648c2ecf20Sopenharmony_ci#define RT5651_EQ_UPD				(0x1 << 14)
13658c2ecf20Sopenharmony_ci#define RT5651_EQ_UPD_BIT			14
13668c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_MASK			(0x1 << 13)
13678c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_SFT			13
13688c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_DIS			(0x0 << 13)
13698c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_EN				(0x1 << 13)
13708c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_MASK			(0x3 << 8)
13718c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_SFT			8
13728c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_NOR			(0x0 << 8)
13738c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_LSB			(0x1 << 8)
13748c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_LSB_1			(0x2 << 8)
13758c2ecf20Sopenharmony_ci#define RT5651_EQ_DITH_LSB_2			(0x3 << 8)
13768c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_F				(0x1 << 7)
13778c2ecf20Sopenharmony_ci#define RT5651_EQ_CD_F_BIT			7
13788c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_HP2			(0x1 << 6)
13798c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_HP2_BIT			6
13808c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_HP1			(0x1 << 5)
13818c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_HP1_BIT			5
13828c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP4			(0x1 << 4)
13838c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP4_BIT			4
13848c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP3			(0x1 << 3)
13858c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP3_BIT			3
13868c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP2			(0x1 << 2)
13878c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP2_BIT			2
13888c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP1			(0x1 << 1)
13898c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_BP1_BIT			1
13908c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_LP			(0x1)
13918c2ecf20Sopenharmony_ci#define RT5651_EQ_STA_LP_BIT			0
13928c2ecf20Sopenharmony_ci
13938c2ecf20Sopenharmony_ci/* EQ Control 2 (0xb1) */
13948c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_M_MASK			(0x1 << 8)
13958c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_M_SFT			8
13968c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_M_HI			(0x0 << 8)
13978c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_M_1ST			(0x1 << 8)
13988c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF1_M_MASK			(0x1 << 7)
13998c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF1_M_SFT			7
14008c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF1_M_LO			(0x0 << 7)
14018c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF1_M_1ST			(0x1 << 7)
14028c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF2_MASK			(0x1 << 6)
14038c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF2_SFT			6
14048c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF2_DIS			(0x0 << 6)
14058c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF2_EN			(0x1 << 6)
14068c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_MASK			(0x1 << 5)
14078c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_SFT			5
14088c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_DIS			(0x0 << 5)
14098c2ecf20Sopenharmony_ci#define RT5651_EQ_HPF1_EN			(0x1 << 5)
14108c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF4_MASK			(0x1 << 4)
14118c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF4_SFT			4
14128c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF4_DIS			(0x0 << 4)
14138c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF4_EN			(0x1 << 4)
14148c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF3_MASK			(0x1 << 3)
14158c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF3_SFT			3
14168c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF3_DIS			(0x0 << 3)
14178c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF3_EN			(0x1 << 3)
14188c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF2_MASK			(0x1 << 2)
14198c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF2_SFT			2
14208c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF2_DIS			(0x0 << 2)
14218c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF2_EN			(0x1 << 2)
14228c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF1_MASK			(0x1 << 1)
14238c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF1_SFT			1
14248c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF1_DIS			(0x0 << 1)
14258c2ecf20Sopenharmony_ci#define RT5651_EQ_BPF1_EN			(0x1 << 1)
14268c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF_MASK			(0x1)
14278c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF_SFT			0
14288c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF_DIS			(0x0)
14298c2ecf20Sopenharmony_ci#define RT5651_EQ_LPF_EN			(0x1)
14308c2ecf20Sopenharmony_ci#define RT5651_EQ_CTRL_MASK			(0x7f)
14318c2ecf20Sopenharmony_ci
14328c2ecf20Sopenharmony_ci/* Memory Test (0xb2) */
14338c2ecf20Sopenharmony_ci#define RT5651_MT_MASK				(0x1 << 15)
14348c2ecf20Sopenharmony_ci#define RT5651_MT_SFT				15
14358c2ecf20Sopenharmony_ci#define RT5651_MT_DIS				(0x0 << 15)
14368c2ecf20Sopenharmony_ci#define RT5651_MT_EN				(0x1 << 15)
14378c2ecf20Sopenharmony_ci
14388c2ecf20Sopenharmony_ci/* ALC Control 1 (0xb4) */
14398c2ecf20Sopenharmony_ci#define RT5651_ALC_P_MASK			(0x1 << 15)
14408c2ecf20Sopenharmony_ci#define RT5651_ALC_P_SFT			15
14418c2ecf20Sopenharmony_ci#define RT5651_ALC_P_DAC			(0x0 << 15)
14428c2ecf20Sopenharmony_ci#define RT5651_ALC_P_ADC			(0x1 << 15)
14438c2ecf20Sopenharmony_ci#define RT5651_ALC_MASK				(0x1 << 14)
14448c2ecf20Sopenharmony_ci#define RT5651_ALC_SFT				14
14458c2ecf20Sopenharmony_ci#define RT5651_ALC_DIS				(0x0 << 14)
14468c2ecf20Sopenharmony_ci#define RT5651_ALC_EN				(0x1 << 14)
14478c2ecf20Sopenharmony_ci#define RT5651_ALC_UPD				(0x1 << 13)
14488c2ecf20Sopenharmony_ci#define RT5651_ALC_UPD_BIT			13
14498c2ecf20Sopenharmony_ci#define RT5651_ALC_AR_MASK			(0x1f << 8)
14508c2ecf20Sopenharmony_ci#define RT5651_ALC_AR_SFT			8
14518c2ecf20Sopenharmony_ci#define RT5651_ALC_R_MASK			(0x7 << 5)
14528c2ecf20Sopenharmony_ci#define RT5651_ALC_R_SFT			5
14538c2ecf20Sopenharmony_ci#define RT5651_ALC_R_48K			(0x1 << 5)
14548c2ecf20Sopenharmony_ci#define RT5651_ALC_R_96K			(0x2 << 5)
14558c2ecf20Sopenharmony_ci#define RT5651_ALC_R_192K			(0x3 << 5)
14568c2ecf20Sopenharmony_ci#define RT5651_ALC_R_441K			(0x5 << 5)
14578c2ecf20Sopenharmony_ci#define RT5651_ALC_R_882K			(0x6 << 5)
14588c2ecf20Sopenharmony_ci#define RT5651_ALC_R_1764K			(0x7 << 5)
14598c2ecf20Sopenharmony_ci#define RT5651_ALC_RC_MASK			(0x1f)
14608c2ecf20Sopenharmony_ci#define RT5651_ALC_RC_SFT			0
14618c2ecf20Sopenharmony_ci
14628c2ecf20Sopenharmony_ci/* ALC Control 2 (0xb5) */
14638c2ecf20Sopenharmony_ci#define RT5651_ALC_POB_MASK			(0x3f << 8)
14648c2ecf20Sopenharmony_ci#define RT5651_ALC_POB_SFT			8
14658c2ecf20Sopenharmony_ci#define RT5651_ALC_DRC_MASK			(0x1 << 7)
14668c2ecf20Sopenharmony_ci#define RT5651_ALC_DRC_SFT			7
14678c2ecf20Sopenharmony_ci#define RT5651_ALC_DRC_DIS			(0x0 << 7)
14688c2ecf20Sopenharmony_ci#define RT5651_ALC_DRC_EN			(0x1 << 7)
14698c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_MASK			(0x3 << 5)
14708c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_SFT			5
14718c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_1_1			(0x0 << 5)
14728c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_1_2			(0x1 << 5)
14738c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_1_4			(0x2 << 5)
14748c2ecf20Sopenharmony_ci#define RT5651_ALC_CPR_1_8			(0x3 << 5)
14758c2ecf20Sopenharmony_ci#define RT5651_ALC_PRB_MASK			(0x1f)
14768c2ecf20Sopenharmony_ci#define RT5651_ALC_PRB_SFT			0
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_ci/* ALC Control 3 (0xb6) */
14798c2ecf20Sopenharmony_ci#define RT5651_ALC_NGB_MASK			(0xf << 12)
14808c2ecf20Sopenharmony_ci#define RT5651_ALC_NGB_SFT			12
14818c2ecf20Sopenharmony_ci#define RT5651_ALC_TAR_MASK			(0x1f << 7)
14828c2ecf20Sopenharmony_ci#define RT5651_ALC_TAR_SFT			7
14838c2ecf20Sopenharmony_ci#define RT5651_ALC_NG_MASK			(0x1 << 6)
14848c2ecf20Sopenharmony_ci#define RT5651_ALC_NG_SFT			6
14858c2ecf20Sopenharmony_ci#define RT5651_ALC_NG_DIS			(0x0 << 6)
14868c2ecf20Sopenharmony_ci#define RT5651_ALC_NG_EN			(0x1 << 6)
14878c2ecf20Sopenharmony_ci#define RT5651_ALC_NGH_MASK			(0x1 << 5)
14888c2ecf20Sopenharmony_ci#define RT5651_ALC_NGH_SFT			5
14898c2ecf20Sopenharmony_ci#define RT5651_ALC_NGH_DIS			(0x0 << 5)
14908c2ecf20Sopenharmony_ci#define RT5651_ALC_NGH_EN			(0x1 << 5)
14918c2ecf20Sopenharmony_ci#define RT5651_ALC_NGT_MASK			(0x1f)
14928c2ecf20Sopenharmony_ci#define RT5651_ALC_NGT_SFT			0
14938c2ecf20Sopenharmony_ci
14948c2ecf20Sopenharmony_ci/* Jack Detect Control 1 (0xbb) */
14958c2ecf20Sopenharmony_ci#define RT5651_JD_MASK				(0x7 << 13)
14968c2ecf20Sopenharmony_ci#define RT5651_JD_SFT				13
14978c2ecf20Sopenharmony_ci#define RT5651_JD_DIS				(0x0 << 13)
14988c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO1				(0x1 << 13)
14998c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO2				(0x2 << 13)
15008c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO3				(0x3 << 13)
15018c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO4				(0x4 << 13)
15028c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO5				(0x5 << 13)
15038c2ecf20Sopenharmony_ci#define RT5651_JD_GPIO6				(0x6 << 13)
15048c2ecf20Sopenharmony_ci#define RT5651_JD_HP_MASK			(0x1 << 11)
15058c2ecf20Sopenharmony_ci#define RT5651_JD_HP_SFT			11
15068c2ecf20Sopenharmony_ci#define RT5651_JD_HP_DIS			(0x0 << 11)
15078c2ecf20Sopenharmony_ci#define RT5651_JD_HP_EN				(0x1 << 11)
15088c2ecf20Sopenharmony_ci#define RT5651_JD_HP_TRG_MASK			(0x1 << 10)
15098c2ecf20Sopenharmony_ci#define RT5651_JD_HP_TRG_SFT			10
15108c2ecf20Sopenharmony_ci#define RT5651_JD_HP_TRG_LO			(0x0 << 10)
15118c2ecf20Sopenharmony_ci#define RT5651_JD_HP_TRG_HI			(0x1 << 10)
15128c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_MASK			(0x1 << 9)
15138c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_SFT			9
15148c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_DIS			(0x0 << 9)
15158c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_EN			(0x1 << 9)
15168c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_TRG_MASK			(0x1 << 8)
15178c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_TRG_SFT			8
15188c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_TRG_LO			(0x0 << 8)
15198c2ecf20Sopenharmony_ci#define RT5651_JD_SPL_TRG_HI			(0x1 << 8)
15208c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_MASK			(0x1 << 7)
15218c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_SFT			7
15228c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_DIS			(0x0 << 7)
15238c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_EN			(0x1 << 7)
15248c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_TRG_MASK			(0x1 << 6)
15258c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_TRG_SFT			6
15268c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_TRG_LO			(0x0 << 6)
15278c2ecf20Sopenharmony_ci#define RT5651_JD_SPR_TRG_HI			(0x1 << 6)
15288c2ecf20Sopenharmony_ci#define RT5651_JD_LO_MASK			(0x1 << 3)
15298c2ecf20Sopenharmony_ci#define RT5651_JD_LO_SFT			3
15308c2ecf20Sopenharmony_ci#define RT5651_JD_LO_DIS			(0x0 << 3)
15318c2ecf20Sopenharmony_ci#define RT5651_JD_LO_EN				(0x1 << 3)
15328c2ecf20Sopenharmony_ci#define RT5651_JD_LO_TRG_MASK			(0x1 << 2)
15338c2ecf20Sopenharmony_ci#define RT5651_JD_LO_TRG_SFT			2
15348c2ecf20Sopenharmony_ci#define RT5651_JD_LO_TRG_LO			(0x0 << 2)
15358c2ecf20Sopenharmony_ci#define RT5651_JD_LO_TRG_HI			(0x1 << 2)
15368c2ecf20Sopenharmony_ci
15378c2ecf20Sopenharmony_ci/* Jack Detect Control 2 (0xbc) */
15388c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_MASK			(0x7 << 9)
15398c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_SFT			9
15408c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_GPIO			(0x0 << 9)
15418c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_JD1_1			(0x1 << 9)
15428c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_JD1_2			(0x2 << 9)
15438c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_JD2			(0x3 << 9)
15448c2ecf20Sopenharmony_ci#define RT5651_JD_TRG_SEL_JD3			(0x4 << 9)
15458c2ecf20Sopenharmony_ci#define RT5651_JD3_IRQ_EN			(0x1 << 8)
15468c2ecf20Sopenharmony_ci#define RT5651_JD3_IRQ_EN_SFT			8
15478c2ecf20Sopenharmony_ci#define RT5651_JD3_EN_STKY			(0x1 << 7)
15488c2ecf20Sopenharmony_ci#define RT5651_JD3_EN_STKY_SFT			7
15498c2ecf20Sopenharmony_ci#define RT5651_JD3_INV				(0x1 << 6)
15508c2ecf20Sopenharmony_ci#define RT5651_JD3_INV_SFT			6
15518c2ecf20Sopenharmony_ci
15528c2ecf20Sopenharmony_ci/* IRQ Control 1 (0xbd) */
15538c2ecf20Sopenharmony_ci#define RT5651_IRQ_JD_MASK			(0x1 << 15)
15548c2ecf20Sopenharmony_ci#define RT5651_IRQ_JD_SFT			15
15558c2ecf20Sopenharmony_ci#define RT5651_IRQ_JD_BP			(0x0 << 15)
15568c2ecf20Sopenharmony_ci#define RT5651_IRQ_JD_NOR			(0x1 << 15)
15578c2ecf20Sopenharmony_ci#define RT5651_JD_STKY_MASK			(0x1 << 13)
15588c2ecf20Sopenharmony_ci#define RT5651_JD_STKY_SFT			13
15598c2ecf20Sopenharmony_ci#define RT5651_JD_STKY_DIS			(0x0 << 13)
15608c2ecf20Sopenharmony_ci#define RT5651_JD_STKY_EN			(0x1 << 13)
15618c2ecf20Sopenharmony_ci#define RT5651_JD_P_MASK			(0x1 << 11)
15628c2ecf20Sopenharmony_ci#define RT5651_JD_P_SFT				11
15638c2ecf20Sopenharmony_ci#define RT5651_JD_P_NOR				(0x0 << 11)
15648c2ecf20Sopenharmony_ci#define RT5651_JD_P_INV				(0x1 << 11)
15658c2ecf20Sopenharmony_ci#define RT5651_JD1_1_IRQ_EN			(0x1 << 9)
15668c2ecf20Sopenharmony_ci#define RT5651_JD1_1_IRQ_EN_SFT			9
15678c2ecf20Sopenharmony_ci#define RT5651_JD1_1_EN_STKY			(0x1 << 8)
15688c2ecf20Sopenharmony_ci#define RT5651_JD1_1_EN_STKY_SFT			8
15698c2ecf20Sopenharmony_ci#define RT5651_JD1_1_INV			(0x1 << 7)
15708c2ecf20Sopenharmony_ci#define RT5651_JD1_1_INV_SFT			7
15718c2ecf20Sopenharmony_ci#define RT5651_JD1_2_IRQ_EN			(0x1 << 6)
15728c2ecf20Sopenharmony_ci#define RT5651_JD1_2_IRQ_EN_SFT			6
15738c2ecf20Sopenharmony_ci#define RT5651_JD1_2_EN_STKY			(0x1 << 5)
15748c2ecf20Sopenharmony_ci#define RT5651_JD1_2_EN_STKY_SFT			5
15758c2ecf20Sopenharmony_ci#define RT5651_JD1_2_INV			(0x1 << 4)
15768c2ecf20Sopenharmony_ci#define RT5651_JD1_2_INV_SFT			4
15778c2ecf20Sopenharmony_ci#define RT5651_JD2_IRQ_EN			(0x1 << 3)
15788c2ecf20Sopenharmony_ci#define RT5651_JD2_IRQ_EN_SFT			3
15798c2ecf20Sopenharmony_ci#define RT5651_JD2_EN_STKY			(0x1 << 2)
15808c2ecf20Sopenharmony_ci#define RT5651_JD2_EN_STKY_SFT			2
15818c2ecf20Sopenharmony_ci#define RT5651_JD2_INV				(0x1 << 1)
15828c2ecf20Sopenharmony_ci#define RT5651_JD2_INV_SFT			1
15838c2ecf20Sopenharmony_ci
15848c2ecf20Sopenharmony_ci/* IRQ Control 2 (0xbe) */
15858c2ecf20Sopenharmony_ci#define RT5651_IRQ_MB1_OC_MASK			(0x1 << 15)
15868c2ecf20Sopenharmony_ci#define RT5651_IRQ_MB1_OC_SFT			15
15878c2ecf20Sopenharmony_ci#define RT5651_IRQ_MB1_OC_BP			(0x0 << 15)
15888c2ecf20Sopenharmony_ci#define RT5651_IRQ_MB1_OC_NOR			(0x1 << 15)
15898c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_STKY_MASK			(0x1 << 11)
15908c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_STKY_SFT			11
15918c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_STKY_DIS			(0x0 << 11)
15928c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_STKY_EN			(0x1 << 11)
15938c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_P_MASK			(0x1 << 7)
15948c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_P_SFT			7
15958c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_P_NOR			(0x0 << 7)
15968c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_P_INV			(0x1 << 7)
15978c2ecf20Sopenharmony_ci#define RT5651_MB2_OC_P_MASK			(0x1 << 6)
15988c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_CLR			(0x1 << 3)
15998c2ecf20Sopenharmony_ci#define RT5651_MB1_OC_CLR_SFT			3
16008c2ecf20Sopenharmony_ci#define RT5651_STA_GPIO8			(0x1)
16018c2ecf20Sopenharmony_ci#define RT5651_STA_GPIO8_BIT			0
16028c2ecf20Sopenharmony_ci
16038c2ecf20Sopenharmony_ci/* Internal Status and GPIO status (0xbf) */
16048c2ecf20Sopenharmony_ci#define RT5651_STA_JD3				(0x1 << 15)
16058c2ecf20Sopenharmony_ci#define RT5651_STA_JD3_BIT			15
16068c2ecf20Sopenharmony_ci#define RT5651_STA_JD2				(0x1 << 14)
16078c2ecf20Sopenharmony_ci#define RT5651_STA_JD2_BIT			14
16088c2ecf20Sopenharmony_ci#define RT5651_STA_JD1_2			(0x1 << 13)
16098c2ecf20Sopenharmony_ci#define RT5651_STA_JD1_2_BIT			13
16108c2ecf20Sopenharmony_ci#define RT5651_STA_JD1_1			(0x1 << 12)
16118c2ecf20Sopenharmony_ci#define RT5651_STA_JD1_1_BIT			12
16128c2ecf20Sopenharmony_ci#define RT5651_STA_GP7				(0x1 << 11)
16138c2ecf20Sopenharmony_ci#define RT5651_STA_GP7_BIT			11
16148c2ecf20Sopenharmony_ci#define RT5651_STA_GP6				(0x1 << 10)
16158c2ecf20Sopenharmony_ci#define RT5651_STA_GP6_BIT			10
16168c2ecf20Sopenharmony_ci#define RT5651_STA_GP5				(0x1 << 9)
16178c2ecf20Sopenharmony_ci#define RT5651_STA_GP5_BIT			9
16188c2ecf20Sopenharmony_ci#define RT5651_STA_GP1				(0x1 << 8)
16198c2ecf20Sopenharmony_ci#define RT5651_STA_GP1_BIT			8
16208c2ecf20Sopenharmony_ci#define RT5651_STA_GP2				(0x1 << 7)
16218c2ecf20Sopenharmony_ci#define RT5651_STA_GP2_BIT			7
16228c2ecf20Sopenharmony_ci#define RT5651_STA_GP3				(0x1 << 6)
16238c2ecf20Sopenharmony_ci#define RT5651_STA_GP3_BIT			6
16248c2ecf20Sopenharmony_ci#define RT5651_STA_GP4				(0x1 << 5)
16258c2ecf20Sopenharmony_ci#define RT5651_STA_GP4_BIT			5
16268c2ecf20Sopenharmony_ci#define RT5651_STA_GP_JD			(0x1 << 4)
16278c2ecf20Sopenharmony_ci#define RT5651_STA_GP_JD_BIT			4
16288c2ecf20Sopenharmony_ci
16298c2ecf20Sopenharmony_ci/* GPIO Control 1 (0xc0) */
16308c2ecf20Sopenharmony_ci#define RT5651_GP1_PIN_MASK			(0x1 << 15)
16318c2ecf20Sopenharmony_ci#define RT5651_GP1_PIN_SFT			15
16328c2ecf20Sopenharmony_ci#define RT5651_GP1_PIN_GPIO1			(0x0 << 15)
16338c2ecf20Sopenharmony_ci#define RT5651_GP1_PIN_IRQ			(0x1 << 15)
16348c2ecf20Sopenharmony_ci#define RT5651_GP2_PIN_MASK			(0x1 << 14)
16358c2ecf20Sopenharmony_ci#define RT5651_GP2_PIN_SFT			14
16368c2ecf20Sopenharmony_ci#define RT5651_GP2_PIN_GPIO2			(0x0 << 14)
16378c2ecf20Sopenharmony_ci#define RT5651_GP2_PIN_DMIC1_SCL		(0x1 << 14)
16388c2ecf20Sopenharmony_ci#define RT5651_GPIO_M_MASK			(0x1 << 9)
16398c2ecf20Sopenharmony_ci#define RT5651_GPIO_M_SFT			9
16408c2ecf20Sopenharmony_ci#define RT5651_GPIO_M_FLT			(0x0 << 9)
16418c2ecf20Sopenharmony_ci#define RT5651_GPIO_M_PH			(0x1 << 9)
16428c2ecf20Sopenharmony_ci#define RT5651_I2S2_SEL_MASK			(0x1 << 8)
16438c2ecf20Sopenharmony_ci#define RT5651_I2S2_SEL_SFT			8
16448c2ecf20Sopenharmony_ci#define RT5651_I2S2_SEL_I2S			(0x0 << 8)
16458c2ecf20Sopenharmony_ci#define RT5651_I2S2_SEL_GPIO			(0x1 << 8)
16468c2ecf20Sopenharmony_ci#define RT5651_GP5_PIN_MASK			(0x1 << 7)
16478c2ecf20Sopenharmony_ci#define RT5651_GP5_PIN_SFT			7
16488c2ecf20Sopenharmony_ci#define RT5651_GP5_PIN_GPIO5			(0x0 << 7)
16498c2ecf20Sopenharmony_ci#define RT5651_GP5_PIN_IRQ			(0x1 << 7)
16508c2ecf20Sopenharmony_ci#define RT5651_GP6_PIN_MASK			(0x1 << 6)
16518c2ecf20Sopenharmony_ci#define RT5651_GP6_PIN_SFT			6
16528c2ecf20Sopenharmony_ci#define RT5651_GP6_PIN_GPIO6			(0x0 << 6)
16538c2ecf20Sopenharmony_ci#define RT5651_GP6_PIN_DMIC_SDA			(0x1 << 6)
16548c2ecf20Sopenharmony_ci#define RT5651_GP7_PIN_MASK			(0x1 << 5)
16558c2ecf20Sopenharmony_ci#define RT5651_GP7_PIN_SFT			5
16568c2ecf20Sopenharmony_ci#define RT5651_GP7_PIN_GPIO7			(0x0 << 5)
16578c2ecf20Sopenharmony_ci#define RT5651_GP7_PIN_IRQ			(0x1 << 5)
16588c2ecf20Sopenharmony_ci#define RT5651_GP8_PIN_MASK			(0x1 << 4)
16598c2ecf20Sopenharmony_ci#define RT5651_GP8_PIN_SFT			4
16608c2ecf20Sopenharmony_ci#define RT5651_GP8_PIN_GPIO8			(0x0 << 4)
16618c2ecf20Sopenharmony_ci#define RT5651_GP8_PIN_DMIC_SDA			(0x1 << 4)
16628c2ecf20Sopenharmony_ci#define RT5651_GPIO_PDM_SEL_MASK		(0x1 << 3)
16638c2ecf20Sopenharmony_ci#define RT5651_GPIO_PDM_SEL_SFT			3
16648c2ecf20Sopenharmony_ci#define RT5651_GPIO_PDM_SEL_GPIO		(0x0 << 3)
16658c2ecf20Sopenharmony_ci#define RT5651_GPIO_PDM_SEL_PDM			(0x1 << 3)
16668c2ecf20Sopenharmony_ci
16678c2ecf20Sopenharmony_ci/* GPIO Control 2 (0xc1) */
16688c2ecf20Sopenharmony_ci#define RT5651_GP5_DR_MASK			(0x1 << 14)
16698c2ecf20Sopenharmony_ci#define RT5651_GP5_DR_SFT			14
16708c2ecf20Sopenharmony_ci#define RT5651_GP5_DR_IN			(0x0 << 14)
16718c2ecf20Sopenharmony_ci#define RT5651_GP5_DR_OUT			(0x1 << 14)
16728c2ecf20Sopenharmony_ci#define RT5651_GP5_OUT_MASK			(0x1 << 13)
16738c2ecf20Sopenharmony_ci#define RT5651_GP5_OUT_SFT			13
16748c2ecf20Sopenharmony_ci#define RT5651_GP5_OUT_LO			(0x0 << 13)
16758c2ecf20Sopenharmony_ci#define RT5651_GP5_OUT_HI			(0x1 << 13)
16768c2ecf20Sopenharmony_ci#define RT5651_GP5_P_MASK			(0x1 << 12)
16778c2ecf20Sopenharmony_ci#define RT5651_GP5_P_SFT			12
16788c2ecf20Sopenharmony_ci#define RT5651_GP5_P_NOR			(0x0 << 12)
16798c2ecf20Sopenharmony_ci#define RT5651_GP5_P_INV			(0x1 << 12)
16808c2ecf20Sopenharmony_ci#define RT5651_GP4_DR_MASK			(0x1 << 11)
16818c2ecf20Sopenharmony_ci#define RT5651_GP4_DR_SFT			11
16828c2ecf20Sopenharmony_ci#define RT5651_GP4_DR_IN			(0x0 << 11)
16838c2ecf20Sopenharmony_ci#define RT5651_GP4_DR_OUT			(0x1 << 11)
16848c2ecf20Sopenharmony_ci#define RT5651_GP4_OUT_MASK			(0x1 << 10)
16858c2ecf20Sopenharmony_ci#define RT5651_GP4_OUT_SFT			10
16868c2ecf20Sopenharmony_ci#define RT5651_GP4_OUT_LO			(0x0 << 10)
16878c2ecf20Sopenharmony_ci#define RT5651_GP4_OUT_HI			(0x1 << 10)
16888c2ecf20Sopenharmony_ci#define RT5651_GP4_P_MASK			(0x1 << 9)
16898c2ecf20Sopenharmony_ci#define RT5651_GP4_P_SFT			9
16908c2ecf20Sopenharmony_ci#define RT5651_GP4_P_NOR			(0x0 << 9)
16918c2ecf20Sopenharmony_ci#define RT5651_GP4_P_INV			(0x1 << 9)
16928c2ecf20Sopenharmony_ci#define RT5651_GP3_DR_MASK			(0x1 << 8)
16938c2ecf20Sopenharmony_ci#define RT5651_GP3_DR_SFT			8
16948c2ecf20Sopenharmony_ci#define RT5651_GP3_DR_IN			(0x0 << 8)
16958c2ecf20Sopenharmony_ci#define RT5651_GP3_DR_OUT			(0x1 << 8)
16968c2ecf20Sopenharmony_ci#define RT5651_GP3_OUT_MASK			(0x1 << 7)
16978c2ecf20Sopenharmony_ci#define RT5651_GP3_OUT_SFT			7
16988c2ecf20Sopenharmony_ci#define RT5651_GP3_OUT_LO			(0x0 << 7)
16998c2ecf20Sopenharmony_ci#define RT5651_GP3_OUT_HI			(0x1 << 7)
17008c2ecf20Sopenharmony_ci#define RT5651_GP3_P_MASK			(0x1 << 6)
17018c2ecf20Sopenharmony_ci#define RT5651_GP3_P_SFT			6
17028c2ecf20Sopenharmony_ci#define RT5651_GP3_P_NOR			(0x0 << 6)
17038c2ecf20Sopenharmony_ci#define RT5651_GP3_P_INV			(0x1 << 6)
17048c2ecf20Sopenharmony_ci#define RT5651_GP2_DR_MASK			(0x1 << 5)
17058c2ecf20Sopenharmony_ci#define RT5651_GP2_DR_SFT			5
17068c2ecf20Sopenharmony_ci#define RT5651_GP2_DR_IN			(0x0 << 5)
17078c2ecf20Sopenharmony_ci#define RT5651_GP2_DR_OUT			(0x1 << 5)
17088c2ecf20Sopenharmony_ci#define RT5651_GP2_OUT_MASK			(0x1 << 4)
17098c2ecf20Sopenharmony_ci#define RT5651_GP2_OUT_SFT			4
17108c2ecf20Sopenharmony_ci#define RT5651_GP2_OUT_LO			(0x0 << 4)
17118c2ecf20Sopenharmony_ci#define RT5651_GP2_OUT_HI			(0x1 << 4)
17128c2ecf20Sopenharmony_ci#define RT5651_GP2_P_MASK			(0x1 << 3)
17138c2ecf20Sopenharmony_ci#define RT5651_GP2_P_SFT			3
17148c2ecf20Sopenharmony_ci#define RT5651_GP2_P_NOR			(0x0 << 3)
17158c2ecf20Sopenharmony_ci#define RT5651_GP2_P_INV			(0x1 << 3)
17168c2ecf20Sopenharmony_ci#define RT5651_GP1_DR_MASK			(0x1 << 2)
17178c2ecf20Sopenharmony_ci#define RT5651_GP1_DR_SFT			2
17188c2ecf20Sopenharmony_ci#define RT5651_GP1_DR_IN			(0x0 << 2)
17198c2ecf20Sopenharmony_ci#define RT5651_GP1_DR_OUT			(0x1 << 2)
17208c2ecf20Sopenharmony_ci#define RT5651_GP1_OUT_MASK			(0x1 << 1)
17218c2ecf20Sopenharmony_ci#define RT5651_GP1_OUT_SFT			1
17228c2ecf20Sopenharmony_ci#define RT5651_GP1_OUT_LO			(0x0 << 1)
17238c2ecf20Sopenharmony_ci#define RT5651_GP1_OUT_HI			(0x1 << 1)
17248c2ecf20Sopenharmony_ci#define RT5651_GP1_P_MASK			(0x1)
17258c2ecf20Sopenharmony_ci#define RT5651_GP1_P_SFT			0
17268c2ecf20Sopenharmony_ci#define RT5651_GP1_P_NOR			(0x0)
17278c2ecf20Sopenharmony_ci#define RT5651_GP1_P_INV			(0x1)
17288c2ecf20Sopenharmony_ci
17298c2ecf20Sopenharmony_ci/* GPIO Control 3 (0xc2) */
17308c2ecf20Sopenharmony_ci#define RT5651_GP8_DR_MASK			(0x1 << 8)
17318c2ecf20Sopenharmony_ci#define RT5651_GP8_DR_SFT			8
17328c2ecf20Sopenharmony_ci#define RT5651_GP8_DR_IN			(0x0 << 8)
17338c2ecf20Sopenharmony_ci#define RT5651_GP8_DR_OUT			(0x1 << 8)
17348c2ecf20Sopenharmony_ci#define RT5651_GP8_OUT_MASK			(0x1 << 7)
17358c2ecf20Sopenharmony_ci#define RT5651_GP8_OUT_SFT			7
17368c2ecf20Sopenharmony_ci#define RT5651_GP8_OUT_LO			(0x0 << 7)
17378c2ecf20Sopenharmony_ci#define RT5651_GP8_OUT_HI			(0x1 << 7)
17388c2ecf20Sopenharmony_ci#define RT5651_GP8_P_MASK			(0x1 << 6)
17398c2ecf20Sopenharmony_ci#define RT5651_GP8_P_SFT			6
17408c2ecf20Sopenharmony_ci#define RT5651_GP8_P_NOR			(0x0 << 6)
17418c2ecf20Sopenharmony_ci#define RT5651_GP8_P_INV			(0x1 << 6)
17428c2ecf20Sopenharmony_ci#define RT5651_GP7_DR_MASK			(0x1 << 5)
17438c2ecf20Sopenharmony_ci#define RT5651_GP7_DR_SFT			5
17448c2ecf20Sopenharmony_ci#define RT5651_GP7_DR_IN			(0x0 << 5)
17458c2ecf20Sopenharmony_ci#define RT5651_GP7_DR_OUT			(0x1 << 5)
17468c2ecf20Sopenharmony_ci#define RT5651_GP7_OUT_MASK			(0x1 << 4)
17478c2ecf20Sopenharmony_ci#define RT5651_GP7_OUT_SFT			4
17488c2ecf20Sopenharmony_ci#define RT5651_GP7_OUT_LO			(0x0 << 4)
17498c2ecf20Sopenharmony_ci#define RT5651_GP7_OUT_HI			(0x1 << 4)
17508c2ecf20Sopenharmony_ci#define RT5651_GP7_P_MASK			(0x1 << 3)
17518c2ecf20Sopenharmony_ci#define RT5651_GP7_P_SFT			3
17528c2ecf20Sopenharmony_ci#define RT5651_GP7_P_NOR			(0x0 << 3)
17538c2ecf20Sopenharmony_ci#define RT5651_GP7_P_INV			(0x1 << 3)
17548c2ecf20Sopenharmony_ci#define RT5651_GP6_DR_MASK			(0x1 << 2)
17558c2ecf20Sopenharmony_ci#define RT5651_GP6_DR_SFT			2
17568c2ecf20Sopenharmony_ci#define RT5651_GP6_DR_IN			(0x0 << 2)
17578c2ecf20Sopenharmony_ci#define RT5651_GP6_DR_OUT			(0x1 << 2)
17588c2ecf20Sopenharmony_ci#define RT5651_GP6_OUT_MASK			(0x1 << 1)
17598c2ecf20Sopenharmony_ci#define RT5651_GP6_OUT_SFT			1
17608c2ecf20Sopenharmony_ci#define RT5651_GP6_OUT_LO			(0x0 << 1)
17618c2ecf20Sopenharmony_ci#define RT5651_GP6_OUT_HI			(0x1 << 1)
17628c2ecf20Sopenharmony_ci#define RT5651_GP6_P_MASK			(0x1)
17638c2ecf20Sopenharmony_ci#define RT5651_GP6_P_SFT			0
17648c2ecf20Sopenharmony_ci#define RT5651_GP6_P_NOR			(0x0)
17658c2ecf20Sopenharmony_ci#define RT5651_GP6_P_INV			(0x1)
17668c2ecf20Sopenharmony_ci
17678c2ecf20Sopenharmony_ci/* Scramble Control (0xce) */
17688c2ecf20Sopenharmony_ci#define RT5651_SCB_SWAP_MASK			(0x1 << 15)
17698c2ecf20Sopenharmony_ci#define RT5651_SCB_SWAP_SFT			15
17708c2ecf20Sopenharmony_ci#define RT5651_SCB_SWAP_DIS			(0x0 << 15)
17718c2ecf20Sopenharmony_ci#define RT5651_SCB_SWAP_EN			(0x1 << 15)
17728c2ecf20Sopenharmony_ci#define RT5651_SCB_MASK				(0x1 << 14)
17738c2ecf20Sopenharmony_ci#define RT5651_SCB_SFT				14
17748c2ecf20Sopenharmony_ci#define RT5651_SCB_DIS				(0x0 << 14)
17758c2ecf20Sopenharmony_ci#define RT5651_SCB_EN				(0x1 << 14)
17768c2ecf20Sopenharmony_ci
17778c2ecf20Sopenharmony_ci/* Baseback Control (0xcf) */
17788c2ecf20Sopenharmony_ci#define RT5651_BB_MASK				(0x1 << 15)
17798c2ecf20Sopenharmony_ci#define RT5651_BB_SFT				15
17808c2ecf20Sopenharmony_ci#define RT5651_BB_DIS				(0x0 << 15)
17818c2ecf20Sopenharmony_ci#define RT5651_BB_EN				(0x1 << 15)
17828c2ecf20Sopenharmony_ci#define RT5651_BB_CT_MASK			(0x7 << 12)
17838c2ecf20Sopenharmony_ci#define RT5651_BB_CT_SFT			12
17848c2ecf20Sopenharmony_ci#define RT5651_BB_CT_A				(0x0 << 12)
17858c2ecf20Sopenharmony_ci#define RT5651_BB_CT_B				(0x1 << 12)
17868c2ecf20Sopenharmony_ci#define RT5651_BB_CT_C				(0x2 << 12)
17878c2ecf20Sopenharmony_ci#define RT5651_BB_CT_D				(0x3 << 12)
17888c2ecf20Sopenharmony_ci#define RT5651_M_BB_L_MASK			(0x1 << 9)
17898c2ecf20Sopenharmony_ci#define RT5651_M_BB_L_SFT			9
17908c2ecf20Sopenharmony_ci#define RT5651_M_BB_R_MASK			(0x1 << 8)
17918c2ecf20Sopenharmony_ci#define RT5651_M_BB_R_SFT			8
17928c2ecf20Sopenharmony_ci#define RT5651_M_BB_HPF_L_MASK			(0x1 << 7)
17938c2ecf20Sopenharmony_ci#define RT5651_M_BB_HPF_L_SFT			7
17948c2ecf20Sopenharmony_ci#define RT5651_M_BB_HPF_R_MASK			(0x1 << 6)
17958c2ecf20Sopenharmony_ci#define RT5651_M_BB_HPF_R_SFT			6
17968c2ecf20Sopenharmony_ci#define RT5651_G_BB_BST_MASK			(0x3f)
17978c2ecf20Sopenharmony_ci#define RT5651_G_BB_BST_SFT			0
17988c2ecf20Sopenharmony_ci
17998c2ecf20Sopenharmony_ci/* MP3 Plus Control 1 (0xd0) */
18008c2ecf20Sopenharmony_ci#define RT5651_M_MP3_L_MASK			(0x1 << 15)
18018c2ecf20Sopenharmony_ci#define RT5651_M_MP3_L_SFT			15
18028c2ecf20Sopenharmony_ci#define RT5651_M_MP3_R_MASK			(0x1 << 14)
18038c2ecf20Sopenharmony_ci#define RT5651_M_MP3_R_SFT			14
18048c2ecf20Sopenharmony_ci#define RT5651_M_MP3_MASK			(0x1 << 13)
18058c2ecf20Sopenharmony_ci#define RT5651_M_MP3_SFT			13
18068c2ecf20Sopenharmony_ci#define RT5651_M_MP3_DIS			(0x0 << 13)
18078c2ecf20Sopenharmony_ci#define RT5651_M_MP3_EN				(0x1 << 13)
18088c2ecf20Sopenharmony_ci#define RT5651_EG_MP3_MASK			(0x1f << 8)
18098c2ecf20Sopenharmony_ci#define RT5651_EG_MP3_SFT			8
18108c2ecf20Sopenharmony_ci#define RT5651_MP3_HLP_MASK			(0x1 << 7)
18118c2ecf20Sopenharmony_ci#define RT5651_MP3_HLP_SFT			7
18128c2ecf20Sopenharmony_ci#define RT5651_MP3_HLP_DIS			(0x0 << 7)
18138c2ecf20Sopenharmony_ci#define RT5651_MP3_HLP_EN			(0x1 << 7)
18148c2ecf20Sopenharmony_ci#define RT5651_M_MP3_ORG_L_MASK			(0x1 << 6)
18158c2ecf20Sopenharmony_ci#define RT5651_M_MP3_ORG_L_SFT			6
18168c2ecf20Sopenharmony_ci#define RT5651_M_MP3_ORG_R_MASK			(0x1 << 5)
18178c2ecf20Sopenharmony_ci#define RT5651_M_MP3_ORG_R_SFT			5
18188c2ecf20Sopenharmony_ci
18198c2ecf20Sopenharmony_ci/* MP3 Plus Control 2 (0xd1) */
18208c2ecf20Sopenharmony_ci#define RT5651_MP3_WT_MASK			(0x1 << 13)
18218c2ecf20Sopenharmony_ci#define RT5651_MP3_WT_SFT			13
18228c2ecf20Sopenharmony_ci#define RT5651_MP3_WT_1_4			(0x0 << 13)
18238c2ecf20Sopenharmony_ci#define RT5651_MP3_WT_1_2			(0x1 << 13)
18248c2ecf20Sopenharmony_ci#define RT5651_OG_MP3_MASK			(0x1f << 8)
18258c2ecf20Sopenharmony_ci#define RT5651_OG_MP3_SFT			8
18268c2ecf20Sopenharmony_ci#define RT5651_HG_MP3_MASK			(0x3f)
18278c2ecf20Sopenharmony_ci#define RT5651_HG_MP3_SFT			0
18288c2ecf20Sopenharmony_ci
18298c2ecf20Sopenharmony_ci/* 3D HP Control 1 (0xd2) */
18308c2ecf20Sopenharmony_ci#define RT5651_3D_CF_MASK			(0x1 << 15)
18318c2ecf20Sopenharmony_ci#define RT5651_3D_CF_SFT			15
18328c2ecf20Sopenharmony_ci#define RT5651_3D_CF_DIS			(0x0 << 15)
18338c2ecf20Sopenharmony_ci#define RT5651_3D_CF_EN				(0x1 << 15)
18348c2ecf20Sopenharmony_ci#define RT5651_3D_HP_MASK			(0x1 << 14)
18358c2ecf20Sopenharmony_ci#define RT5651_3D_HP_SFT			14
18368c2ecf20Sopenharmony_ci#define RT5651_3D_HP_DIS			(0x0 << 14)
18378c2ecf20Sopenharmony_ci#define RT5651_3D_HP_EN				(0x1 << 14)
18388c2ecf20Sopenharmony_ci#define RT5651_3D_BT_MASK			(0x1 << 13)
18398c2ecf20Sopenharmony_ci#define RT5651_3D_BT_SFT			13
18408c2ecf20Sopenharmony_ci#define RT5651_3D_BT_DIS			(0x0 << 13)
18418c2ecf20Sopenharmony_ci#define RT5651_3D_BT_EN				(0x1 << 13)
18428c2ecf20Sopenharmony_ci#define RT5651_3D_1F_MIX_MASK			(0x3 << 11)
18438c2ecf20Sopenharmony_ci#define RT5651_3D_1F_MIX_SFT			11
18448c2ecf20Sopenharmony_ci#define RT5651_3D_HP_M_MASK			(0x1 << 10)
18458c2ecf20Sopenharmony_ci#define RT5651_3D_HP_M_SFT			10
18468c2ecf20Sopenharmony_ci#define RT5651_3D_HP_M_SUR			(0x0 << 10)
18478c2ecf20Sopenharmony_ci#define RT5651_3D_HP_M_FRO			(0x1 << 10)
18488c2ecf20Sopenharmony_ci#define RT5651_M_3D_HRTF_MASK			(0x1 << 9)
18498c2ecf20Sopenharmony_ci#define RT5651_M_3D_HRTF_SFT			9
18508c2ecf20Sopenharmony_ci#define RT5651_M_3D_D2H_MASK			(0x1 << 8)
18518c2ecf20Sopenharmony_ci#define RT5651_M_3D_D2H_SFT			8
18528c2ecf20Sopenharmony_ci#define RT5651_M_3D_D2R_MASK			(0x1 << 7)
18538c2ecf20Sopenharmony_ci#define RT5651_M_3D_D2R_SFT			7
18548c2ecf20Sopenharmony_ci#define RT5651_M_3D_REVB_MASK			(0x1 << 6)
18558c2ecf20Sopenharmony_ci#define RT5651_M_3D_REVB_SFT			6
18568c2ecf20Sopenharmony_ci
18578c2ecf20Sopenharmony_ci/* Adjustable high pass filter control 1 (0xd3) */
18588c2ecf20Sopenharmony_ci#define RT5651_2ND_HPF_MASK			(0x1 << 15)
18598c2ecf20Sopenharmony_ci#define RT5651_2ND_HPF_SFT			15
18608c2ecf20Sopenharmony_ci#define RT5651_2ND_HPF_DIS			(0x0 << 15)
18618c2ecf20Sopenharmony_ci#define RT5651_2ND_HPF_EN			(0x1 << 15)
18628c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_L_MASK			(0x7 << 12)
18638c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_L_SFT			12
18648c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_R_MASK			(0x7 << 8)
18658c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_R_SFT			8
18668c2ecf20Sopenharmony_ci#define RT5651_ZD_T_MASK			(0x3 << 6)
18678c2ecf20Sopenharmony_ci#define RT5651_ZD_T_SFT				6
18688c2ecf20Sopenharmony_ci#define RT5651_ZD_F_MASK			(0x3 << 4)
18698c2ecf20Sopenharmony_ci#define RT5651_ZD_F_SFT				4
18708c2ecf20Sopenharmony_ci#define RT5651_ZD_F_IM				(0x0 << 4)
18718c2ecf20Sopenharmony_ci#define RT5651_ZD_F_ZC_IM			(0x1 << 4)
18728c2ecf20Sopenharmony_ci#define RT5651_ZD_F_ZC_IOD			(0x2 << 4)
18738c2ecf20Sopenharmony_ci#define RT5651_ZD_F_UN				(0x3 << 4)
18748c2ecf20Sopenharmony_ci
18758c2ecf20Sopenharmony_ci/* Adjustable high pass filter control 2 (0xd4) */
18768c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_L_NUM_MASK		(0x3f << 8)
18778c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_L_NUM_SFT			8
18788c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_R_NUM_MASK		(0x3f)
18798c2ecf20Sopenharmony_ci#define RT5651_HPF_CF_R_NUM_SFT			0
18808c2ecf20Sopenharmony_ci
18818c2ecf20Sopenharmony_ci/* HP calibration control and Amp detection (0xd6) */
18828c2ecf20Sopenharmony_ci#define RT5651_SI_DAC_MASK			(0x1 << 11)
18838c2ecf20Sopenharmony_ci#define RT5651_SI_DAC_SFT			11
18848c2ecf20Sopenharmony_ci#define RT5651_SI_DAC_AUTO			(0x0 << 11)
18858c2ecf20Sopenharmony_ci#define RT5651_SI_DAC_TEST			(0x1 << 11)
18868c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_M_MASK			(0x1 << 10)
18878c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_M_SFT			10
18888c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_M_NOR			(0x0 << 10)
18898c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_M_CAL			(0x1 << 10)
18908c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_MASK			(0x1 << 9)
18918c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_SFT			9
18928c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_DIS			(0x0 << 9)
18938c2ecf20Sopenharmony_ci#define RT5651_DC_CAL_EN			(0x1 << 9)
18948c2ecf20Sopenharmony_ci#define RT5651_HPD_RCV_MASK			(0x7 << 6)
18958c2ecf20Sopenharmony_ci#define RT5651_HPD_RCV_SFT			6
18968c2ecf20Sopenharmony_ci#define RT5651_HPD_PS_MASK			(0x1 << 5)
18978c2ecf20Sopenharmony_ci#define RT5651_HPD_PS_SFT			5
18988c2ecf20Sopenharmony_ci#define RT5651_HPD_PS_DIS			(0x0 << 5)
18998c2ecf20Sopenharmony_ci#define RT5651_HPD_PS_EN			(0x1 << 5)
19008c2ecf20Sopenharmony_ci#define RT5651_CAL_M_MASK			(0x1 << 4)
19018c2ecf20Sopenharmony_ci#define RT5651_CAL_M_SFT			4
19028c2ecf20Sopenharmony_ci#define RT5651_CAL_M_DEP			(0x0 << 4)
19038c2ecf20Sopenharmony_ci#define RT5651_CAL_M_CAL			(0x1 << 4)
19048c2ecf20Sopenharmony_ci#define RT5651_CAL_MASK				(0x1 << 3)
19058c2ecf20Sopenharmony_ci#define RT5651_CAL_SFT				3
19068c2ecf20Sopenharmony_ci#define RT5651_CAL_DIS				(0x0 << 3)
19078c2ecf20Sopenharmony_ci#define RT5651_CAL_EN				(0x1 << 3)
19088c2ecf20Sopenharmony_ci#define RT5651_CAL_TEST_MASK			(0x1 << 2)
19098c2ecf20Sopenharmony_ci#define RT5651_CAL_TEST_SFT			2
19108c2ecf20Sopenharmony_ci#define RT5651_CAL_TEST_DIS			(0x0 << 2)
19118c2ecf20Sopenharmony_ci#define RT5651_CAL_TEST_EN			(0x1 << 2)
19128c2ecf20Sopenharmony_ci#define RT5651_CAL_P_MASK			(0x3)
19138c2ecf20Sopenharmony_ci#define RT5651_CAL_P_SFT			0
19148c2ecf20Sopenharmony_ci#define RT5651_CAL_P_NONE			(0x0)
19158c2ecf20Sopenharmony_ci#define RT5651_CAL_P_CAL			(0x1)
19168c2ecf20Sopenharmony_ci#define RT5651_CAL_P_DAC_CAL			(0x2)
19178c2ecf20Sopenharmony_ci
19188c2ecf20Sopenharmony_ci/* Soft volume and zero cross control 1 (0xd9) */
19198c2ecf20Sopenharmony_ci#define RT5651_SV_MASK				(0x1 << 15)
19208c2ecf20Sopenharmony_ci#define RT5651_SV_SFT				15
19218c2ecf20Sopenharmony_ci#define RT5651_SV_DIS				(0x0 << 15)
19228c2ecf20Sopenharmony_ci#define RT5651_SV_EN				(0x1 << 15)
19238c2ecf20Sopenharmony_ci#define RT5651_OUT_SV_MASK			(0x1 << 13)
19248c2ecf20Sopenharmony_ci#define RT5651_OUT_SV_SFT			13
19258c2ecf20Sopenharmony_ci#define RT5651_OUT_SV_DIS			(0x0 << 13)
19268c2ecf20Sopenharmony_ci#define RT5651_OUT_SV_EN			(0x1 << 13)
19278c2ecf20Sopenharmony_ci#define RT5651_HP_SV_MASK			(0x1 << 12)
19288c2ecf20Sopenharmony_ci#define RT5651_HP_SV_SFT			12
19298c2ecf20Sopenharmony_ci#define RT5651_HP_SV_DIS			(0x0 << 12)
19308c2ecf20Sopenharmony_ci#define RT5651_HP_SV_EN				(0x1 << 12)
19318c2ecf20Sopenharmony_ci#define RT5651_ZCD_DIG_MASK			(0x1 << 11)
19328c2ecf20Sopenharmony_ci#define RT5651_ZCD_DIG_SFT			11
19338c2ecf20Sopenharmony_ci#define RT5651_ZCD_DIG_DIS			(0x0 << 11)
19348c2ecf20Sopenharmony_ci#define RT5651_ZCD_DIG_EN			(0x1 << 11)
19358c2ecf20Sopenharmony_ci#define RT5651_ZCD_MASK				(0x1 << 10)
19368c2ecf20Sopenharmony_ci#define RT5651_ZCD_SFT				10
19378c2ecf20Sopenharmony_ci#define RT5651_ZCD_PD				(0x0 << 10)
19388c2ecf20Sopenharmony_ci#define RT5651_ZCD_PU				(0x1 << 10)
19398c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_MASK			(0x3f << 4)
19408c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_SFT			4
19418c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_OM_L			(0x1 << 7)
19428c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_OM_R			(0x1 << 6)
19438c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_RM_L			(0x1 << 5)
19448c2ecf20Sopenharmony_ci#define RT5651_M_ZCD_RM_R			(0x1 << 4)
19458c2ecf20Sopenharmony_ci#define RT5651_SV_DLY_MASK			(0xf)
19468c2ecf20Sopenharmony_ci#define RT5651_SV_DLY_SFT			0
19478c2ecf20Sopenharmony_ci
19488c2ecf20Sopenharmony_ci/* Soft volume and zero cross control 2 (0xda) */
19498c2ecf20Sopenharmony_ci#define RT5651_ZCD_HP_MASK			(0x1 << 15)
19508c2ecf20Sopenharmony_ci#define RT5651_ZCD_HP_SFT			15
19518c2ecf20Sopenharmony_ci#define RT5651_ZCD_HP_DIS			(0x0 << 15)
19528c2ecf20Sopenharmony_ci#define RT5651_ZCD_HP_EN			(0x1 << 15)
19538c2ecf20Sopenharmony_ci
19548c2ecf20Sopenharmony_ci/* Digital Misc Control (0xfa) */
19558c2ecf20Sopenharmony_ci#define RT5651_I2S2_MS_SP_MASK			(0x1 << 8)
19568c2ecf20Sopenharmony_ci#define RT5651_I2S2_MS_SP_SEL			8
19578c2ecf20Sopenharmony_ci#define RT5651_I2S2_MS_SP_64			(0x0 << 8)
19588c2ecf20Sopenharmony_ci#define RT5651_I2S2_MS_SP_50			(0x1 << 8)
19598c2ecf20Sopenharmony_ci#define RT5651_CLK_DET_EN			(0x1 << 3)
19608c2ecf20Sopenharmony_ci#define RT5651_CLK_DET_EN_SFT			3
19618c2ecf20Sopenharmony_ci#define RT5651_AMP_DET_EN			(0x1 << 1)
19628c2ecf20Sopenharmony_ci#define RT5651_AMP_DET_EN_SFT			1
19638c2ecf20Sopenharmony_ci#define RT5651_D_GATE_EN			(0x1)
19648c2ecf20Sopenharmony_ci#define RT5651_D_GATE_EN_SFT			0
19658c2ecf20Sopenharmony_ci
19668c2ecf20Sopenharmony_ci/* Codec Private Register definition */
19678c2ecf20Sopenharmony_ci
19688c2ecf20Sopenharmony_ci/* MIC Over current threshold scale factor (0x15) */
19698c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_MASK			(0x3 << 8)
19708c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_SFT			8
19718c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_0P5			(0x0 << 8)
19728c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_0P75			(0x1 << 8)
19738c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_1P0			(0x2 << 8)
19748c2ecf20Sopenharmony_ci#define RT5651_MIC_OVCD_SF_1P5			(0x3 << 8)
19758c2ecf20Sopenharmony_ci
19768c2ecf20Sopenharmony_ci/* 3D Speaker Control (0x63) */
19778c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_MASK			(0x1 << 15)
19788c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_SFT			15
19798c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_DIS			(0x0 << 15)
19808c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_EN			(0x1 << 15)
19818c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_M_MASK			(0x3 << 13)
19828c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_M_SFT			13
19838c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_CG_MASK			(0x1f << 8)
19848c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_CG_SFT			8
19858c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_SG_MASK			(0x1f)
19868c2ecf20Sopenharmony_ci#define RT5651_3D_SPK_SG_SFT			0
19878c2ecf20Sopenharmony_ci
19888c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 1 (0x6c) */
19898c2ecf20Sopenharmony_ci#define RT5651_WND_MASK				(0x1 << 15)
19908c2ecf20Sopenharmony_ci#define RT5651_WND_SFT				15
19918c2ecf20Sopenharmony_ci#define RT5651_WND_DIS				(0x0 << 15)
19928c2ecf20Sopenharmony_ci#define RT5651_WND_EN				(0x1 << 15)
19938c2ecf20Sopenharmony_ci
19948c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 2 (0x6d) */
19958c2ecf20Sopenharmony_ci#define RT5651_WND_FC_NW_MASK			(0x3f << 10)
19968c2ecf20Sopenharmony_ci#define RT5651_WND_FC_NW_SFT			10
19978c2ecf20Sopenharmony_ci#define RT5651_WND_FC_WK_MASK			(0x3f << 4)
19988c2ecf20Sopenharmony_ci#define RT5651_WND_FC_WK_SFT			4
19998c2ecf20Sopenharmony_ci
20008c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 3 (0x6e) */
20018c2ecf20Sopenharmony_ci#define RT5651_HPF_FC_MASK			(0x3f << 6)
20028c2ecf20Sopenharmony_ci#define RT5651_HPF_FC_SFT			6
20038c2ecf20Sopenharmony_ci#define RT5651_WND_FC_ST_MASK			(0x3f)
20048c2ecf20Sopenharmony_ci#define RT5651_WND_FC_ST_SFT			0
20058c2ecf20Sopenharmony_ci
20068c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 4 (0x6f) */
20078c2ecf20Sopenharmony_ci#define RT5651_WND_TH_LO_MASK			(0x3ff)
20088c2ecf20Sopenharmony_ci#define RT5651_WND_TH_LO_SFT			0
20098c2ecf20Sopenharmony_ci
20108c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 5 (0x70) */
20118c2ecf20Sopenharmony_ci#define RT5651_WND_TH_HI_MASK			(0x3ff)
20128c2ecf20Sopenharmony_ci#define RT5651_WND_TH_HI_SFT			0
20138c2ecf20Sopenharmony_ci
20148c2ecf20Sopenharmony_ci/* Wind Noise Detection Control 8 (0x73) */
20158c2ecf20Sopenharmony_ci#define RT5651_WND_WIND_MASK			(0x1 << 13) /* Read-Only */
20168c2ecf20Sopenharmony_ci#define RT5651_WND_WIND_SFT			13
20178c2ecf20Sopenharmony_ci#define RT5651_WND_STRONG_MASK			(0x1 << 12) /* Read-Only */
20188c2ecf20Sopenharmony_ci#define RT5651_WND_STRONG_SFT			12
20198c2ecf20Sopenharmony_cienum {
20208c2ecf20Sopenharmony_ci	RT5651_NO_WIND,
20218c2ecf20Sopenharmony_ci	RT5651_BREEZE,
20228c2ecf20Sopenharmony_ci	RT5651_STORM,
20238c2ecf20Sopenharmony_ci};
20248c2ecf20Sopenharmony_ci
20258c2ecf20Sopenharmony_ci/* Dipole Speaker Interface (0x75) */
20268c2ecf20Sopenharmony_ci#define RT5651_DP_ATT_MASK			(0x3 << 14)
20278c2ecf20Sopenharmony_ci#define RT5651_DP_ATT_SFT			14
20288c2ecf20Sopenharmony_ci#define RT5651_DP_SPK_MASK			(0x1 << 10)
20298c2ecf20Sopenharmony_ci#define RT5651_DP_SPK_SFT			10
20308c2ecf20Sopenharmony_ci#define RT5651_DP_SPK_DIS			(0x0 << 10)
20318c2ecf20Sopenharmony_ci#define RT5651_DP_SPK_EN			(0x1 << 10)
20328c2ecf20Sopenharmony_ci
20338c2ecf20Sopenharmony_ci/* EQ Pre Volume Control (0xb3) */
20348c2ecf20Sopenharmony_ci#define RT5651_EQ_PRE_VOL_MASK			(0xffff)
20358c2ecf20Sopenharmony_ci#define RT5651_EQ_PRE_VOL_SFT			0
20368c2ecf20Sopenharmony_ci
20378c2ecf20Sopenharmony_ci/* EQ Post Volume Control (0xb4) */
20388c2ecf20Sopenharmony_ci#define RT5651_EQ_PST_VOL_MASK			(0xffff)
20398c2ecf20Sopenharmony_ci#define RT5651_EQ_PST_VOL_SFT			0
20408c2ecf20Sopenharmony_ci
20418c2ecf20Sopenharmony_ci/* System Clock Source */
20428c2ecf20Sopenharmony_cienum {
20438c2ecf20Sopenharmony_ci	RT5651_SCLK_S_MCLK,
20448c2ecf20Sopenharmony_ci	RT5651_SCLK_S_PLL1,
20458c2ecf20Sopenharmony_ci	RT5651_SCLK_S_RCCLK,
20468c2ecf20Sopenharmony_ci};
20478c2ecf20Sopenharmony_ci
20488c2ecf20Sopenharmony_ci/* PLL1 Source */
20498c2ecf20Sopenharmony_cienum {
20508c2ecf20Sopenharmony_ci	RT5651_PLL1_S_MCLK,
20518c2ecf20Sopenharmony_ci	RT5651_PLL1_S_BCLK1,
20528c2ecf20Sopenharmony_ci	RT5651_PLL1_S_BCLK2,
20538c2ecf20Sopenharmony_ci};
20548c2ecf20Sopenharmony_ci
20558c2ecf20Sopenharmony_cienum {
20568c2ecf20Sopenharmony_ci	RT5651_AIF1,
20578c2ecf20Sopenharmony_ci	RT5651_AIF2,
20588c2ecf20Sopenharmony_ci	RT5651_AIFS,
20598c2ecf20Sopenharmony_ci};
20608c2ecf20Sopenharmony_ci
20618c2ecf20Sopenharmony_cistruct rt5651_pll_code {
20628c2ecf20Sopenharmony_ci	bool m_bp; /* Indicates bypass m code or not. */
20638c2ecf20Sopenharmony_ci	int m_code;
20648c2ecf20Sopenharmony_ci	int n_code;
20658c2ecf20Sopenharmony_ci	int k_code;
20668c2ecf20Sopenharmony_ci};
20678c2ecf20Sopenharmony_ci
20688c2ecf20Sopenharmony_cistruct rt5651_priv {
20698c2ecf20Sopenharmony_ci	struct snd_soc_component *component;
20708c2ecf20Sopenharmony_ci	struct regmap *regmap;
20718c2ecf20Sopenharmony_ci	/* Jack and button detect data */
20728c2ecf20Sopenharmony_ci	struct snd_soc_jack *hp_jack;
20738c2ecf20Sopenharmony_ci	struct gpio_desc *gpiod_hp_det;
20748c2ecf20Sopenharmony_ci	struct work_struct jack_detect_work;
20758c2ecf20Sopenharmony_ci	struct delayed_work bp_work;
20768c2ecf20Sopenharmony_ci	bool ovcd_irq_enabled;
20778c2ecf20Sopenharmony_ci	bool pressed;
20788c2ecf20Sopenharmony_ci	bool press_reported;
20798c2ecf20Sopenharmony_ci	int press_count;
20808c2ecf20Sopenharmony_ci	int release_count;
20818c2ecf20Sopenharmony_ci	int poll_count;
20828c2ecf20Sopenharmony_ci	unsigned int jd_src;
20838c2ecf20Sopenharmony_ci	bool jd_active_high;
20848c2ecf20Sopenharmony_ci	unsigned int ovcd_th;
20858c2ecf20Sopenharmony_ci	unsigned int ovcd_sf;
20868c2ecf20Sopenharmony_ci
20878c2ecf20Sopenharmony_ci	int irq;
20888c2ecf20Sopenharmony_ci	int sysclk;
20898c2ecf20Sopenharmony_ci	int sysclk_src;
20908c2ecf20Sopenharmony_ci	int lrck[RT5651_AIFS];
20918c2ecf20Sopenharmony_ci	int bclk[RT5651_AIFS];
20928c2ecf20Sopenharmony_ci	int master[RT5651_AIFS];
20938c2ecf20Sopenharmony_ci
20948c2ecf20Sopenharmony_ci	int pll_src;
20958c2ecf20Sopenharmony_ci	int pll_in;
20968c2ecf20Sopenharmony_ci	int pll_out;
20978c2ecf20Sopenharmony_ci
20988c2ecf20Sopenharmony_ci	int dmic_en;
20998c2ecf20Sopenharmony_ci	bool hp_mute;
21008c2ecf20Sopenharmony_ci};
21018c2ecf20Sopenharmony_ci
21028c2ecf20Sopenharmony_ci#endif /* __RT5651_H__ */
2103