162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * rt5682s.h  --  RT5682I-VS ALSA SoC audio driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2021 Realtek Microelectronics
662306a36Sopenharmony_ci * Author: Derek Fang <derek.fang@realtek.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __RT5682S_H__
1062306a36Sopenharmony_ci#define __RT5682S_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <sound/rt5682s.h>
1362306a36Sopenharmony_ci#include <linux/regulator/consumer.h>
1462306a36Sopenharmony_ci#include <linux/gpio/consumer.h>
1562306a36Sopenharmony_ci#include <linux/clk.h>
1662306a36Sopenharmony_ci#include <linux/clkdev.h>
1762306a36Sopenharmony_ci#include <linux/clk-provider.h>
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci/* Info */
2162306a36Sopenharmony_ci#define RT5682S_RESET				0x0000
2262306a36Sopenharmony_ci#define RT5682S_VERSION_ID			0x00fd
2362306a36Sopenharmony_ci#define RT5682S_VENDOR_ID			0x00fe
2462306a36Sopenharmony_ci#define RT5682S_DEVICE_ID			0x00ff
2562306a36Sopenharmony_ci/*  I/O - Output */
2662306a36Sopenharmony_ci#define RT5682S_HP_CTRL_1			0x0002
2762306a36Sopenharmony_ci#define RT5682S_HP_CTRL_2			0x0003
2862306a36Sopenharmony_ci#define RT5682S_HPL_GAIN			0x0005
2962306a36Sopenharmony_ci#define RT5682S_HPR_GAIN			0x0006
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci#define RT5682S_I2C_CTRL			0x0008
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci/* I/O - Input */
3462306a36Sopenharmony_ci#define RT5682S_CBJ_BST_CTRL			0x000b
3562306a36Sopenharmony_ci#define RT5682S_CBJ_DET_CTRL			0x000f
3662306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_1			0x0010
3762306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_2			0x0011
3862306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_3			0x0012
3962306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_4			0x0013
4062306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_5			0x0014
4162306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_6			0x0015
4262306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_7			0x0016
4362306a36Sopenharmony_ci#define RT5682S_CBJ_CTRL_8			0x0017
4462306a36Sopenharmony_ci/* I/O - ADC/DAC/DMIC */
4562306a36Sopenharmony_ci#define RT5682S_DAC1_DIG_VOL			0x0019
4662306a36Sopenharmony_ci#define RT5682S_STO1_ADC_DIG_VOL		0x001c
4762306a36Sopenharmony_ci#define RT5682S_STO1_ADC_BOOST			0x001f
4862306a36Sopenharmony_ci#define RT5682S_HP_IMP_GAIN_1			0x0022
4962306a36Sopenharmony_ci#define RT5682S_HP_IMP_GAIN_2			0x0023
5062306a36Sopenharmony_ci/* Mixer - D-D */
5162306a36Sopenharmony_ci#define RT5682S_SIDETONE_CTRL			0x0024
5262306a36Sopenharmony_ci#define RT5682S_STO1_ADC_MIXER			0x0026
5362306a36Sopenharmony_ci#define RT5682S_AD_DA_MIXER			0x0029
5462306a36Sopenharmony_ci#define RT5682S_STO1_DAC_MIXER			0x002a
5562306a36Sopenharmony_ci#define RT5682S_A_DAC1_MUX			0x002b
5662306a36Sopenharmony_ci#define RT5682S_DIG_INF2_DATA			0x0030
5762306a36Sopenharmony_ci/* Mixer - ADC */
5862306a36Sopenharmony_ci#define RT5682S_REC_MIXER			0x003c
5962306a36Sopenharmony_ci#define RT5682S_CAL_REC				0x0044
6062306a36Sopenharmony_ci/* HP Analog Offset Control */
6162306a36Sopenharmony_ci#define RT5682S_HP_ANA_OST_CTRL_1		0x004b
6262306a36Sopenharmony_ci#define RT5682S_HP_ANA_OST_CTRL_2		0x004c
6362306a36Sopenharmony_ci#define RT5682S_HP_ANA_OST_CTRL_3		0x004d
6462306a36Sopenharmony_ci/* Power */
6562306a36Sopenharmony_ci#define RT5682S_PWR_DIG_1			0x0061
6662306a36Sopenharmony_ci#define RT5682S_PWR_DIG_2			0x0062
6762306a36Sopenharmony_ci#define RT5682S_PWR_ANLG_1			0x0063
6862306a36Sopenharmony_ci#define RT5682S_PWR_ANLG_2			0x0064
6962306a36Sopenharmony_ci#define RT5682S_PWR_ANLG_3			0x0065
7062306a36Sopenharmony_ci#define RT5682S_PWR_MIXER			0x0066
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci#define RT5682S_MB_CTRL				0x0067
7362306a36Sopenharmony_ci#define RT5682S_CLK_GATE_TCON_1			0x0068
7462306a36Sopenharmony_ci#define RT5682S_CLK_GATE_TCON_2			0x0069
7562306a36Sopenharmony_ci#define RT5682S_CLK_GATE_TCON_3			0x006a
7662306a36Sopenharmony_ci/* Clock Detect */
7762306a36Sopenharmony_ci#define RT5682S_CLK_DET				0x006b
7862306a36Sopenharmony_ci/* Filter Auto Reset */
7962306a36Sopenharmony_ci#define RT5682S_RESET_LPF_CTRL			0x006c
8062306a36Sopenharmony_ci#define RT5682S_RESET_HPF_CTRL			0x006d
8162306a36Sopenharmony_ci/* DMIC */
8262306a36Sopenharmony_ci#define RT5682S_DMIC_CTRL_1			0x006e
8362306a36Sopenharmony_ci#define RT5682S_LPF_AD_DMIC			0x006f
8462306a36Sopenharmony_ci/* Format - ADC/DAC */
8562306a36Sopenharmony_ci#define RT5682S_I2S1_SDP			0x0070
8662306a36Sopenharmony_ci#define RT5682S_I2S2_SDP			0x0071
8762306a36Sopenharmony_ci#define RT5682S_ADDA_CLK_1			0x0073
8862306a36Sopenharmony_ci#define RT5682S_ADDA_CLK_2			0x0074
8962306a36Sopenharmony_ci#define RT5682S_I2S1_F_DIV_CTRL_1		0x0075
9062306a36Sopenharmony_ci#define RT5682S_I2S1_F_DIV_CTRL_2		0x0076
9162306a36Sopenharmony_ci/* Format - TDM Control */
9262306a36Sopenharmony_ci#define RT5682S_TDM_CTRL			0x0079
9362306a36Sopenharmony_ci#define RT5682S_TDM_ADDA_CTRL_1			0x007a
9462306a36Sopenharmony_ci#define RT5682S_TDM_ADDA_CTRL_2			0x007b
9562306a36Sopenharmony_ci#define RT5682S_DATA_SEL_CTRL_1			0x007c
9662306a36Sopenharmony_ci#define RT5682S_TDM_TCON_CTRL_1			0x007e
9762306a36Sopenharmony_ci#define RT5682S_TDM_TCON_CTRL_2			0x007f
9862306a36Sopenharmony_ci/* Function - Analog */
9962306a36Sopenharmony_ci#define RT5682S_GLB_CLK				0x0080
10062306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_1			0x0083
10162306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_2			0x0084
10262306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_3			0x0085
10362306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_4			0x0086
10462306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_5			0x0087
10562306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_6			0x0088
10662306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_11			0x008c
10762306a36Sopenharmony_ci#define RT5682S_DEPOP_1				0x008e
10862306a36Sopenharmony_ci#define RT5682S_HP_CHARGE_PUMP_1		0x008f
10962306a36Sopenharmony_ci#define RT5682S_HP_CHARGE_PUMP_2		0x0091
11062306a36Sopenharmony_ci#define RT5682S_HP_CHARGE_PUMP_3		0x0092
11162306a36Sopenharmony_ci#define RT5682S_MICBIAS_1			0x0093
11262306a36Sopenharmony_ci#define RT5682S_MICBIAS_2			0x0094
11362306a36Sopenharmony_ci#define RT5682S_MICBIAS_3			0x0095
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_12			0x0096
11662306a36Sopenharmony_ci#define RT5682S_PLL_TRACK_14			0x0097
11762306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_1			0x0098
11862306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_2			0x0099
11962306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_3			0x009a
12062306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_4			0x009b
12162306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_5			0x009c
12262306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_6			0x009d
12362306a36Sopenharmony_ci#define RT5682S_PLL_CTRL_7			0x009e
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ci#define RT5682S_RC_CLK_CTRL			0x009f
12662306a36Sopenharmony_ci#define RT5682S_I2S2_M_CLK_CTRL_1		0x00a0
12762306a36Sopenharmony_ci#define RT5682S_I2S2_F_DIV_CTRL_1		0x00a3
12862306a36Sopenharmony_ci#define RT5682S_I2S2_F_DIV_CTRL_2		0x00a4
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#define RT5682S_IRQ_CTRL_1			0x00b6
13162306a36Sopenharmony_ci#define RT5682S_IRQ_CTRL_2			0x00b7
13262306a36Sopenharmony_ci#define RT5682S_IRQ_CTRL_3			0x00b8
13362306a36Sopenharmony_ci#define RT5682S_IRQ_CTRL_4			0x00b9
13462306a36Sopenharmony_ci#define RT5682S_INT_ST_1			0x00be
13562306a36Sopenharmony_ci#define RT5682S_GPIO_CTRL_1			0x00c0
13662306a36Sopenharmony_ci#define RT5682S_GPIO_CTRL_2			0x00c1
13762306a36Sopenharmony_ci#define RT5682S_GPIO_ST				0x00c2
13862306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET_CTRL_1		0x00d0
13962306a36Sopenharmony_ci#define RT5682S_MID_HP_AMP_DET			0x00d2
14062306a36Sopenharmony_ci#define RT5682S_LOW_HP_AMP_DET			0x00d3
14162306a36Sopenharmony_ci#define RT5682S_DELAY_BUF_CTRL			0x00d4
14262306a36Sopenharmony_ci#define RT5682S_SV_ZCD_1			0x00d9
14362306a36Sopenharmony_ci#define RT5682S_SV_ZCD_2			0x00da
14462306a36Sopenharmony_ci#define RT5682S_IL_CMD_1			0x00db
14562306a36Sopenharmony_ci#define RT5682S_IL_CMD_2			0x00dc
14662306a36Sopenharmony_ci#define RT5682S_IL_CMD_3			0x00dd
14762306a36Sopenharmony_ci#define RT5682S_IL_CMD_4			0x00de
14862306a36Sopenharmony_ci#define RT5682S_IL_CMD_5			0x00df
14962306a36Sopenharmony_ci#define RT5682S_IL_CMD_6			0x00e0
15062306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_1			0x00e2
15162306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_2			0x00e3
15262306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_3			0x00e4
15362306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_4			0x00e5
15462306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_5			0x00e6
15562306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_6			0x00e7
15662306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CMD_7			0x00e8
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_ci#define RT5682S_ADC_STO1_HP_CTRL_1		0x00ea
15962306a36Sopenharmony_ci#define RT5682S_ADC_STO1_HP_CTRL_2		0x00eb
16062306a36Sopenharmony_ci#define RT5682S_AJD1_CTRL			0x00f0
16162306a36Sopenharmony_ci#define RT5682S_JD_CTRL_1			0x00f6
16262306a36Sopenharmony_ci/* General Control */
16362306a36Sopenharmony_ci#define RT5682S_DUMMY_1				0x00fa
16462306a36Sopenharmony_ci#define RT5682S_DUMMY_2				0x00fb
16562306a36Sopenharmony_ci#define RT5682S_DUMMY_3				0x00fc
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define RT5682S_DAC_ADC_DIG_VOL1		0x0100
16862306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_2			0x010b
16962306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_3			0x010c
17062306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_4			0x010d
17162306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_5			0x010e
17262306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_6			0x010f
17362306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_7			0x0110
17462306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_8			0x0111
17562306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_9			0x0112
17662306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_10		0x0113
17762306a36Sopenharmony_ci#define RT5682S_VREF_REC_OP_FB_CAP_CTRL_1	0x0117
17862306a36Sopenharmony_ci#define RT5682S_VREF_REC_OP_FB_CAP_CTRL_2	0x0118
17962306a36Sopenharmony_ci#define RT5682S_CHARGE_PUMP_1			0x0125
18062306a36Sopenharmony_ci#define RT5682S_DIG_IN_CTRL_1			0x0132
18162306a36Sopenharmony_ci#define RT5682S_PAD_DRIVING_CTRL		0x0136
18262306a36Sopenharmony_ci#define RT5682S_CHOP_DAC_1			0x0139
18362306a36Sopenharmony_ci#define RT5682S_CHOP_DAC_2			0x013a
18462306a36Sopenharmony_ci#define RT5682S_CHOP_ADC			0x013b
18562306a36Sopenharmony_ci#define RT5682S_CALIB_ADC_CTRL			0x013c
18662306a36Sopenharmony_ci#define RT5682S_VOL_TEST			0x013f
18762306a36Sopenharmony_ci#define RT5682S_SPKVDD_DET_ST			0x0142
18862306a36Sopenharmony_ci#define RT5682S_TEST_MODE_CTRL_1		0x0145
18962306a36Sopenharmony_ci#define RT5682S_TEST_MODE_CTRL_2		0x0146
19062306a36Sopenharmony_ci#define RT5682S_TEST_MODE_CTRL_3		0x0147
19162306a36Sopenharmony_ci#define RT5682S_TEST_MODE_CTRL_4		0x0148
19262306a36Sopenharmony_ci#define RT5682S_PLL_INTERNAL_1			0x0156
19362306a36Sopenharmony_ci#define RT5682S_PLL_INTERNAL_2			0x0157
19462306a36Sopenharmony_ci#define RT5682S_PLL_INTERNAL_3			0x0158
19562306a36Sopenharmony_ci#define RT5682S_PLL_INTERNAL_4			0x0159
19662306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_1			0x0160
19762306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_2			0x0161
19862306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_3			0x0162
19962306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_4			0x0163
20062306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_5			0x0164
20162306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_6			0x0165
20262306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_7			0x0166
20362306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_8			0x0167
20462306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_9			0x0168
20562306a36Sopenharmony_ci#define RT5682S_STO_NG2_CTRL_10			0x0169
20662306a36Sopenharmony_ci#define RT5682S_STO1_DAC_SIL_DET		0x0190
20762306a36Sopenharmony_ci#define RT5682S_SIL_PSV_CTRL1			0x0194
20862306a36Sopenharmony_ci#define RT5682S_SIL_PSV_CTRL2			0x0195
20962306a36Sopenharmony_ci#define RT5682S_SIL_PSV_CTRL3			0x0197
21062306a36Sopenharmony_ci#define RT5682S_SIL_PSV_CTRL4			0x0198
21162306a36Sopenharmony_ci#define RT5682S_SIL_PSV_CTRL5			0x0199
21262306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_1		0x01ac
21362306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_2		0x01ad
21462306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_3		0x01ae
21562306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_4		0x01af
21662306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_5		0x01b0
21762306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_6		0x01b1
21862306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_7		0x01b2
21962306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_8		0x01b3
22062306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_9		0x01b4
22162306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_10		0x01b5
22262306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_11		0x01b6
22362306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_12		0x01b7
22462306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_13		0x01b8
22562306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_14		0x01b9
22662306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_15		0x01ba
22762306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_16		0x01bb
22862306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_17		0x01bc
22962306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_18		0x01bd
23062306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_19		0x01be
23162306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_20		0x01bf
23262306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_21		0x01c0
23362306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_22		0x01c1
23462306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_23		0x01c2
23562306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_24		0x01c3
23662306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_25		0x01c4
23762306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_26		0x01c5
23862306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_27		0x01c6
23962306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_28		0x01c7
24062306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_29		0x01c8
24162306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_30		0x01c9
24262306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_31		0x01ca
24362306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_32		0x01cb
24462306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_33		0x01cc
24562306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_34		0x01cd
24662306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_35		0x01ce
24762306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_36		0x01cf
24862306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_37		0x01d0
24962306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_38		0x01d1
25062306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_39		0x01d2
25162306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_40		0x01d3
25262306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_41		0x01d4
25362306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_42		0x01d5
25462306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_43		0x01d6
25562306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_44		0x01d7
25662306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_45		0x01d8
25762306a36Sopenharmony_ci#define RT5682S_HP_IMP_SENS_CTRL_46		0x01d9
25862306a36Sopenharmony_ci#define RT5682S_HP_LOGIC_CTRL_1			0x01da
25962306a36Sopenharmony_ci#define RT5682S_HP_LOGIC_CTRL_2			0x01db
26062306a36Sopenharmony_ci#define RT5682S_HP_LOGIC_CTRL_3			0x01dc
26162306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_1			0x01de
26262306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_2			0x01df
26362306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_3			0x01e0
26462306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_4			0x01e1
26562306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_5			0x01e2
26662306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_6			0x01e3
26762306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_7			0x01e4
26862306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_8			0x01e5
26962306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_9			0x01e6
27062306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_10		0x01e7
27162306a36Sopenharmony_ci#define RT5682S_HP_CALIB_CTRL_11		0x01e8
27262306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_1			0x01ea
27362306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_2			0x01eb
27462306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_3			0x01ec
27562306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_4			0x01ed
27662306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_5			0x01ee
27762306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_6			0x01ef
27862306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_7			0x01f0
27962306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_8			0x01f1
28062306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_9			0x01f2
28162306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_10			0x01f3
28262306a36Sopenharmony_ci#define RT5682S_HP_CALIB_ST_11			0x01f4
28362306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_1			0x0210
28462306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_2			0x0211
28562306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_3			0x0212
28662306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_4			0x0213
28762306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_5			0x0214
28862306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_6			0x0215
28962306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_7			0x0216
29062306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_8			0x0217
29162306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_9			0x0218
29262306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_10			0x0219
29362306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_11			0x021a
29462306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_12			0x021b
29562306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_13			0x021c
29662306a36Sopenharmony_ci#define RT5682S_SAR_IL_CMD_14			0x021d
29762306a36Sopenharmony_ci#define RT5682S_DUMMY_4				0x02fa
29862306a36Sopenharmony_ci#define RT5682S_DUMMY_5				0x02fb
29962306a36Sopenharmony_ci#define RT5682S_DUMMY_6				0x02fc
30062306a36Sopenharmony_ci#define RT5682S_VERSION_ID_HIDE			0x03fe
30162306a36Sopenharmony_ci#define RT5682S_VERSION_ID_CUS			0x03ff
30262306a36Sopenharmony_ci#define RT5682S_SCAN_CTL			0x0500
30362306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET			0x0600
30462306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_11		0x0610
30562306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_12		0x0611
30662306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_13		0x0620
30762306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_14		0x0621
30862306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_15		0x0630
30962306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_16		0x0631
31062306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_17		0x0640
31162306a36Sopenharmony_ci#define RT5682S_BIAS_CUR_CTRL_18		0x0641
31262306a36Sopenharmony_ci#define RT5682S_I2C_TRANS_CTRL			0x07fa
31362306a36Sopenharmony_ci#define RT5682S_DUMMY_7				0x08fa
31462306a36Sopenharmony_ci#define RT5682S_DUMMY_8				0x08fb
31562306a36Sopenharmony_ci#define RT5682S_DMIC_FLOAT_DET			0x0d00
31662306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_1			0x1100
31762306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_2			0x1101
31862306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_3			0x1102
31962306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_4			0x1103
32062306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_5			0x1104
32162306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_6			0x1105
32262306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_7			0x1106
32362306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_8			0x1107
32462306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_9			0x1108
32562306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_10			0x1109
32662306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_11			0x110a
32762306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_12			0x110b
32862306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_13			0x110c
32962306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_14			0x1111
33062306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_15			0x1112
33162306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_16			0x1113
33262306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_17			0x1114
33362306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_18			0x1115
33462306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_19			0x1116
33562306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_20			0x1117
33662306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_21			0x1118
33762306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_22			0x1119
33862306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_23			0x111a
33962306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_24			0x111b
34062306a36Sopenharmony_ci#define RT5682S_HA_CMP_OP_25			0x111c
34162306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_1		0x1401
34262306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_2		0x1402
34362306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_3		0x1403
34462306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_4		0x1404
34562306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_5		0x1406
34662306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_6		0x1407
34762306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_7		0x1408
34862306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_8		0x1409
34962306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_9		0x140a
35062306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_10		0x140b
35162306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_11		0x140c
35262306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_12		0x140d
35362306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_13		0x140e
35462306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_14		0x140f
35562306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_15		0x1410
35662306a36Sopenharmony_ci#define RT5682S_NEW_CBJ_DET_CTL_16		0x1411
35762306a36Sopenharmony_ci#define RT5682S_DA_FILTER_1			0x1801
35862306a36Sopenharmony_ci#define RT5682S_DA_FILTER_2			0x1802
35962306a36Sopenharmony_ci#define RT5682S_DA_FILTER_3			0x1803
36062306a36Sopenharmony_ci#define RT5682S_DA_FILTER_4			0x1804
36162306a36Sopenharmony_ci#define RT5682S_DA_FILTER_5			0x1805
36262306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_1			0x2c00
36362306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_2			0x3400
36462306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_3			0x3404
36562306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_4			0x3405
36662306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_5			0x3406
36762306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_6			0x3407
36862306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_7			0x3408
36962306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_8			0x3409
37062306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_9			0x340a
37162306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_10			0x340b
37262306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_11			0x340c
37362306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_12			0x340d
37462306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_13			0x340e
37562306a36Sopenharmony_ci#define RT5682S_CLK_SW_TEST_14			0x340f
37662306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_1		0x3410
37762306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_2		0x3411
37862306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_3		0x3412
37962306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_4		0x3413
38062306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_5		0x3414
38162306a36Sopenharmony_ci#define RT5682S_EFUSE_MANU_WRITE_6		0x3415
38262306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_1			0x3424
38362306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_2			0x3425
38462306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_3			0x3426
38562306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_4			0x3427
38662306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_5			0x3428
38762306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_6			0x3429
38862306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_7			0x342a
38962306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_8			0x342b
39062306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_9			0x342c
39162306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_10			0x342d
39262306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_11			0x342e
39362306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_12			0x342f
39462306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_13			0x3430
39562306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_14			0x3431
39662306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_15			0x3432
39762306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_16			0x3433
39862306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_17			0x3434
39962306a36Sopenharmony_ci#define RT5682S_EFUSE_READ_18			0x3435
40062306a36Sopenharmony_ci#define RT5682S_EFUSE_TIMING_CTL_1		0x3440
40162306a36Sopenharmony_ci#define RT5682S_EFUSE_TIMING_CTL_2		0x3441
40262306a36Sopenharmony_ci#define RT5682S_PILOT_DIG_CTL_1			0x3500
40362306a36Sopenharmony_ci#define RT5682S_PILOT_DIG_CTL_2			0x3501
40462306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET_CTL_1		0x3b00
40562306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET_CTL_2		0x3b01
40662306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET_CTL_3		0x3b02
40762306a36Sopenharmony_ci#define RT5682S_HP_AMP_DET_CTL_4		0x3b03
40862306a36Sopenharmony_ci
40962306a36Sopenharmony_ci#define RT5682S_MAX_REG				(RT5682S_HP_AMP_DET_CTL_4)
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci/* global definition */
41262306a36Sopenharmony_ci#define RT5682S_L_MUTE				(0x1 << 15)
41362306a36Sopenharmony_ci#define RT5682S_L_MUTE_SFT			15
41462306a36Sopenharmony_ci#define RT5682S_R_MUTE				(0x1 << 7)
41562306a36Sopenharmony_ci#define RT5682S_R_MUTE_SFT			7
41662306a36Sopenharmony_ci#define RT5682S_L_VOL_SFT			8
41762306a36Sopenharmony_ci#define RT5682S_R_VOL_SFT			0
41862306a36Sopenharmony_ci#define RT5682S_CLK_SRC_MCLK			(0x0)
41962306a36Sopenharmony_ci#define RT5682S_CLK_SRC_PLL1			(0x1)
42062306a36Sopenharmony_ci#define RT5682S_CLK_SRC_PLL2			(0x2)
42162306a36Sopenharmony_ci#define RT5682S_CLK_SRC_RCCLK			(0x4) /* 25M */
42262306a36Sopenharmony_ci
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/* Headphone Amp Control 2 (0x0003) */
42562306a36Sopenharmony_ci#define RT5682S_HPO_L_PATH_MASK			(0x1 << 14)
42662306a36Sopenharmony_ci#define RT5682S_HPO_L_PATH_EN			(0x1 << 14)
42762306a36Sopenharmony_ci#define RT5682S_HPO_L_PATH_DIS			(0x0 << 14)
42862306a36Sopenharmony_ci#define RT5682S_HPO_R_PATH_MASK			(0x1 << 13)
42962306a36Sopenharmony_ci#define RT5682S_HPO_R_PATH_EN			(0x1 << 13)
43062306a36Sopenharmony_ci#define RT5682S_HPO_R_PATH_DIS			(0x0 << 13)
43162306a36Sopenharmony_ci#define RT5682S_HPO_SEL_IP_EN_SW		(0x1)
43262306a36Sopenharmony_ci#define RT5682S_HPO_IP_EN_GATING		(0x1)
43362306a36Sopenharmony_ci#define RT5682S_HPO_IP_NO_GATING		(0x0)
43462306a36Sopenharmony_ci
43562306a36Sopenharmony_ci/*Headphone Amp L/R Analog Gain and Digital NG2 Gain Control (0x0005 0x0006)*/
43662306a36Sopenharmony_ci#define RT5682S_G_HP				(0xf << 8)
43762306a36Sopenharmony_ci#define RT5682S_G_HP_SFT			8
43862306a36Sopenharmony_ci#define RT5682S_G_STO_DA_DMIX			(0xf)
43962306a36Sopenharmony_ci#define RT5682S_G_STO_DA_SFT			0
44062306a36Sopenharmony_ci
44162306a36Sopenharmony_ci/* Embeeded Jack and Type Detection Control 2 (0x0010) */
44262306a36Sopenharmony_ci#define RT5682S_EMB_JD_MASK			(0x1 << 15)
44362306a36Sopenharmony_ci#define RT5682S_EMB_JD_EN			(0x1 << 15)
44462306a36Sopenharmony_ci#define RT5682S_EMB_JD_EN_SFT			15
44562306a36Sopenharmony_ci#define RT5682S_EMB_JD_RST			(0x1 << 14)
44662306a36Sopenharmony_ci#define RT5682S_JD_MODE				(0x1 << 13)
44762306a36Sopenharmony_ci#define RT5682S_JD_MODE_SFT			13
44862306a36Sopenharmony_ci#define RT5682S_DET_TYPE			(0x1 << 12)
44962306a36Sopenharmony_ci#define RT5682S_DET_TYPE_SFT			12
45062306a36Sopenharmony_ci#define RT5682S_POLA_EXT_JD_MASK		(0x1 << 11)
45162306a36Sopenharmony_ci#define RT5682S_POLA_EXT_JD_LOW			(0x1 << 11)
45262306a36Sopenharmony_ci#define RT5682S_POLA_EXT_JD_HIGH		(0x0 << 11)
45362306a36Sopenharmony_ci#define RT5682S_SEL_FAST_OFF_MASK		(0x3 << 9)
45462306a36Sopenharmony_ci#define RT5682S_SEL_FAST_OFF_SFT		9
45562306a36Sopenharmony_ci#define RT5682S_POL_FAST_OFF_MASK		(0x1 << 8)
45662306a36Sopenharmony_ci#define RT5682S_POL_FAST_OFF_HIGH		(0x1 << 8)
45762306a36Sopenharmony_ci#define RT5682S_POL_FAST_OFF_LOW		(0x0 << 8)
45862306a36Sopenharmony_ci#define RT5682S_FAST_OFF_MASK			(0x1 << 7)
45962306a36Sopenharmony_ci#define RT5682S_FAST_OFF_EN			(0x1 << 7)
46062306a36Sopenharmony_ci#define RT5682S_FAST_OFF_DIS			(0x0 << 7)
46162306a36Sopenharmony_ci#define RT5682S_VREF_POW_MASK			(0x1 << 6)
46262306a36Sopenharmony_ci#define RT5682S_VREF_POW_FSM			(0x0 << 6)
46362306a36Sopenharmony_ci#define RT5682S_VREF_POW_REG			(0x1 << 6)
46462306a36Sopenharmony_ci#define RT5682S_MB1_PATH_BIT			5
46562306a36Sopenharmony_ci#define RT5682S_MB1_PATH_MASK			(0x1 << 5)
46662306a36Sopenharmony_ci#define RT5682S_CTRL_MB1_REG			(0x1 << 5)
46762306a36Sopenharmony_ci#define RT5682S_CTRL_MB1_FSM			(0x0 << 5)
46862306a36Sopenharmony_ci#define RT5682S_MB2_PATH_BIT			4
46962306a36Sopenharmony_ci#define RT5682S_MB2_PATH_MASK			(0x1 << 4)
47062306a36Sopenharmony_ci#define RT5682S_CTRL_MB2_REG			(0x1 << 4)
47162306a36Sopenharmony_ci#define RT5682S_CTRL_MB2_FSM			(0x0 << 4)
47262306a36Sopenharmony_ci#define RT5682S_TRIG_JD_MASK			(0x1 << 3)
47362306a36Sopenharmony_ci#define RT5682S_TRIG_JD_HIGH			(0x1 << 3)
47462306a36Sopenharmony_ci#define RT5682S_TRIG_JD_LOW			(0x0 << 3)
47562306a36Sopenharmony_ci#define RT5682S_MIC_CAP_MASK			(0x1 << 1)
47662306a36Sopenharmony_ci#define RT5682S_MIC_CAP_HS			(0x1 << 1)
47762306a36Sopenharmony_ci#define RT5682S_MIC_CAP_HP			(0x0 << 1)
47862306a36Sopenharmony_ci#define RT5682S_MIC_CAP_SRC_MASK		(0x1)
47962306a36Sopenharmony_ci#define RT5682S_MIC_CAP_SRC_REG			(0x1)
48062306a36Sopenharmony_ci#define RT5682S_MIC_CAP_SRC_ANA			(0x0)
48162306a36Sopenharmony_ci
48262306a36Sopenharmony_ci/* Embeeded Jack and Type Detection Control 3 (0x0011) */
48362306a36Sopenharmony_ci#define RT5682S_SEL_CBJ_TYPE_SLOW		(0x1 << 15)
48462306a36Sopenharmony_ci#define RT5682S_SEL_CBJ_TYPE_NORM		(0x0 << 15)
48562306a36Sopenharmony_ci#define RT5682S_SEL_CBJ_TYPE_MASK		(0x1 << 15)
48662306a36Sopenharmony_ci#define RT5682S_POW_BG_MB1_MASK			(0x1 << 13)
48762306a36Sopenharmony_ci#define RT5682S_POW_BG_MB1_REG			(0x1 << 13)
48862306a36Sopenharmony_ci#define RT5682S_POW_BG_MB1_FSM			(0x0 << 13)
48962306a36Sopenharmony_ci#define RT5682S_POW_BG_MB2_MASK			(0x1 << 12)
49062306a36Sopenharmony_ci#define RT5682S_POW_BG_MB2_REG			(0x1 << 12)
49162306a36Sopenharmony_ci#define RT5682S_POW_BG_MB2_FSM			(0x0 << 12)
49262306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC			(0x7 << 4)
49362306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_SFT			4
49462306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_GPIO_JD1		(0x0 << 4)
49562306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_GPIO_JD2		(0x1 << 4)
49662306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_JDH			(0x2 << 4)
49762306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_JDL			(0x3 << 4)
49862306a36Sopenharmony_ci#define RT5682S_EXT_JD_SRC_MANUAL		(0x4 << 4)
49962306a36Sopenharmony_ci#define RT5682S_JACK_TYPE_MASK			(0x3)
50062306a36Sopenharmony_ci
50162306a36Sopenharmony_ci/* Combo Jack and Type Detection Control 4 (0x0012) */
50262306a36Sopenharmony_ci#define RT5682S_CBJ_IN_BUF_MASK			(0x1 << 7)
50362306a36Sopenharmony_ci#define RT5682S_CBJ_IN_BUF_EN			(0x1 << 7)
50462306a36Sopenharmony_ci#define RT5682S_CBJ_IN_BUF_DIS			(0x0 << 7)
50562306a36Sopenharmony_ci#define RT5682S_CBJ_IN_BUF_BIT			7
50662306a36Sopenharmony_ci
50762306a36Sopenharmony_ci/* Combo Jack and Type Detection Control 5 (0x0013) */
50862306a36Sopenharmony_ci#define RT5682S_SEL_SHT_MID_TON_MASK		(0x3 << 12)
50962306a36Sopenharmony_ci#define RT5682S_SEL_SHT_MID_TON_2		(0x0 << 12)
51062306a36Sopenharmony_ci#define RT5682S_SEL_SHT_MID_TON_3		(0x1 << 12)
51162306a36Sopenharmony_ci#define RT5682S_CBJ_JD_TEST_MASK		(0x1 << 6)
51262306a36Sopenharmony_ci#define RT5682S_CBJ_JD_TEST_NORM		(0x0 << 6)
51362306a36Sopenharmony_ci#define RT5682S_CBJ_JD_TEST_MODE		(0x1 << 6)
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci/* Combo Jack and Type Detection Control 6 (0x0014) */
51662306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_MASK		(0x7 << 8)
51762306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_JDH		(0x6 << 8)
51862306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO6		(0x5 << 8)
51962306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO5		(0x4 << 8)
52062306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO4		(0x3 << 8)
52162306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO3		(0x2 << 8)
52262306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO2		(0x1 << 8)
52362306a36Sopenharmony_ci#define RT5682S_JD_FAST_OFF_SRC_GPIO1		(0x0 << 8)
52462306a36Sopenharmony_ci
52562306a36Sopenharmony_ci/* DAC1 Digital Volume (0x0019) */
52662306a36Sopenharmony_ci#define RT5682S_DAC_L1_VOL_MASK			(0xff << 8)
52762306a36Sopenharmony_ci#define RT5682S_DAC_L1_VOL_SFT			8
52862306a36Sopenharmony_ci#define RT5682S_DAC_R1_VOL_MASK			(0xff)
52962306a36Sopenharmony_ci#define RT5682S_DAC_R1_VOL_SFT			0
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci/* ADC Digital Volume Control (0x001c) */
53262306a36Sopenharmony_ci#define RT5682S_ADC_L_VOL_MASK			(0x7f << 8)
53362306a36Sopenharmony_ci#define RT5682S_ADC_L_VOL_SFT			8
53462306a36Sopenharmony_ci#define RT5682S_ADC_R_VOL_MASK			(0x7f)
53562306a36Sopenharmony_ci#define RT5682S_ADC_R_VOL_SFT			0
53662306a36Sopenharmony_ci
53762306a36Sopenharmony_ci/* Stereo1 ADC Boost Gain Control (0x001f) */
53862306a36Sopenharmony_ci#define RT5682S_STO1_ADC_L_BST_MASK		(0x3 << 14)
53962306a36Sopenharmony_ci#define RT5682S_STO1_ADC_L_BST_SFT		14
54062306a36Sopenharmony_ci#define RT5682S_STO1_ADC_R_BST_MASK		(0x3 << 12)
54162306a36Sopenharmony_ci#define RT5682S_STO1_ADC_R_BST_SFT		12
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_ci/* Sidetone Control (0x0024) */
54462306a36Sopenharmony_ci#define RT5682S_ST_SRC_SEL			(0x1 << 8)
54562306a36Sopenharmony_ci#define RT5682S_ST_SRC_SFT			8
54662306a36Sopenharmony_ci#define RT5682S_ST_EN_MASK			(0x1 << 6)
54762306a36Sopenharmony_ci#define RT5682S_ST_DIS				(0x0 << 6)
54862306a36Sopenharmony_ci#define RT5682S_ST_EN				(0x1 << 6)
54962306a36Sopenharmony_ci#define RT5682S_ST_EN_SFT			6
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ci/* Stereo1 ADC Mixer Control (0x0026) */
55262306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_L1			(0x1 << 15)
55362306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_L1_SFT		15
55462306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_L2			(0x1 << 14)
55562306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_L2_SFT		14
55662306a36Sopenharmony_ci#define RT5682S_STO1_ADC1L_SRC_MASK		(0x1 << 13)
55762306a36Sopenharmony_ci#define RT5682S_STO1_ADC1L_SRC_SFT		13
55862306a36Sopenharmony_ci#define RT5682S_STO1_ADC1_SRC_ADC		(0x1 << 13)
55962306a36Sopenharmony_ci#define RT5682S_STO1_ADC1_SRC_DACMIX		(0x0 << 13)
56062306a36Sopenharmony_ci#define RT5682S_STO1_ADC2L_SRC_MASK		(0x1 << 12)
56162306a36Sopenharmony_ci#define RT5682S_STO1_ADC2L_SRC_SFT		12
56262306a36Sopenharmony_ci#define RT5682S_STO1_ADCL_SRC_MASK		(0x3 << 10)
56362306a36Sopenharmony_ci#define RT5682S_STO1_ADCL_SRC_SFT		10
56462306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_R1			(0x1 << 7)
56562306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_R1_SFT		7
56662306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_R2			(0x1 << 6)
56762306a36Sopenharmony_ci#define RT5682S_M_STO1_ADC_R2_SFT		6
56862306a36Sopenharmony_ci#define RT5682S_STO1_ADC1R_SRC_MASK		(0x1 << 5)
56962306a36Sopenharmony_ci#define RT5682S_STO1_ADC1R_SRC_SFT		5
57062306a36Sopenharmony_ci#define RT5682S_STO1_ADC2R_SRC_MASK		(0x1 << 4)
57162306a36Sopenharmony_ci#define RT5682S_STO1_ADC2R_SRC_SFT		4
57262306a36Sopenharmony_ci#define RT5682S_STO1_ADCR_SRC_MASK		(0x3 << 2)
57362306a36Sopenharmony_ci#define RT5682S_STO1_ADCR_SRC_SFT		2
57462306a36Sopenharmony_ci
57562306a36Sopenharmony_ci/* ADC Mixer to DAC Mixer Control (0x0029) */
57662306a36Sopenharmony_ci#define RT5682S_M_ADCMIX_L			(0x1 << 15)
57762306a36Sopenharmony_ci#define RT5682S_M_ADCMIX_L_SFT			15
57862306a36Sopenharmony_ci#define RT5682S_M_DAC1_L			(0x1 << 14)
57962306a36Sopenharmony_ci#define RT5682S_M_DAC1_L_SFT			14
58062306a36Sopenharmony_ci#define RT5682S_M_ADCMIX_R			(0x1 << 7)
58162306a36Sopenharmony_ci#define RT5682S_M_ADCMIX_R_SFT			7
58262306a36Sopenharmony_ci#define RT5682S_M_DAC1_R			(0x1 << 6)
58362306a36Sopenharmony_ci#define RT5682S_M_DAC1_R_SFT			6
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ci/* Stereo1 DAC Mixer Control (0x002a) */
58662306a36Sopenharmony_ci#define RT5682S_M_DAC_L1_STO_L			(0x1 << 15)
58762306a36Sopenharmony_ci#define RT5682S_M_DAC_L1_STO_L_SFT		15
58862306a36Sopenharmony_ci#define RT5682S_G_DAC_L1_STO_L_MASK		(0x1 << 14)
58962306a36Sopenharmony_ci#define RT5682S_G_DAC_L1_STO_L_SFT		14
59062306a36Sopenharmony_ci#define RT5682S_M_DAC_R1_STO_L			(0x1 << 13)
59162306a36Sopenharmony_ci#define RT5682S_M_DAC_R1_STO_L_SFT		13
59262306a36Sopenharmony_ci#define RT5682S_G_DAC_R1_STO_L_MASK		(0x1 << 12)
59362306a36Sopenharmony_ci#define RT5682S_G_DAC_R1_STO_L_SFT		12
59462306a36Sopenharmony_ci#define RT5682S_M_DAC_L1_STO_R			(0x1 << 7)
59562306a36Sopenharmony_ci#define RT5682S_M_DAC_L1_STO_R_SFT		7
59662306a36Sopenharmony_ci#define RT5682S_G_DAC_L1_STO_R_MASK		(0x1 << 6)
59762306a36Sopenharmony_ci#define RT5682S_G_DAC_L1_STO_R_SFT		6
59862306a36Sopenharmony_ci#define RT5682S_M_DAC_R1_STO_R			(0x1 << 5)
59962306a36Sopenharmony_ci#define RT5682S_M_DAC_R1_STO_R_SFT		5
60062306a36Sopenharmony_ci#define RT5682S_G_DAC_R1_STO_R_MASK		(0x1 << 4)
60162306a36Sopenharmony_ci#define RT5682S_G_DAC_R1_STO_R_SFT		4
60262306a36Sopenharmony_ci
60362306a36Sopenharmony_ci/* Analog DAC1 Input Source Control (0x002b) */
60462306a36Sopenharmony_ci#define RT5682S_M_ST_STO_L			(0x1 << 9)
60562306a36Sopenharmony_ci#define RT5682S_M_ST_STO_L_SFT			9
60662306a36Sopenharmony_ci#define RT5682S_M_ST_STO_R			(0x1 << 8)
60762306a36Sopenharmony_ci#define RT5682S_M_ST_STO_R_SFT			8
60862306a36Sopenharmony_ci#define RT5682S_DAC_L1_SRC_MASK			(0x1 << 4)
60962306a36Sopenharmony_ci#define RT5682S_A_DACL1_SFT			4
61062306a36Sopenharmony_ci#define RT5682S_DAC_R1_SRC_MASK			(0x1)
61162306a36Sopenharmony_ci#define RT5682S_A_DACR1_SFT			0
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci/* Digital Interface Data Control (0x0030) */
61462306a36Sopenharmony_ci#define RT5682S_IF2_DAC_SEL_MASK		(0x3 << 2)
61562306a36Sopenharmony_ci#define RT5682S_IF2_DAC_SEL_SFT			2
61662306a36Sopenharmony_ci#define RT5682S_IF2_ADC_SEL_MASK		(0x3 << 0)
61762306a36Sopenharmony_ci#define RT5682S_IF2_ADC_SEL_SFT			0
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/* REC Left/Right Mixer Control 2 (0x003c) */
62062306a36Sopenharmony_ci#define RT5682S_BST_CBJ_MASK			(0x3f << 8)
62162306a36Sopenharmony_ci#define RT5682S_BST_CBJ_SFT			8
62262306a36Sopenharmony_ci#define RT5682S_M_CBJ_RM1_L			(0x1 << 7)
62362306a36Sopenharmony_ci#define RT5682S_M_CBJ_RM1_L_SFT			7
62462306a36Sopenharmony_ci#define RT5682S_M_CBJ_RM1_R			(0x1 << 6)
62562306a36Sopenharmony_ci#define RT5682S_M_CBJ_RM1_R_SFT			6
62662306a36Sopenharmony_ci
62762306a36Sopenharmony_ci/* REC Left/Right Mixer Calibration Control(0x0044) */
62862306a36Sopenharmony_ci#define RT5682S_PWR_RM1_R_BIT			8
62962306a36Sopenharmony_ci#define RT5682S_PWR_RM1_L_BIT			0
63062306a36Sopenharmony_ci
63162306a36Sopenharmony_ci/* Power Management for Digital 1 (0x0061) */
63262306a36Sopenharmony_ci#define RT5682S_PWR_I2S1			(0x1 << 15)
63362306a36Sopenharmony_ci#define RT5682S_PWR_I2S1_BIT			15
63462306a36Sopenharmony_ci#define RT5682S_PWR_I2S2			(0x1 << 14)
63562306a36Sopenharmony_ci#define RT5682S_PWR_I2S2_BIT			14
63662306a36Sopenharmony_ci#define RT5682S_PRE_CHR_DAC_L1			(0x1 << 13)
63762306a36Sopenharmony_ci#define RT5682S_PRE_CHR_DAC_L1_BIT		13
63862306a36Sopenharmony_ci#define RT5682S_PRE_CHR_DAC_R1			(0x1 << 12)
63962306a36Sopenharmony_ci#define RT5682S_PRE_CHR_DAC_R1_BIT		12
64062306a36Sopenharmony_ci#define RT5682S_PWR_DAC_L1			(0x1 << 11)
64162306a36Sopenharmony_ci#define RT5682S_PWR_DAC_L1_BIT			11
64262306a36Sopenharmony_ci#define RT5682S_PWR_DAC_R1			(0x1 << 10)
64362306a36Sopenharmony_ci#define RT5682S_PWR_DAC_R1_BIT			10
64462306a36Sopenharmony_ci#define RT5682S_PWR_LDO				(0x1 << 8)
64562306a36Sopenharmony_ci#define RT5682S_PWR_LDO_BIT			8
64662306a36Sopenharmony_ci#define RT5682S_PWR_D2S_L			(0x1 << 7)
64762306a36Sopenharmony_ci#define RT5682S_PWR_D2S_L_BIT			7
64862306a36Sopenharmony_ci#define RT5682S_PWR_D2S_R			(0x1 << 6)
64962306a36Sopenharmony_ci#define RT5682S_PWR_D2S_R_BIT			6
65062306a36Sopenharmony_ci#define RT5682S_PWR_ADC_L1			(0x1 << 4)
65162306a36Sopenharmony_ci#define RT5682S_PWR_ADC_L1_BIT			4
65262306a36Sopenharmony_ci#define RT5682S_PWR_ADC_R1			(0x1 << 3)
65362306a36Sopenharmony_ci#define RT5682S_PWR_ADC_R1_BIT			3
65462306a36Sopenharmony_ci#define RT5682S_EFUSE_SW_EN			(0x1 << 2)
65562306a36Sopenharmony_ci#define RT5682S_EFUSE_SW_DIS			(0x0 << 2)
65662306a36Sopenharmony_ci#define RT5682S_PWR_EFUSE			(0x1 << 1)
65762306a36Sopenharmony_ci#define RT5682S_PWR_EFUSE_BIT			1
65862306a36Sopenharmony_ci#define RT5682S_DIG_GATE_CTRL			(0x1 << 0)
65962306a36Sopenharmony_ci#define RT5682S_DIG_GATE_CTRL_SFT		0
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci/* Power Management for Digital 2 (0x0062) */
66262306a36Sopenharmony_ci#define RT5682S_PWR_ADC_S1F			(0x1 << 15)
66362306a36Sopenharmony_ci#define RT5682S_PWR_ADC_S1F_BIT			15
66462306a36Sopenharmony_ci#define RT5682S_PWR_DAC_S1F			(0x1 << 10)
66562306a36Sopenharmony_ci#define RT5682S_PWR_DAC_S1F_BIT			10
66662306a36Sopenharmony_ci#define RT5682S_DLDO_I_LIMIT_MASK		(0x1 << 7)
66762306a36Sopenharmony_ci#define RT5682S_DLDO_I_LIMIT_EN			(0x1 << 7)
66862306a36Sopenharmony_ci#define RT5682S_DLDO_I_LIMIT_DIS		(0x0 << 7)
66962306a36Sopenharmony_ci#define RT5682S_DLDO_I_BIAS_SEL_4		(0x1 << 6)
67062306a36Sopenharmony_ci#define RT5682S_DLDO_I_BIAS_SEL_0		(0x0 << 6)
67162306a36Sopenharmony_ci#define RT5682S_DLDO_REG_TEST_1			(0x1 << 5)
67262306a36Sopenharmony_ci#define RT5682S_DLDO_REG_TEST_0			(0x0 << 5)
67362306a36Sopenharmony_ci#define RT5682S_DLDO_SRC_REG			(0x1 << 4)
67462306a36Sopenharmony_ci#define RT5682S_DLDO_SRC_EFUSE			(0x0 << 4)
67562306a36Sopenharmony_ci
67662306a36Sopenharmony_ci/* Power Management for Analog 1 (0x0063) */
67762306a36Sopenharmony_ci#define RT5682S_PWR_VREF1			(0x1 << 15)
67862306a36Sopenharmony_ci#define RT5682S_PWR_VREF1_BIT			15
67962306a36Sopenharmony_ci#define RT5682S_PWR_FV1				(0x1 << 14)
68062306a36Sopenharmony_ci#define RT5682S_PWR_FV1_BIT			14
68162306a36Sopenharmony_ci#define RT5682S_PWR_VREF2			(0x1 << 13)
68262306a36Sopenharmony_ci#define RT5682S_PWR_VREF2_BIT			13
68362306a36Sopenharmony_ci#define RT5682S_PWR_FV2				(0x1 << 12)
68462306a36Sopenharmony_ci#define RT5682S_PWR_FV2_BIT			12
68562306a36Sopenharmony_ci#define RT5682S_LDO1_DBG_MASK			(0x3 << 10)
68662306a36Sopenharmony_ci#define RT5682S_PWR_MB				(0x1 << 9)
68762306a36Sopenharmony_ci#define RT5682S_PWR_MB_BIT			9
68862306a36Sopenharmony_ci#define RT5682S_PWR_BG				(0x1 << 7)
68962306a36Sopenharmony_ci#define RT5682S_PWR_BG_BIT			7
69062306a36Sopenharmony_ci#define RT5682S_LDO1_BYPASS_MASK		(0x1 << 6)
69162306a36Sopenharmony_ci#define RT5682S_LDO1_BYPASS			(0x1 << 6)
69262306a36Sopenharmony_ci#define RT5682S_LDO1_NOT_BYPASS			(0x0 << 6)
69362306a36Sopenharmony_ci
69462306a36Sopenharmony_ci/* Power Management for Analog 2 (0x0064) */
69562306a36Sopenharmony_ci#define RT5682S_PWR_MCLK0_WD			(0x1 << 15)
69662306a36Sopenharmony_ci#define RT5682S_PWR_MCLK0_WD_BIT		15
69762306a36Sopenharmony_ci#define RT5682S_PWR_MCLK1_WD			(0x1 << 14)
69862306a36Sopenharmony_ci#define RT5682S_PWR_MCLK1_WD_BIT		14
69962306a36Sopenharmony_ci#define RT5682S_RST_MCLK0			(0x1 << 13)
70062306a36Sopenharmony_ci#define RT5682S_RST_MCLK0_BIT			13
70162306a36Sopenharmony_ci#define RT5682S_RST_MCLK1			(0x1 << 12)
70262306a36Sopenharmony_ci#define RT5682S_RST_MCLK1_BIT			12
70362306a36Sopenharmony_ci#define RT5682S_PWR_MB1				(0x1 << 11)
70462306a36Sopenharmony_ci#define RT5682S_PWR_MB1_PWR_DOWN		(0x0 << 11)
70562306a36Sopenharmony_ci#define RT5682S_PWR_MB1_BIT			11
70662306a36Sopenharmony_ci#define RT5682S_PWR_MB2				(0x1 << 10)
70762306a36Sopenharmony_ci#define RT5682S_PWR_MB2_PWR_DOWN		(0x0 << 10)
70862306a36Sopenharmony_ci#define RT5682S_PWR_MB2_BIT			10
70962306a36Sopenharmony_ci#define RT5682S_PWR_JD_MASK			(0x1 << 0)
71062306a36Sopenharmony_ci#define RT5682S_PWR_JD_ENABLE			(0x1 << 0)
71162306a36Sopenharmony_ci#define RT5682S_PWR_JD_DISABLE			(0x0 << 0)
71262306a36Sopenharmony_ci
71362306a36Sopenharmony_ci/* Power Management for Analog 3 (0x0065) */
71462306a36Sopenharmony_ci#define RT5682S_PWR_LDO_PLLA			(0x1 << 15)
71562306a36Sopenharmony_ci#define RT5682S_PWR_LDO_PLLA_BIT		15
71662306a36Sopenharmony_ci#define RT5682S_PWR_LDO_PLLB			(0x1 << 14)
71762306a36Sopenharmony_ci#define RT5682S_PWR_LDO_PLLB_BIT		14
71862306a36Sopenharmony_ci#define RT5682S_PWR_BIAS_PLLA			(0x1 << 13)
71962306a36Sopenharmony_ci#define RT5682S_PWR_BIAS_PLLA_BIT		13
72062306a36Sopenharmony_ci#define RT5682S_PWR_BIAS_PLLB			(0x1 << 12)
72162306a36Sopenharmony_ci#define RT5682S_PWR_BIAS_PLLB_BIT		12
72262306a36Sopenharmony_ci#define RT5682S_PWR_CBJ				(0x1 << 9)
72362306a36Sopenharmony_ci#define RT5682S_PWR_CBJ_BIT			9
72462306a36Sopenharmony_ci#define RT5682S_RSTB_PLLB			(0x1 << 7)
72562306a36Sopenharmony_ci#define RT5682S_RSTB_PLLB_BIT			7
72662306a36Sopenharmony_ci#define RT5682S_RSTB_PLLA			(0x1 << 6)
72762306a36Sopenharmony_ci#define RT5682S_RSTB_PLLA_BIT			6
72862306a36Sopenharmony_ci#define RT5682S_PWR_PLLB			(0x1 << 5)
72962306a36Sopenharmony_ci#define RT5682S_PWR_PLLB_BIT			5
73062306a36Sopenharmony_ci#define RT5682S_PWR_PLLA			(0x1 << 4)
73162306a36Sopenharmony_ci#define RT5682S_PWR_PLLA_BIT			4
73262306a36Sopenharmony_ci#define RT5682S_PWR_LDO_MB2			(0x1 << 2)
73362306a36Sopenharmony_ci#define RT5682S_PWR_LDO_MB2_BIT			2
73462306a36Sopenharmony_ci#define RT5682S_PWR_LDO_MB1			(0x1 << 1)
73562306a36Sopenharmony_ci#define RT5682S_PWR_LDO_MB1_BIT			1
73662306a36Sopenharmony_ci#define RT5682S_PWR_BGLDO			(0x1 << 0)
73762306a36Sopenharmony_ci#define RT5682S_PWR_BGLDO_BIT			0
73862306a36Sopenharmony_ci
73962306a36Sopenharmony_ci/* Power Management for Mixer (0x0066) */
74062306a36Sopenharmony_ci#define RT5682S_PWR_CLK_COMP_8FS		(0x1 << 15)
74162306a36Sopenharmony_ci#define RT5682S_PWR_CLK_COMP_8FS_BIT		15
74262306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_MASK			(0x3 << 12)
74362306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_SFT			12
74462306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_MB1_MASK		(0x3 << 10)
74562306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_MB1_SFT		10
74662306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_MB2_MASK		(0x3 << 8)
74762306a36Sopenharmony_ci#define RT5682S_DBG_BGLDO_MB2_SFT		8
74862306a36Sopenharmony_ci#define RT5682S_DLDO_BGLDO_MASK			(0x3 << 6)
74962306a36Sopenharmony_ci#define RT5682S_DLDO_BGLDO_MB2_SFT		6
75062306a36Sopenharmony_ci#define RT5682S_PWR_STO1_DAC_L			(0x1 << 5)
75162306a36Sopenharmony_ci#define RT5682S_PWR_STO1_DAC_L_BIT		5
75262306a36Sopenharmony_ci#define RT5682S_PWR_STO1_DAC_R			(0x1 << 4)
75362306a36Sopenharmony_ci#define RT5682S_PWR_STO1_DAC_R_BIT		4
75462306a36Sopenharmony_ci#define RT5682S_DVO_BGLDO_MB1_MASK		(0x3 << 2)
75562306a36Sopenharmony_ci#define RT5682S_DVO_BGLDO_MB1_SFT		2
75662306a36Sopenharmony_ci#define RT5682S_DVO_BGLDO_MB2_MASK		(0x3 << 0)
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci/* MCLK and System Clock Detection Control (0x006b) */
75962306a36Sopenharmony_ci#define RT5682S_SYS_CLK_DET			(0x1 << 15)
76062306a36Sopenharmony_ci#define RT5682S_SYS_CLK_DET_SFT			15
76162306a36Sopenharmony_ci#define RT5682S_PLL1_CLK_DET			(0x1 << 14)
76262306a36Sopenharmony_ci#define RT5682S_PLL1_CLK_DET_SFT		14
76362306a36Sopenharmony_ci
76462306a36Sopenharmony_ci/* Digital Microphone Control 1 (0x006e) */
76562306a36Sopenharmony_ci#define RT5682S_DMIC_1_EN_MASK			(0x1 << 15)
76662306a36Sopenharmony_ci#define RT5682S_DMIC_1_EN_SFT			15
76762306a36Sopenharmony_ci#define RT5682S_DMIC_1_DIS			(0x0 << 15)
76862306a36Sopenharmony_ci#define RT5682S_DMIC_1_EN			(0x1 << 15)
76962306a36Sopenharmony_ci#define RT5682S_FIFO_CLK_DIV_MASK		(0x7 << 12)
77062306a36Sopenharmony_ci#define RT5682S_FIFO_CLK_DIV_2			(0x1 << 12)
77162306a36Sopenharmony_ci#define RT5682S_DMIC_1_DP_MASK			(0x3 << 4)
77262306a36Sopenharmony_ci#define RT5682S_DMIC_1_DP_SFT			4
77362306a36Sopenharmony_ci#define RT5682S_DMIC_1_DP_GPIO2			(0x0 << 4)
77462306a36Sopenharmony_ci#define RT5682S_DMIC_1_DP_GPIO5			(0x1 << 4)
77562306a36Sopenharmony_ci#define RT5682S_DMIC_CLK_MASK			(0xf << 0)
77662306a36Sopenharmony_ci#define RT5682S_DMIC_CLK_SFT			0
77762306a36Sopenharmony_ci
77862306a36Sopenharmony_ci/* I2S1 Audio Serial Data Port Control (0x0070) */
77962306a36Sopenharmony_ci#define RT5682S_SEL_ADCDAT_MASK			(0x1 << 15)
78062306a36Sopenharmony_ci#define RT5682S_SEL_ADCDAT_OUT			(0x0 << 15)
78162306a36Sopenharmony_ci#define RT5682S_SEL_ADCDAT_IN			(0x1 << 15)
78262306a36Sopenharmony_ci#define RT5682S_SEL_ADCDAT_SFT			15
78362306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_MASK		(0x7 << 12)
78462306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_SFT			12
78562306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_16			(0x0 << 12)
78662306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_20			(0x1 << 12)
78762306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_24			(0x2 << 12)
78862306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_32			(0x3 << 12)
78962306a36Sopenharmony_ci#define RT5682S_I2S1_TX_CHL_8			(0x4 << 12)
79062306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_MASK		(0x7 << 8)
79162306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_SFT			8
79262306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_16			(0x0 << 8)
79362306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_20			(0x1 << 8)
79462306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_24			(0x2 << 8)
79562306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_32			(0x3 << 8)
79662306a36Sopenharmony_ci#define RT5682S_I2S1_RX_CHL_8			(0x4 << 8)
79762306a36Sopenharmony_ci#define RT5682S_I2S1_MONO_MASK			(0x1 << 7)
79862306a36Sopenharmony_ci#define RT5682S_I2S1_MONO_EN			(0x1 << 7)
79962306a36Sopenharmony_ci#define RT5682S_I2S1_MONO_DIS			(0x0 << 7)
80062306a36Sopenharmony_ci#define RT5682S_I2S1_DL_MASK			(0x7 << 4)
80162306a36Sopenharmony_ci#define RT5682S_I2S1_DL_SFT			4
80262306a36Sopenharmony_ci#define RT5682S_I2S1_DL_16			(0x0 << 4)
80362306a36Sopenharmony_ci#define RT5682S_I2S1_DL_20			(0x1 << 4)
80462306a36Sopenharmony_ci#define RT5682S_I2S1_DL_24			(0x2 << 4)
80562306a36Sopenharmony_ci#define RT5682S_I2S1_DL_32			(0x3 << 4)
80662306a36Sopenharmony_ci#define RT5682S_I2S1_DL_8			(0x4 << 4)
80762306a36Sopenharmony_ci
80862306a36Sopenharmony_ci/* I2S1/2 Audio Serial Data Port Control (0x0071) */
80962306a36Sopenharmony_ci#define RT5682S_I2S2_MS_MASK			(0x1 << 15)
81062306a36Sopenharmony_ci#define RT5682S_I2S2_MS_SFT			15
81162306a36Sopenharmony_ci#define RT5682S_I2S2_MS_M			(0x0 << 15)
81262306a36Sopenharmony_ci#define RT5682S_I2S2_MS_S			(0x1 << 15)
81362306a36Sopenharmony_ci#define RT5682S_I2S2_PIN_CFG_MASK		(0x1 << 14)
81462306a36Sopenharmony_ci#define RT5682S_I2S2_PIN_CFG_SFT		14
81562306a36Sopenharmony_ci#define RT5682S_I2S2_OUT_MASK			(0x1 << 9)
81662306a36Sopenharmony_ci#define RT5682S_I2S2_OUT_SFT			9
81762306a36Sopenharmony_ci#define RT5682S_I2S2_OUT_UM			(0x0 << 9)
81862306a36Sopenharmony_ci#define RT5682S_I2S2_OUT_M			(0x1 << 9)
81962306a36Sopenharmony_ci#define RT5682S_I2S_BP_MASK			(0x1 << 8)
82062306a36Sopenharmony_ci#define RT5682S_I2S_BP_SFT			8
82162306a36Sopenharmony_ci#define RT5682S_I2S_BP_NOR			(0x0 << 8)
82262306a36Sopenharmony_ci#define RT5682S_I2S_BP_INV			(0x1 << 8)
82362306a36Sopenharmony_ci#define RT5682S_I2S2_MONO_MASK			(0x1 << 7)
82462306a36Sopenharmony_ci#define RT5682S_I2S2_MONO_EN			(0x1 << 7)
82562306a36Sopenharmony_ci#define RT5682S_I2S2_MONO_DIS			(0x0 << 7)
82662306a36Sopenharmony_ci#define RT5682S_I2S2_DL_MASK			(0x7 << 4)
82762306a36Sopenharmony_ci#define RT5682S_I2S2_DL_SFT			4
82862306a36Sopenharmony_ci#define RT5682S_I2S2_DL_8			(0x0 << 4)
82962306a36Sopenharmony_ci#define RT5682S_I2S2_DL_16			(0x1 << 4)
83062306a36Sopenharmony_ci#define RT5682S_I2S2_DL_20			(0x2 << 4)
83162306a36Sopenharmony_ci#define RT5682S_I2S2_DL_24			(0x3 << 4)
83262306a36Sopenharmony_ci#define RT5682S_I2S2_DL_32			(0x4 << 4)
83362306a36Sopenharmony_ci#define RT5682S_I2S_DF_MASK			(0x7)
83462306a36Sopenharmony_ci#define RT5682S_I2S_DF_SFT			0
83562306a36Sopenharmony_ci#define RT5682S_I2S_DF_I2S			(0x0)
83662306a36Sopenharmony_ci#define RT5682S_I2S_DF_LEFT			(0x1)
83762306a36Sopenharmony_ci#define RT5682S_I2S_DF_PCM_A			(0x2)
83862306a36Sopenharmony_ci#define RT5682S_I2S_DF_PCM_B			(0x3)
83962306a36Sopenharmony_ci#define RT5682S_I2S_DF_PCM_A_N			(0x6)
84062306a36Sopenharmony_ci#define RT5682S_I2S_DF_PCM_B_N			(0x7)
84162306a36Sopenharmony_ci
84262306a36Sopenharmony_ci/* ADC/DAC Clock Control 1 (0x0073) */
84362306a36Sopenharmony_ci#define RT5682S_ADC_OSR_MASK			(0xf << 12)
84462306a36Sopenharmony_ci#define RT5682S_ADC_OSR_SFT			12
84562306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_1			(0x0 << 12)
84662306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_2			(0x1 << 12)
84762306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_4			(0x2 << 12)
84862306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_6			(0x3 << 12)
84962306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_8			(0x4 << 12)
85062306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_12			(0x5 << 12)
85162306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_16			(0x6 << 12)
85262306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_24			(0x7 << 12)
85362306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_32			(0x8 << 12)
85462306a36Sopenharmony_ci#define RT5682S_ADC_OSR_D_48			(0x9 << 12)
85562306a36Sopenharmony_ci#define RT5682S_I2S_M_D_MASK			(0xf << 8)
85662306a36Sopenharmony_ci#define RT5682S_I2S_M_D_SFT			8
85762306a36Sopenharmony_ci#define RT5682S_I2S_M_D_1			(0x0 << 8)
85862306a36Sopenharmony_ci#define RT5682S_I2S_M_D_2			(0x1 << 8)
85962306a36Sopenharmony_ci#define RT5682S_I2S_M_D_3			(0x2 << 8)
86062306a36Sopenharmony_ci#define RT5682S_I2S_M_D_4			(0x3 << 8)
86162306a36Sopenharmony_ci#define RT5682S_I2S_M_D_6			(0x4 << 8)
86262306a36Sopenharmony_ci#define RT5682S_I2S_M_D_8			(0x5 << 8)
86362306a36Sopenharmony_ci#define RT5682S_I2S_M_D_12			(0x6 << 8)
86462306a36Sopenharmony_ci#define RT5682S_I2S_M_D_16			(0x7 << 8)
86562306a36Sopenharmony_ci#define RT5682S_I2S_M_D_24			(0x8 << 8)
86662306a36Sopenharmony_ci#define RT5682S_I2S_M_D_32			(0x9 << 8)
86762306a36Sopenharmony_ci#define RT5682S_I2S_M_D_48			(0x10 << 8)
86862306a36Sopenharmony_ci#define RT5682S_I2S_M_CLK_SRC_MASK		(0x7 << 4)
86962306a36Sopenharmony_ci#define RT5682S_I2S_M_CLK_SRC_SFT		4
87062306a36Sopenharmony_ci#define RT5682S_DAC_OSR_MASK			(0xf << 0)
87162306a36Sopenharmony_ci#define RT5682S_DAC_OSR_SFT			0
87262306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_1			(0x0 << 0)
87362306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_2			(0x1 << 0)
87462306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_4			(0x2 << 0)
87562306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_6			(0x3 << 0)
87662306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_8			(0x4 << 0)
87762306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_12			(0x5 << 0)
87862306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_16			(0x6 << 0)
87962306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_24			(0x7 << 0)
88062306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_32			(0x8 << 0)
88162306a36Sopenharmony_ci#define RT5682S_DAC_OSR_D_48			(0x9 << 0)
88262306a36Sopenharmony_ci
88362306a36Sopenharmony_ci/* ADC/DAC Clock Control 2 (0x0074) */
88462306a36Sopenharmony_ci#define RT5682S_I2S2_BCLK_MS2_MASK		(0x1 << 11)
88562306a36Sopenharmony_ci#define RT5682S_I2S2_BCLK_MS2_SFT		11
88662306a36Sopenharmony_ci#define RT5682S_I2S2_BCLK_MS2_32		(0x0 << 11)
88762306a36Sopenharmony_ci#define RT5682S_I2S2_BCLK_MS2_64		(0x1 << 11)
88862306a36Sopenharmony_ci
88962306a36Sopenharmony_ci
89062306a36Sopenharmony_ci/* TDM control 1 (0x0079) */
89162306a36Sopenharmony_ci#define RT5682S_TDM_TX_CH_MASK			(0x3 << 12)
89262306a36Sopenharmony_ci#define RT5682S_TDM_TX_CH_2			(0x0 << 12)
89362306a36Sopenharmony_ci#define RT5682S_TDM_TX_CH_4			(0x1 << 12)
89462306a36Sopenharmony_ci#define RT5682S_TDM_TX_CH_6			(0x2 << 12)
89562306a36Sopenharmony_ci#define RT5682S_TDM_TX_CH_8			(0x3 << 12)
89662306a36Sopenharmony_ci#define RT5682S_TDM_RX_CH_MASK			(0x3 << 8)
89762306a36Sopenharmony_ci#define RT5682S_TDM_RX_CH_2			(0x0 << 8)
89862306a36Sopenharmony_ci#define RT5682S_TDM_RX_CH_4			(0x1 << 8)
89962306a36Sopenharmony_ci#define RT5682S_TDM_RX_CH_6			(0x2 << 8)
90062306a36Sopenharmony_ci#define RT5682S_TDM_RX_CH_8			(0x3 << 8)
90162306a36Sopenharmony_ci#define RT5682S_TDM_ADC_LCA_MASK		(0x7 << 4)
90262306a36Sopenharmony_ci#define RT5682S_TDM_ADC_LCA_SFT			4
90362306a36Sopenharmony_ci#define RT5682S_TDM_ADC_DL_MASK			(0x3 << 0)
90462306a36Sopenharmony_ci#define RT5682S_TDM_ADC_DL_SFT			0
90562306a36Sopenharmony_ci
90662306a36Sopenharmony_ci/* TDM control 2 (0x007a) */
90762306a36Sopenharmony_ci#define RT5682S_IF1_ADC1_SEL_SFT		14
90862306a36Sopenharmony_ci#define RT5682S_IF1_ADC2_SEL_SFT		12
90962306a36Sopenharmony_ci#define RT5682S_IF1_ADC3_SEL_SFT		10
91062306a36Sopenharmony_ci#define RT5682S_IF1_ADC4_SEL_SFT		8
91162306a36Sopenharmony_ci#define RT5682S_TDM_ADC_SEL_SFT			3
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_ci/* TDM control 3 (0x007b) */
91462306a36Sopenharmony_ci#define RT5682S_TDM_EN				(0x1 << 7)
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci/* TDM/I2S control (0x007e) */
91762306a36Sopenharmony_ci#define RT5682S_TDM_S_BP_MASK			(0x1 << 15)
91862306a36Sopenharmony_ci#define RT5682S_TDM_S_BP_SFT			15
91962306a36Sopenharmony_ci#define RT5682S_TDM_S_BP_NOR			(0x0 << 15)
92062306a36Sopenharmony_ci#define RT5682S_TDM_S_BP_INV			(0x1 << 15)
92162306a36Sopenharmony_ci#define RT5682S_TDM_S_LP_MASK			(0x1 << 14)
92262306a36Sopenharmony_ci#define RT5682S_TDM_S_LP_SFT			14
92362306a36Sopenharmony_ci#define RT5682S_TDM_S_LP_NOR			(0x0 << 14)
92462306a36Sopenharmony_ci#define RT5682S_TDM_S_LP_INV			(0x1 << 14)
92562306a36Sopenharmony_ci#define RT5682S_TDM_DF_MASK			(0x7 << 11)
92662306a36Sopenharmony_ci#define RT5682S_TDM_DF_SFT			11
92762306a36Sopenharmony_ci#define RT5682S_TDM_DF_I2S			(0x0 << 11)
92862306a36Sopenharmony_ci#define RT5682S_TDM_DF_LEFT			(0x1 << 11)
92962306a36Sopenharmony_ci#define RT5682S_TDM_DF_PCM_A			(0x2 << 11)
93062306a36Sopenharmony_ci#define RT5682S_TDM_DF_PCM_B			(0x3 << 11)
93162306a36Sopenharmony_ci#define RT5682S_TDM_DF_PCM_A_N			(0x6 << 11)
93262306a36Sopenharmony_ci#define RT5682S_TDM_DF_PCM_B_N			(0x7 << 11)
93362306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_MASK		(0x3 << 8)
93462306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_SFT		8
93562306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_32			(0x0 << 8)
93662306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_64			(0x1 << 8)
93762306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_128		(0x2 << 8)
93862306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_256		(0x3 << 8)
93962306a36Sopenharmony_ci#define RT5682S_TDM_BCLK_MS1_16			(0x4 << 8)
94062306a36Sopenharmony_ci#define RT5682S_TDM_CL_MASK			(0x3 << 4)
94162306a36Sopenharmony_ci#define RT5682S_TDM_CL_16			(0x0 << 4)
94262306a36Sopenharmony_ci#define RT5682S_TDM_CL_20			(0x1 << 4)
94362306a36Sopenharmony_ci#define RT5682S_TDM_CL_24			(0x2 << 4)
94462306a36Sopenharmony_ci#define RT5682S_TDM_CL_32			(0x3 << 4)
94562306a36Sopenharmony_ci#define RT5682S_TDM_M_BP_MASK			(0x1 << 2)
94662306a36Sopenharmony_ci#define RT5682S_TDM_M_BP_SFT			2
94762306a36Sopenharmony_ci#define RT5682S_TDM_M_BP_NOR			(0x0 << 2)
94862306a36Sopenharmony_ci#define RT5682S_TDM_M_BP_INV			(0x1 << 2)
94962306a36Sopenharmony_ci#define RT5682S_TDM_M_LP_MASK			(0x1 << 1)
95062306a36Sopenharmony_ci#define RT5682S_TDM_M_LP_SFT			1
95162306a36Sopenharmony_ci#define RT5682S_TDM_M_LP_NOR			(0x0 << 1)
95262306a36Sopenharmony_ci#define RT5682S_TDM_M_LP_INV			(0x1 << 1)
95362306a36Sopenharmony_ci#define RT5682S_TDM_MS_MASK			(0x1 << 0)
95462306a36Sopenharmony_ci#define RT5682S_TDM_MS_SFT			0
95562306a36Sopenharmony_ci#define RT5682S_TDM_MS_S			(0x0 << 0)
95662306a36Sopenharmony_ci#define RT5682S_TDM_MS_M			(0x1 << 0)
95762306a36Sopenharmony_ci
95862306a36Sopenharmony_ci/* Global Clock Control (0x0080) */
95962306a36Sopenharmony_ci#define RT5682S_SCLK_SRC_MASK			(0x7 << 13)
96062306a36Sopenharmony_ci#define RT5682S_SCLK_SRC_SFT			13
96162306a36Sopenharmony_ci#define RT5682S_PLL_SRC_MASK			(0x3 << 8)
96262306a36Sopenharmony_ci#define RT5682S_PLL_SRC_SFT			8
96362306a36Sopenharmony_ci#define RT5682S_PLL_SRC_MCLK			(0x0 << 8)
96462306a36Sopenharmony_ci#define RT5682S_PLL_SRC_BCLK1			(0x1 << 8)
96562306a36Sopenharmony_ci#define RT5682S_PLL_SRC_RC			(0x3 << 8)
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_ci/* PLL tracking mode 1 (0x0083) */
96862306a36Sopenharmony_ci#define RT5682S_DA_ASRC_MASK			(0x1 << 13)
96962306a36Sopenharmony_ci#define RT5682S_DA_ASRC_SFT			13
97062306a36Sopenharmony_ci#define RT5682S_DAC_STO1_ASRC_MASK		(0x1 << 12)
97162306a36Sopenharmony_ci#define RT5682S_DAC_STO1_ASRC_SFT		12
97262306a36Sopenharmony_ci#define RT5682S_AD_ASRC_MASK			(0x1 << 8)
97362306a36Sopenharmony_ci#define RT5682S_AD_ASRC_SFT			8
97462306a36Sopenharmony_ci#define RT5682S_AD_ASRC_SEL_MASK		(0x1 << 4)
97562306a36Sopenharmony_ci#define RT5682S_AD_ASRC_SEL_SFT			4
97662306a36Sopenharmony_ci#define RT5682S_DMIC_ASRC_MASK			(0x1 << 3)
97762306a36Sopenharmony_ci#define RT5682S_DMIC_ASRC_SFT			3
97862306a36Sopenharmony_ci#define RT5682S_ADC_STO1_ASRC_MASK		(0x1 << 2)
97962306a36Sopenharmony_ci#define RT5682S_ADC_STO1_ASRC_SFT		2
98062306a36Sopenharmony_ci#define RT5682S_DA_ASRC_SEL_MASK		(0x1 << 0)
98162306a36Sopenharmony_ci#define RT5682S_DA_ASRC_SEL_SFT			0
98262306a36Sopenharmony_ci
98362306a36Sopenharmony_ci/* PLL tracking mode 2 3 (0x0084)(0x0085)*/
98462306a36Sopenharmony_ci#define RT5682S_FILTER_CLK_SEL_MASK		(0x7 << 12)
98562306a36Sopenharmony_ci#define RT5682S_FILTER_CLK_SEL_SFT		12
98662306a36Sopenharmony_ci#define RT5682S_FILTER_CLK_DIV_MASK		(0xf << 8)
98762306a36Sopenharmony_ci#define RT5682S_FILTER_CLK_DIV_SFT		8
98862306a36Sopenharmony_ci
98962306a36Sopenharmony_ci/* ASRC Control 4 (0x0086) */
99062306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_N1_MASK		(0x3 << 14)
99162306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_N1_SFT		14
99262306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_N2_MASK		(0x3 << 12)
99362306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_N2_SFT		12
99462306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_M1_MASK		(0x7 << 8)
99562306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_M1_SFT		8
99662306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_M2_MASK		(0x7 << 4)
99762306a36Sopenharmony_ci#define RT5682S_ASRCIN_FTK_M2_SFT		4
99862306a36Sopenharmony_ci
99962306a36Sopenharmony_ci/* ASRC Control 11 (0x008c) */
100062306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_CLKOUT_MASK		(0x1 << 5)
100162306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_CLKOUT_EN		(0x1 << 5)
100262306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_CLKOUT_DIS		(0x0 << 5)
100362306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_RST_MASK		(0x1 << 4)
100462306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_RST_EN		(0x1 << 4)
100562306a36Sopenharmony_ci#define RT5682S_ASRCIN_AUTO_RST_DIS		(0x0 << 4)
100662306a36Sopenharmony_ci#define RT5682S_SEL_LRCK_DET_MASK		(0x3)
100762306a36Sopenharmony_ci#define RT5682S_SEL_LRCK_DET_DIV8		(0x3)
100862306a36Sopenharmony_ci#define RT5682S_SEL_LRCK_DET_DIV4		(0x2)
100962306a36Sopenharmony_ci#define RT5682S_SEL_LRCK_DET_DIV2		(0x1)
101062306a36Sopenharmony_ci#define RT5682S_SEL_LRCK_DET_DIV1		(0x0)
101162306a36Sopenharmony_ci
101262306a36Sopenharmony_ci/* Depop Mode Control 1 (0x008e) */
101362306a36Sopenharmony_ci#define RT5682S_OUT_HP_L_EN			(0x1 << 6)
101462306a36Sopenharmony_ci#define RT5682S_OUT_HP_R_EN			(0x1 << 5)
101562306a36Sopenharmony_ci#define RT5682S_LDO_PUMP_EN			(0x1 << 4)
101662306a36Sopenharmony_ci#define RT5682S_LDO_PUMP_EN_SFT			4
101762306a36Sopenharmony_ci#define RT5682S_PUMP_EN				(0x1 << 3)
101862306a36Sopenharmony_ci#define RT5682S_PUMP_EN_SFT			3
101962306a36Sopenharmony_ci#define RT5682S_CAPLESS_L_EN			(0x1 << 1)
102062306a36Sopenharmony_ci#define RT5682S_CAPLESS_L_EN_SFT		1
102162306a36Sopenharmony_ci#define RT5682S_CAPLESS_R_EN			(0x1 << 0)
102262306a36Sopenharmony_ci#define RT5682S_CAPLESS_R_EN_SFT		0
102362306a36Sopenharmony_ci
102462306a36Sopenharmony_ci/* Depop Mode Control 2 (0x8f) */
102562306a36Sopenharmony_ci#define RT5682S_RAMP_MASK			(0x1 << 12)
102662306a36Sopenharmony_ci#define RT5682S_RAMP_SFT			12
102762306a36Sopenharmony_ci#define RT5682S_RAMP_DIS			(0x0 << 12)
102862306a36Sopenharmony_ci#define RT5682S_RAMP_EN				(0x1 << 12)
102962306a36Sopenharmony_ci#define RT5682S_BPS_MASK			(0x1 << 11)
103062306a36Sopenharmony_ci#define RT5682S_BPS_SFT				11
103162306a36Sopenharmony_ci#define RT5682S_BPS_DIS				(0x0 << 11)
103262306a36Sopenharmony_ci#define RT5682S_BPS_EN				(0x1 << 11)
103362306a36Sopenharmony_ci#define RT5682S_FAST_UPDN_MASK			(0x1 << 10)
103462306a36Sopenharmony_ci#define RT5682S_FAST_UPDN_SFT			10
103562306a36Sopenharmony_ci#define RT5682S_FAST_UPDN_DIS			(0x0 << 10)
103662306a36Sopenharmony_ci#define RT5682S_FAST_UPDN_EN			(0x1 << 10)
103762306a36Sopenharmony_ci#define RT5682S_VLO_MASK			(0x1 << 7)
103862306a36Sopenharmony_ci#define RT5682S_VLO_SFT				7
103962306a36Sopenharmony_ci#define RT5682S_VLO_3V				(0x0 << 7)
104062306a36Sopenharmony_ci#define RT5682S_VLO_33V				(0x1 << 7)
104162306a36Sopenharmony_ci
104262306a36Sopenharmony_ci/* HPOUT charge pump 1 (0x0091) */
104362306a36Sopenharmony_ci#define RT5682S_OSW_L_MASK			(0x1 << 11)
104462306a36Sopenharmony_ci#define RT5682S_OSW_L_SFT			11
104562306a36Sopenharmony_ci#define RT5682S_OSW_L_DIS			(0x0 << 11)
104662306a36Sopenharmony_ci#define RT5682S_OSW_L_EN			(0x1 << 11)
104762306a36Sopenharmony_ci#define RT5682S_OSW_R_MASK			(0x1 << 10)
104862306a36Sopenharmony_ci#define RT5682S_OSW_R_SFT			10
104962306a36Sopenharmony_ci#define RT5682S_OSW_R_DIS			(0x0 << 10)
105062306a36Sopenharmony_ci#define RT5682S_OSW_R_EN			(0x1 << 10)
105162306a36Sopenharmony_ci#define RT5682S_PM_HP_MASK			(0x3 << 8)
105262306a36Sopenharmony_ci#define RT5682S_PM_HP_SFT			8
105362306a36Sopenharmony_ci#define RT5682S_PM_HP_LV			(0x0 << 8)
105462306a36Sopenharmony_ci#define RT5682S_PM_HP_MV			(0x1 << 8)
105562306a36Sopenharmony_ci#define RT5682S_PM_HP_HV			(0x2 << 8)
105662306a36Sopenharmony_ci
105762306a36Sopenharmony_ci/* Micbias Control1 (0x93) */
105862306a36Sopenharmony_ci#define RT5682S_MIC1_OV_MASK			(0x3 << 14)
105962306a36Sopenharmony_ci#define RT5682S_MIC1_OV_SFT			14
106062306a36Sopenharmony_ci#define RT5682S_MIC1_OV_2V7			(0x0 << 14)
106162306a36Sopenharmony_ci#define RT5682S_MIC1_OV_2V4			(0x1 << 14)
106262306a36Sopenharmony_ci#define RT5682S_MIC1_OV_2V25			(0x3 << 14)
106362306a36Sopenharmony_ci#define RT5682S_MIC1_OV_1V8			(0x4 << 14)
106462306a36Sopenharmony_ci#define RT5682S_MIC2_OV_MASK			(0x3 << 8)
106562306a36Sopenharmony_ci#define RT5682S_MIC2_OV_SFT			8
106662306a36Sopenharmony_ci#define RT5682S_MIC2_OV_2V7			(0x0 << 8)
106762306a36Sopenharmony_ci#define RT5682S_MIC2_OV_2V4			(0x1 << 8)
106862306a36Sopenharmony_ci#define RT5682S_MIC2_OV_2V25			(0x3 << 8)
106962306a36Sopenharmony_ci#define RT5682S_MIC2_OV_1V8			(0x4 << 8)
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_ci/* Micbias Control2 (0x0094) */
107262306a36Sopenharmony_ci#define RT5682S_PWR_CLK25M_MASK			(0x1 << 9)
107362306a36Sopenharmony_ci#define RT5682S_PWR_CLK25M_SFT			9
107462306a36Sopenharmony_ci#define RT5682S_PWR_CLK25M_PD			(0x0 << 9)
107562306a36Sopenharmony_ci#define RT5682S_PWR_CLK25M_PU			(0x1 << 9)
107662306a36Sopenharmony_ci#define RT5682S_PWR_CLK1M_MASK			(0x1 << 8)
107762306a36Sopenharmony_ci#define RT5682S_PWR_CLK1M_SFT			8
107862306a36Sopenharmony_ci#define RT5682S_PWR_CLK1M_PD			(0x0 << 8)
107962306a36Sopenharmony_ci#define RT5682S_PWR_CLK1M_PU			(0x1 << 8)
108062306a36Sopenharmony_ci
108162306a36Sopenharmony_ci/* PLL M/N/K Code Control 1 (0x0098) */
108262306a36Sopenharmony_ci#define RT5682S_PLLA_N_MASK			(0x1ff << 0)
108362306a36Sopenharmony_ci
108462306a36Sopenharmony_ci/* PLL M/N/K Code Control 2 (0x0099) */
108562306a36Sopenharmony_ci#define RT5682S_PLLA_M_MASK			(0x1f << 8)
108662306a36Sopenharmony_ci#define RT5682S_PLLA_M_SFT			8
108762306a36Sopenharmony_ci#define RT5682S_PLLA_K_MASK			(0x1f << 0)
108862306a36Sopenharmony_ci
108962306a36Sopenharmony_ci/* PLL M/N/K Code Control 3 (0x009a) */
109062306a36Sopenharmony_ci#define RT5682S_PLLB_N_MASK			(0x3ff << 0)
109162306a36Sopenharmony_ci
109262306a36Sopenharmony_ci/* PLL M/N/K Code Control 4 (0x009b) */
109362306a36Sopenharmony_ci#define RT5682S_PLLB_M_MASK			(0x1f << 8)
109462306a36Sopenharmony_ci#define RT5682S_PLLB_M_SFT			8
109562306a36Sopenharmony_ci#define RT5682S_PLLB_K_MASK			(0x1f << 0)
109662306a36Sopenharmony_ci
109762306a36Sopenharmony_ci/* PLL M/N/K Code Control 6 (0x009d) */
109862306a36Sopenharmony_ci#define RT5682S_PLLB_SEL_PS_MASK		(0x1 << 13)
109962306a36Sopenharmony_ci#define RT5682S_PLLB_SEL_PS_SFT			13
110062306a36Sopenharmony_ci#define RT5682S_PLLB_BYP_PS_MASK		(0x1 << 12)
110162306a36Sopenharmony_ci#define RT5682S_PLLB_BYP_PS_SFT			12
110262306a36Sopenharmony_ci#define RT5682S_PLLB_M_BP_MASK			(0x1 << 11)
110362306a36Sopenharmony_ci#define RT5682S_PLLB_M_BP_SFT			11
110462306a36Sopenharmony_ci#define RT5682S_PLLB_K_BP_MASK			(0x1 << 10)
110562306a36Sopenharmony_ci#define RT5682S_PLLB_K_BP_SFT			10
110662306a36Sopenharmony_ci#define RT5682S_PLLA_M_BP_MASK			(0x1 << 7)
110762306a36Sopenharmony_ci#define RT5682S_PLLA_M_BP_SFT			7
110862306a36Sopenharmony_ci#define RT5682S_PLLA_K_BP_MASK			(0x1 << 6)
110962306a36Sopenharmony_ci#define RT5682S_PLLA_K_BP_SFT			6
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_ci/* PLL M/N/K Code Control 7 (0x009e) */
111262306a36Sopenharmony_ci#define RT5682S_PLLB_SRC_MASK			(0x1)
111362306a36Sopenharmony_ci#define RT5682S_PLLB_SRC_DFIN			(0x1)
111462306a36Sopenharmony_ci#define RT5682S_PLLB_SRC_PLLA			(0x0)
111562306a36Sopenharmony_ci
111662306a36Sopenharmony_ci/* RC Clock Control (0x009f) */
111762306a36Sopenharmony_ci#define RT5682S_POW_IRQ				(0x1 << 15)
111862306a36Sopenharmony_ci#define RT5682S_POW_JDH				(0x1 << 14)
111962306a36Sopenharmony_ci
112062306a36Sopenharmony_ci/* I2S2 Master Mode Clock Control 1 (0x00a0) */
112162306a36Sopenharmony_ci#define RT5682S_I2S2_M_CLK_SRC_MASK		(0x7 << 4)
112262306a36Sopenharmony_ci#define RT5682S_I2S2_M_CLK_SRC_SFT		4
112362306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_MASK			(0xf << 0)
112462306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_1			(0x0)
112562306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_2			(0x1)
112662306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_3			(0x2)
112762306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_4			(0x3)
112862306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_6			(0x4)
112962306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_8			(0x5)
113062306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_12			(0x6)
113162306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_16			(0x7)
113262306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_24			(0x8)
113362306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_32			(0x9)
113462306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_48			(0xa)
113562306a36Sopenharmony_ci#define RT5682S_I2S2_M_D_SFT			0
113662306a36Sopenharmony_ci
113762306a36Sopenharmony_ci/* IRQ Control 1 (0x00b6) */
113862306a36Sopenharmony_ci#define RT5682S_JD1_PULSE_EN_MASK		(0x1 << 10)
113962306a36Sopenharmony_ci#define RT5682S_JD1_PULSE_EN_SFT		10
114062306a36Sopenharmony_ci#define RT5682S_JD1_PULSE_DIS			(0x0 << 10)
114162306a36Sopenharmony_ci#define RT5682S_JD1_PULSE_EN			(0x1 << 10)
114262306a36Sopenharmony_ci
114362306a36Sopenharmony_ci/* IRQ Control 2 (0x00b7) */
114462306a36Sopenharmony_ci#define RT5682S_JD1_EN_MASK			(0x1 << 15)
114562306a36Sopenharmony_ci#define RT5682S_JD1_EN_SFT			15
114662306a36Sopenharmony_ci#define RT5682S_JD1_DIS				(0x0 << 15)
114762306a36Sopenharmony_ci#define RT5682S_JD1_EN				(0x1 << 15)
114862306a36Sopenharmony_ci#define RT5682S_JD1_POL_MASK			(0x1 << 13)
114962306a36Sopenharmony_ci#define RT5682S_JD1_POL_NOR			(0x0 << 13)
115062306a36Sopenharmony_ci#define RT5682S_JD1_POL_INV			(0x1 << 13)
115162306a36Sopenharmony_ci#define RT5682S_JD1_IRQ_MASK			(0x1 << 10)
115262306a36Sopenharmony_ci#define RT5682S_JD1_IRQ_LEV			(0x0 << 10)
115362306a36Sopenharmony_ci#define RT5682S_JD1_IRQ_PUL			(0x1 << 10)
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_ci/* IRQ Control 3 (0x00b8) */
115662306a36Sopenharmony_ci#define RT5682S_IL_IRQ_MASK			(0x1 << 7)
115762306a36Sopenharmony_ci#define RT5682S_IL_IRQ_DIS			(0x0 << 7)
115862306a36Sopenharmony_ci#define RT5682S_IL_IRQ_EN			(0x1 << 7)
115962306a36Sopenharmony_ci#define RT5682S_IL_IRQ_TYPE_MASK		(0x1 << 4)
116062306a36Sopenharmony_ci#define RT5682S_IL_IRQ_LEV			(0x0 << 4)
116162306a36Sopenharmony_ci#define RT5682S_IL_IRQ_PUL			(0x1 << 4)
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci/* GPIO Control 1 (0x00c0) */
116462306a36Sopenharmony_ci#define RT5682S_GP1_PIN_MASK			(0x3 << 14)
116562306a36Sopenharmony_ci#define RT5682S_GP1_PIN_SFT			14
116662306a36Sopenharmony_ci#define RT5682S_GP1_PIN_GPIO1			(0x0 << 14)
116762306a36Sopenharmony_ci#define RT5682S_GP1_PIN_IRQ			(0x1 << 14)
116862306a36Sopenharmony_ci#define RT5682S_GP1_PIN_DMIC_CLK		(0x2 << 14)
116962306a36Sopenharmony_ci#define RT5682S_GP2_PIN_MASK			(0x3 << 12)
117062306a36Sopenharmony_ci#define RT5682S_GP2_PIN_SFT			12
117162306a36Sopenharmony_ci#define RT5682S_GP2_PIN_GPIO2			(0x0 << 12)
117262306a36Sopenharmony_ci#define RT5682S_GP2_PIN_LRCK2			(0x1 << 12)
117362306a36Sopenharmony_ci#define RT5682S_GP2_PIN_DMIC_SDA		(0x2 << 12)
117462306a36Sopenharmony_ci#define RT5682S_GP3_PIN_MASK			(0x3 << 10)
117562306a36Sopenharmony_ci#define RT5682S_GP3_PIN_SFT			10
117662306a36Sopenharmony_ci#define RT5682S_GP3_PIN_GPIO3			(0x0 << 10)
117762306a36Sopenharmony_ci#define RT5682S_GP3_PIN_BCLK2			(0x1 << 10)
117862306a36Sopenharmony_ci#define RT5682S_GP3_PIN_DMIC_CLK		(0x2 << 10)
117962306a36Sopenharmony_ci#define RT5682S_GP4_PIN_MASK			(0x3 << 8)
118062306a36Sopenharmony_ci#define RT5682S_GP4_PIN_SFT			8
118162306a36Sopenharmony_ci#define RT5682S_GP4_PIN_GPIO4			(0x0 << 8)
118262306a36Sopenharmony_ci#define RT5682S_GP4_PIN_ADCDAT1			(0x1 << 8)
118362306a36Sopenharmony_ci#define RT5682S_GP4_PIN_DMIC_CLK		(0x2 << 8)
118462306a36Sopenharmony_ci#define RT5682S_GP4_PIN_ADCDAT2			(0x3 << 8)
118562306a36Sopenharmony_ci#define RT5682S_GP5_PIN_MASK			(0x3 << 6)
118662306a36Sopenharmony_ci#define RT5682S_GP5_PIN_SFT			6
118762306a36Sopenharmony_ci#define RT5682S_GP5_PIN_GPIO5			(0x0 << 6)
118862306a36Sopenharmony_ci#define RT5682S_GP5_PIN_DACDAT1			(0x1 << 6)
118962306a36Sopenharmony_ci#define RT5682S_GP5_PIN_DMIC_SDA		(0x2 << 6)
119062306a36Sopenharmony_ci#define RT5682S_GP6_PIN_MASK			(0x1 << 5)
119162306a36Sopenharmony_ci#define RT5682S_GP6_PIN_SFT			5
119262306a36Sopenharmony_ci#define RT5682S_GP6_PIN_GPIO6			(0x0 << 5)
119362306a36Sopenharmony_ci#define RT5682S_GP6_PIN_LRCK1			(0x1 << 5)
119462306a36Sopenharmony_ci
119562306a36Sopenharmony_ci/* GPIO Control 2 (0x00c1)*/
119662306a36Sopenharmony_ci#define RT5682S_GP1_PF_MASK			(0x1 << 15)
119762306a36Sopenharmony_ci#define RT5682S_GP1_PF_IN			(0x0 << 15)
119862306a36Sopenharmony_ci#define RT5682S_GP1_PF_OUT			(0x1 << 15)
119962306a36Sopenharmony_ci#define RT5682S_GP1_OUT_MASK			(0x1 << 14)
120062306a36Sopenharmony_ci#define RT5682S_GP1_OUT_L			(0x0 << 14)
120162306a36Sopenharmony_ci#define RT5682S_GP1_OUT_H			(0x1 << 14)
120262306a36Sopenharmony_ci#define RT5682S_GP2_PF_MASK			(0x1 << 13)
120362306a36Sopenharmony_ci#define RT5682S_GP2_PF_IN			(0x0 << 13)
120462306a36Sopenharmony_ci#define RT5682S_GP2_PF_OUT			(0x1 << 13)
120562306a36Sopenharmony_ci#define RT5682S_GP2_OUT_MASK			(0x1 << 12)
120662306a36Sopenharmony_ci#define RT5682S_GP2_OUT_L			(0x0 << 12)
120762306a36Sopenharmony_ci#define RT5682S_GP2_OUT_H			(0x1 << 12)
120862306a36Sopenharmony_ci#define RT5682S_GP3_PF_MASK			(0x1 << 11)
120962306a36Sopenharmony_ci#define RT5682S_GP3_PF_IN			(0x0 << 11)
121062306a36Sopenharmony_ci#define RT5682S_GP3_PF_OUT			(0x1 << 11)
121162306a36Sopenharmony_ci#define RT5682S_GP3_OUT_MASK			(0x1 << 10)
121262306a36Sopenharmony_ci#define RT5682S_GP3_OUT_L			(0x0 << 10)
121362306a36Sopenharmony_ci#define RT5682S_GP3_OUT_H			(0x1 << 10)
121462306a36Sopenharmony_ci#define RT5682S_GP4_PF_MASK			(0x1 << 9)
121562306a36Sopenharmony_ci#define RT5682S_GP4_PF_IN			(0x0 << 9)
121662306a36Sopenharmony_ci#define RT5682S_GP4_PF_OUT			(0x1 << 9)
121762306a36Sopenharmony_ci#define RT5682S_GP4_OUT_MASK			(0x1 << 8)
121862306a36Sopenharmony_ci#define RT5682S_GP4_OUT_L			(0x0 << 8)
121962306a36Sopenharmony_ci#define RT5682S_GP4_OUT_H			(0x1 << 8)
122062306a36Sopenharmony_ci#define RT5682S_GP5_PF_MASK			(0x1 << 7)
122162306a36Sopenharmony_ci#define RT5682S_GP5_PF_IN			(0x0 << 7)
122262306a36Sopenharmony_ci#define RT5682S_GP5_PF_OUT			(0x1 << 7)
122362306a36Sopenharmony_ci#define RT5682S_GP5_OUT_MASK			(0x1 << 6)
122462306a36Sopenharmony_ci#define RT5682S_GP5_OUT_L			(0x0 << 6)
122562306a36Sopenharmony_ci#define RT5682S_GP5_OUT_H			(0x1 << 6)
122662306a36Sopenharmony_ci#define RT5682S_GP6_PF_MASK			(0x1 << 5)
122762306a36Sopenharmony_ci#define RT5682S_GP6_PF_IN			(0x0 << 5)
122862306a36Sopenharmony_ci#define RT5682S_GP6_PF_OUT			(0x1 << 5)
122962306a36Sopenharmony_ci#define RT5682S_GP6_OUT_MASK			(0x1 << 4)
123062306a36Sopenharmony_ci#define RT5682S_GP6_OUT_L			(0x0 << 4)
123162306a36Sopenharmony_ci#define RT5682S_GP6_OUT_H			(0x1 << 4)
123262306a36Sopenharmony_ci
123362306a36Sopenharmony_ci/* GPIO Status (0x00c2) */
123462306a36Sopenharmony_ci#define RT5682S_GP6_ST				(0x1 << 6)
123562306a36Sopenharmony_ci#define RT5682S_GP5_ST				(0x1 << 5)
123662306a36Sopenharmony_ci#define RT5682S_GP4_ST				(0x1 << 4)
123762306a36Sopenharmony_ci#define RT5682S_GP3_ST				(0x1 << 3)
123862306a36Sopenharmony_ci#define RT5682S_GP2_ST				(0x1 << 2)
123962306a36Sopenharmony_ci#define RT5682S_GP1_ST				(0x1 << 1)
124062306a36Sopenharmony_ci
124162306a36Sopenharmony_ci/* Soft volume and zero cross control 1 (0x00d9) */
124262306a36Sopenharmony_ci#define RT5682S_ZCD_MASK			(0x1 << 10)
124362306a36Sopenharmony_ci#define RT5682S_ZCD_SFT				10
124462306a36Sopenharmony_ci#define RT5682S_ZCD_PD				(0x0 << 10)
124562306a36Sopenharmony_ci#define RT5682S_ZCD_PU				(0x1 << 10)
124662306a36Sopenharmony_ci
124762306a36Sopenharmony_ci/* 4 Button Inline Command Control 2 (0x00e3) */
124862306a36Sopenharmony_ci#define RT5682S_4BTN_IL_MASK			(0x1 << 15)
124962306a36Sopenharmony_ci#define RT5682S_4BTN_IL_EN			(0x1 << 15)
125062306a36Sopenharmony_ci#define RT5682S_4BTN_IL_DIS			(0x0 << 15)
125162306a36Sopenharmony_ci#define RT5682S_4BTN_IL_RST_MASK		(0x1 << 14)
125262306a36Sopenharmony_ci#define RT5682S_4BTN_IL_NOR			(0x1 << 14)
125362306a36Sopenharmony_ci#define RT5682S_4BTN_IL_RST			(0x0 << 14)
125462306a36Sopenharmony_ci
125562306a36Sopenharmony_ci/* 4 Button Inline Command Control 3~6 (0x00e5~0x00e8) */
125662306a36Sopenharmony_ci#define RT5682S_4BTN_IL_HOLD_WIN_MASK		(0x7f << 8)
125762306a36Sopenharmony_ci#define RT5682S_4BTN_IL_HOLD_WIN_SFT		8
125862306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CLICK_WIN_MASK		(0x7f)
125962306a36Sopenharmony_ci#define RT5682S_4BTN_IL_CLICK_WIN_SFT		0
126062306a36Sopenharmony_ci
126162306a36Sopenharmony_ci/* Analog JD Control (0x00f0) */
126262306a36Sopenharmony_ci#define RT5682S_JDH_RS_MASK			(0x1 << 4)
126362306a36Sopenharmony_ci#define RT5682S_JDH_NO_PLUG			(0x1 << 4)
126462306a36Sopenharmony_ci#define RT5682S_JDH_PLUG			(0x0 << 4)
126562306a36Sopenharmony_ci
126662306a36Sopenharmony_ci/* Charge Pump Internal Register1 (0x0125) */
126762306a36Sopenharmony_ci#define RT5682S_CP_CLK_HP_MASK			(0x3 << 4)
126862306a36Sopenharmony_ci#define RT5682S_CP_CLK_HP_100KHZ		(0x0 << 4)
126962306a36Sopenharmony_ci#define RT5682S_CP_CLK_HP_200KHZ		(0x1 << 4)
127062306a36Sopenharmony_ci#define RT5682S_CP_CLK_HP_300KHZ		(0x2 << 4)
127162306a36Sopenharmony_ci#define RT5682S_CP_CLK_HP_600KHZ		(0x3 << 4)
127262306a36Sopenharmony_ci
127362306a36Sopenharmony_ci/* Pad Driving Control (0x0136) */
127462306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP1_MASK		(0x1 << 14)
127562306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP1_HIGH		(0x1 << 14)
127662306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP1_LOW			(0x0 << 14)
127762306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP2_MASK		(0x1 << 12)
127862306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP2_HIGH		(0x1 << 12)
127962306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP2_LOW			(0x0 << 12)
128062306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP3_MASK		(0x1 << 10)
128162306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP3_HIGH		(0x1 << 10)
128262306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP3_LOW			(0x0 << 10)
128362306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP4_MASK		(0x1 << 8)
128462306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP4_HIGH		(0x1 << 8)
128562306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP4_LOW			(0x0 << 8)
128662306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP5_MASK		(0x1 << 6)
128762306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP5_HIGH		(0x1 << 6)
128862306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP5_LOW			(0x0 << 6)
128962306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP6_MASK		(0x1 << 4)
129062306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP6_HIGH		(0x1 << 4)
129162306a36Sopenharmony_ci#define RT5682S_PAD_DRV_GP6_LOW			(0x0 << 4)
129262306a36Sopenharmony_ci
129362306a36Sopenharmony_ci/* Chopper and Clock control for DAC (0x013a)*/
129462306a36Sopenharmony_ci#define RT5682S_CKXEN_DAC1_MASK			(0x1 << 13)
129562306a36Sopenharmony_ci#define RT5682S_CKXEN_DAC1_SFT			13
129662306a36Sopenharmony_ci#define RT5682S_CKGEN_DAC1_MASK			(0x1 << 12)
129762306a36Sopenharmony_ci#define RT5682S_CKGEN_DAC1_SFT			12
129862306a36Sopenharmony_ci
129962306a36Sopenharmony_ci/* Chopper and Clock control for ADC (0x013b)*/
130062306a36Sopenharmony_ci#define RT5682S_CKXEN_ADC1_MASK			(0x1 << 13)
130162306a36Sopenharmony_ci#define RT5682S_CKXEN_ADC1_SFT			13
130262306a36Sopenharmony_ci#define RT5682S_CKGEN_ADC1_MASK			(0x1 << 12)
130362306a36Sopenharmony_ci#define RT5682S_CKGEN_ADC1_SFT			12
130462306a36Sopenharmony_ci
130562306a36Sopenharmony_ci/* Volume test (0x013f)*/
130662306a36Sopenharmony_ci#define RT5682S_SEL_CLK_VOL_MASK		(0x1 << 15)
130762306a36Sopenharmony_ci#define RT5682S_SEL_CLK_VOL_EN			(0x1 << 15)
130862306a36Sopenharmony_ci#define RT5682S_SEL_CLK_VOL_DIS			(0x0 << 15)
130962306a36Sopenharmony_ci
131062306a36Sopenharmony_ci/* Test Mode Control 1 (0x0145) */
131162306a36Sopenharmony_ci#define RT5682S_AD2DA_LB_MASK			(0x1 << 10)
131262306a36Sopenharmony_ci#define RT5682S_AD2DA_LB_SFT			10
131362306a36Sopenharmony_ci
131462306a36Sopenharmony_ci/* Stereo Noise Gate Control 1 (0x0160) */
131562306a36Sopenharmony_ci#define RT5682S_NG2_EN_MASK			(0x1 << 15)
131662306a36Sopenharmony_ci#define RT5682S_NG2_EN				(0x1 << 15)
131762306a36Sopenharmony_ci#define RT5682S_NG2_DIS				(0x0 << 15)
131862306a36Sopenharmony_ci
131962306a36Sopenharmony_ci/* Stereo1 DAC Silence Detection Control (0x0190) */
132062306a36Sopenharmony_ci#define RT5682S_DEB_STO_DAC_MASK		(0x7 << 4)
132162306a36Sopenharmony_ci#define RT5682S_DEB_80_MS			(0x0 << 4)
132262306a36Sopenharmony_ci
132362306a36Sopenharmony_ci/* HP Behavior Logic Control 2 (0x01db) */
132462306a36Sopenharmony_ci#define RT5682S_HP_SIG_SRC_MASK			(0x3)
132562306a36Sopenharmony_ci#define RT5682S_HP_SIG_SRC_1BIT_CTL		(0x3)
132662306a36Sopenharmony_ci#define RT5682S_HP_SIG_SRC_REG			(0x2)
132762306a36Sopenharmony_ci#define RT5682S_HP_SIG_SRC_IMPE_REG		(0x1)
132862306a36Sopenharmony_ci#define RT5682S_HP_SIG_SRC_DC_CALI		(0x0)
132962306a36Sopenharmony_ci
133062306a36Sopenharmony_ci/* SAR ADC Inline Command Control 1 (0x0210) */
133162306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_MASK			(0x1 << 15)
133262306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_EN			(0x1 << 15)
133362306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_DIS			(0x0 << 15)
133462306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_POW_MASK		(0x1 << 14)
133562306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_POW_SAV		(0x1 << 14)
133662306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_POW_NORM		(0x0 << 14)
133762306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_RST_MASK		(0x1 << 13)
133862306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_RST_NORM		(0x1 << 13)
133962306a36Sopenharmony_ci#define RT5682S_SAR_BUTDET_RST			(0x0 << 13)
134062306a36Sopenharmony_ci#define RT5682S_SAR_POW_MASK			(0x1 << 12)
134162306a36Sopenharmony_ci#define RT5682S_SAR_POW_EN			(0x1 << 12)
134262306a36Sopenharmony_ci#define RT5682S_SAR_POW_DIS			(0x0 << 12)
134362306a36Sopenharmony_ci#define RT5682S_SAR_RST_MASK			(0x1 << 11)
134462306a36Sopenharmony_ci#define RT5682S_SAR_RST_NORMAL			(0x1 << 11)
134562306a36Sopenharmony_ci#define RT5682S_SAR_RST				(0x0 << 11)
134662306a36Sopenharmony_ci#define RT5682S_SAR_BYPASS_MASK			(0x1 << 10)
134762306a36Sopenharmony_ci#define RT5682S_SAR_BYPASS_EN			(0x1 << 10)
134862306a36Sopenharmony_ci#define RT5682S_SAR_BYPASS_DIS			(0x0 << 10)
134962306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MB1_2_MASK		(0x3 << 8)
135062306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MB1_2_SFT		8
135162306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MODE_MASK		(0x1 << 7)
135262306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MODE_CMP		(0x1 << 7)
135362306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MODE_ADC		(0x0 << 7)
135462306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MB1_2_CTL_MASK		(0x1 << 5)
135562306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MB1_2_AUTO		(0x1 << 5)
135662306a36Sopenharmony_ci#define RT5682S_SAR_SEL_MB1_2_MANU		(0x0 << 5)
135762306a36Sopenharmony_ci#define RT5682S_SAR_SEL_SIGNAL_MASK		(0x1 << 4)
135862306a36Sopenharmony_ci#define RT5682S_SAR_SEL_SIGNAL_AUTO		(0x1 << 4)
135962306a36Sopenharmony_ci#define RT5682S_SAR_SEL_SIGNAL_MANU		(0x0 << 4)
136062306a36Sopenharmony_ci
136162306a36Sopenharmony_ci/* SAR ADC Inline Command Control 2 (0x0211) */
136262306a36Sopenharmony_ci#define RT5682S_SAR_ADC_PSV_MASK		(0x1 << 4)
136362306a36Sopenharmony_ci#define RT5682S_SAR_ADC_PSV_ENTRY		(0x1 << 4)
136462306a36Sopenharmony_ci
136562306a36Sopenharmony_ci
136662306a36Sopenharmony_ci/* SAR ADC Inline Command Control 13 (0x021c) */
136762306a36Sopenharmony_ci#define RT5682S_SAR_SOUR_MASK			(0x3f)
136862306a36Sopenharmony_ci#define RT5682S_SAR_SOUR_BTN			(0x3f)
136962306a36Sopenharmony_ci#define RT5682S_SAR_SOUR_TYPE			(0x0)
137062306a36Sopenharmony_ci
137162306a36Sopenharmony_ci/* Headphone Amp Detection Control 1 (0x3b00) */
137262306a36Sopenharmony_ci#define RT5682S_CP_SW_SIZE_MASK			(0x7 << 4)
137362306a36Sopenharmony_ci#define RT5682S_CP_SW_SIZE_L			(0x4 << 4)
137462306a36Sopenharmony_ci#define RT5682S_CP_SW_SIZE_M			(0x2 << 4)
137562306a36Sopenharmony_ci#define RT5682S_CP_SW_SIZE_S			(0x1 << 4)
137662306a36Sopenharmony_ci
137762306a36Sopenharmony_ci#define RT5682S_STEREO_RATES SNDRV_PCM_RATE_8000_192000
137862306a36Sopenharmony_ci#define RT5682S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
137962306a36Sopenharmony_ci		SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8)
138062306a36Sopenharmony_ci
138162306a36Sopenharmony_ci/* System Clock Source */
138262306a36Sopenharmony_cienum {
138362306a36Sopenharmony_ci	RT5682S_SCLK_S_MCLK,
138462306a36Sopenharmony_ci	RT5682S_SCLK_S_PLL1,
138562306a36Sopenharmony_ci	RT5682S_SCLK_S_PLL2,
138662306a36Sopenharmony_ci	RT5682S_SCLK_S_RCCLK,
138762306a36Sopenharmony_ci};
138862306a36Sopenharmony_ci
138962306a36Sopenharmony_ci/* PLL Source */
139062306a36Sopenharmony_cienum {
139162306a36Sopenharmony_ci	RT5682S_PLL_S_MCLK,
139262306a36Sopenharmony_ci	RT5682S_PLL_S_BCLK1,
139362306a36Sopenharmony_ci	RT5682S_PLL_S_BCLK2,
139462306a36Sopenharmony_ci	RT5682S_PLL_S_RCCLK,
139562306a36Sopenharmony_ci};
139662306a36Sopenharmony_ci
139762306a36Sopenharmony_cienum {
139862306a36Sopenharmony_ci	RT5682S_PLL1,
139962306a36Sopenharmony_ci	RT5682S_PLL2,
140062306a36Sopenharmony_ci	RT5682S_PLLS,
140162306a36Sopenharmony_ci};
140262306a36Sopenharmony_ci
140362306a36Sopenharmony_cienum {
140462306a36Sopenharmony_ci	RT5682S_AIF1,
140562306a36Sopenharmony_ci	RT5682S_AIF2,
140662306a36Sopenharmony_ci	RT5682S_AIFS
140762306a36Sopenharmony_ci};
140862306a36Sopenharmony_ci
140962306a36Sopenharmony_ci/* filter mask */
141062306a36Sopenharmony_cienum {
141162306a36Sopenharmony_ci	RT5682S_DA_STEREO1_FILTER = 0x1,
141262306a36Sopenharmony_ci	RT5682S_AD_STEREO1_FILTER = (0x1 << 1),
141362306a36Sopenharmony_ci};
141462306a36Sopenharmony_ci
141562306a36Sopenharmony_cienum {
141662306a36Sopenharmony_ci	RT5682S_CLK_SEL_SYS,
141762306a36Sopenharmony_ci	RT5682S_CLK_SEL_I2S1_ASRC,
141862306a36Sopenharmony_ci	RT5682S_CLK_SEL_I2S2_ASRC,
141962306a36Sopenharmony_ci};
142062306a36Sopenharmony_ci
142162306a36Sopenharmony_cienum {
142262306a36Sopenharmony_ci	USE_PLLA,
142362306a36Sopenharmony_ci	USE_PLLB,
142462306a36Sopenharmony_ci	USE_PLLAB,
142562306a36Sopenharmony_ci};
142662306a36Sopenharmony_ci
142762306a36Sopenharmony_cistruct pll_calc_map {
142862306a36Sopenharmony_ci	unsigned int freq_in;
142962306a36Sopenharmony_ci	unsigned int freq_out;
143062306a36Sopenharmony_ci	int m;
143162306a36Sopenharmony_ci	int n;
143262306a36Sopenharmony_ci	int k;
143362306a36Sopenharmony_ci	bool m_bp;
143462306a36Sopenharmony_ci	bool k_bp;
143562306a36Sopenharmony_ci	bool byp_ps;
143662306a36Sopenharmony_ci	bool sel_ps;
143762306a36Sopenharmony_ci};
143862306a36Sopenharmony_ci
143962306a36Sopenharmony_cienum {
144062306a36Sopenharmony_ci	RT5682S_SUPPLY_AVDD,
144162306a36Sopenharmony_ci	RT5682S_SUPPLY_MICVDD,
144262306a36Sopenharmony_ci	RT5682S_SUPPLY_DBVDD,
144362306a36Sopenharmony_ci	RT5682S_SUPPLY_LDO1_IN,
144462306a36Sopenharmony_ci	RT5682S_NUM_SUPPLIES,
144562306a36Sopenharmony_ci};
144662306a36Sopenharmony_ci
144762306a36Sopenharmony_cistruct rt5682s_priv {
144862306a36Sopenharmony_ci	struct snd_soc_component *component;
144962306a36Sopenharmony_ci	struct rt5682s_platform_data pdata;
145062306a36Sopenharmony_ci	struct gpio_desc *ldo1_en;
145162306a36Sopenharmony_ci	struct regmap *regmap;
145262306a36Sopenharmony_ci	struct snd_soc_jack *hs_jack;
145362306a36Sopenharmony_ci	struct regulator_bulk_data supplies[RT5682S_NUM_SUPPLIES];
145462306a36Sopenharmony_ci	struct delayed_work jack_detect_work;
145562306a36Sopenharmony_ci	struct delayed_work jd_check_work;
145662306a36Sopenharmony_ci	struct mutex calibrate_mutex;
145762306a36Sopenharmony_ci	struct mutex sar_mutex;
145862306a36Sopenharmony_ci	struct mutex wclk_mutex;
145962306a36Sopenharmony_ci
146062306a36Sopenharmony_ci#ifdef CONFIG_COMMON_CLK
146162306a36Sopenharmony_ci	struct clk_hw dai_clks_hw[RT5682S_DAI_NUM_CLKS];
146262306a36Sopenharmony_ci	struct clk *mclk;
146362306a36Sopenharmony_ci#endif
146462306a36Sopenharmony_ci
146562306a36Sopenharmony_ci	int sysclk;
146662306a36Sopenharmony_ci	int sysclk_src;
146762306a36Sopenharmony_ci	int lrck[RT5682S_AIFS];
146862306a36Sopenharmony_ci	int bclk[RT5682S_AIFS];
146962306a36Sopenharmony_ci	int master[RT5682S_AIFS];
147062306a36Sopenharmony_ci
147162306a36Sopenharmony_ci	int pll_src[RT5682S_PLLS];
147262306a36Sopenharmony_ci	int pll_in[RT5682S_PLLS];
147362306a36Sopenharmony_ci	int pll_out[RT5682S_PLLS];
147462306a36Sopenharmony_ci	int pll_comb;
147562306a36Sopenharmony_ci
147662306a36Sopenharmony_ci	int jack_type;
147762306a36Sopenharmony_ci	unsigned int irq;
147862306a36Sopenharmony_ci	int irq_work_delay_time;
147962306a36Sopenharmony_ci	int wclk_enabled;
148062306a36Sopenharmony_ci};
148162306a36Sopenharmony_ci
148262306a36Sopenharmony_ciint rt5682s_sel_asrc_clk_src(struct snd_soc_component *component,
148362306a36Sopenharmony_ci		unsigned int filter_mask, unsigned int clk_src);
148462306a36Sopenharmony_ci
148562306a36Sopenharmony_ci#endif /* __RT5682S_H__ */
1486