162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * rt5682.h -- RT5682/RT5658 ALSA SoC audio driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2018 Realtek Microelectronics 662306a36Sopenharmony_ci * Author: Bard Liao <bardliao@realtek.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef __RT5682_H__ 1062306a36Sopenharmony_ci#define __RT5682_H__ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <sound/rt5682.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#include <linux/soundwire/sdw.h> 1962306a36Sopenharmony_ci#include <linux/soundwire/sdw_type.h> 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#define DEVICE_ID 0x6530 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci/* Info */ 2462306a36Sopenharmony_ci#define RT5682_RESET 0x0000 2562306a36Sopenharmony_ci#define RT5682_VERSION_ID 0x00fd 2662306a36Sopenharmony_ci#define RT5682_VENDOR_ID 0x00fe 2762306a36Sopenharmony_ci#define RT5682_DEVICE_ID 0x00ff 2862306a36Sopenharmony_ci/* I/O - Output */ 2962306a36Sopenharmony_ci#define RT5682_HP_CTRL_1 0x0002 3062306a36Sopenharmony_ci#define RT5682_HP_CTRL_2 0x0003 3162306a36Sopenharmony_ci#define RT5682_HPL_GAIN 0x0005 3262306a36Sopenharmony_ci#define RT5682_HPR_GAIN 0x0006 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci#define RT5682_I2C_CTRL 0x0008 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ci/* I/O - Input */ 3762306a36Sopenharmony_ci#define RT5682_CBJ_BST_CTRL 0x000b 3862306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_1 0x0010 3962306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_2 0x0011 4062306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_3 0x0012 4162306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_4 0x0013 4262306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_5 0x0014 4362306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_6 0x0015 4462306a36Sopenharmony_ci#define RT5682_CBJ_CTRL_7 0x0016 4562306a36Sopenharmony_ci/* I/O - ADC/DAC/DMIC */ 4662306a36Sopenharmony_ci#define RT5682_DAC1_DIG_VOL 0x0019 4762306a36Sopenharmony_ci#define RT5682_STO1_ADC_DIG_VOL 0x001c 4862306a36Sopenharmony_ci#define RT5682_STO1_ADC_BOOST 0x001f 4962306a36Sopenharmony_ci#define RT5682_HP_IMP_GAIN_1 0x0022 5062306a36Sopenharmony_ci#define RT5682_HP_IMP_GAIN_2 0x0023 5162306a36Sopenharmony_ci/* Mixer - D-D */ 5262306a36Sopenharmony_ci#define RT5682_SIDETONE_CTRL 0x0024 5362306a36Sopenharmony_ci#define RT5682_STO1_ADC_MIXER 0x0026 5462306a36Sopenharmony_ci#define RT5682_AD_DA_MIXER 0x0029 5562306a36Sopenharmony_ci#define RT5682_STO1_DAC_MIXER 0x002a 5662306a36Sopenharmony_ci#define RT5682_A_DAC1_MUX 0x002b 5762306a36Sopenharmony_ci#define RT5682_DIG_INF2_DATA 0x0030 5862306a36Sopenharmony_ci/* Mixer - ADC */ 5962306a36Sopenharmony_ci#define RT5682_REC_MIXER 0x003c 6062306a36Sopenharmony_ci#define RT5682_CAL_REC 0x0044 6162306a36Sopenharmony_ci#define RT5682_ALC_BACK_GAIN 0x0049 6262306a36Sopenharmony_ci/* Power */ 6362306a36Sopenharmony_ci#define RT5682_PWR_DIG_1 0x0061 6462306a36Sopenharmony_ci#define RT5682_PWR_DIG_2 0x0062 6562306a36Sopenharmony_ci#define RT5682_PWR_ANLG_1 0x0063 6662306a36Sopenharmony_ci#define RT5682_PWR_ANLG_2 0x0064 6762306a36Sopenharmony_ci#define RT5682_PWR_ANLG_3 0x0065 6862306a36Sopenharmony_ci#define RT5682_PWR_MIXER 0x0066 6962306a36Sopenharmony_ci#define RT5682_PWR_VOL 0x0067 7062306a36Sopenharmony_ci/* Clock Detect */ 7162306a36Sopenharmony_ci#define RT5682_CLK_DET 0x006b 7262306a36Sopenharmony_ci/* Filter Auto Reset */ 7362306a36Sopenharmony_ci#define RT5682_RESET_LPF_CTRL 0x006c 7462306a36Sopenharmony_ci#define RT5682_RESET_HPF_CTRL 0x006d 7562306a36Sopenharmony_ci/* DMIC */ 7662306a36Sopenharmony_ci#define RT5682_DMIC_CTRL_1 0x006e 7762306a36Sopenharmony_ci/* Format - ADC/DAC */ 7862306a36Sopenharmony_ci#define RT5682_I2S1_SDP 0x0070 7962306a36Sopenharmony_ci#define RT5682_I2S2_SDP 0x0071 8062306a36Sopenharmony_ci#define RT5682_ADDA_CLK_1 0x0073 8162306a36Sopenharmony_ci#define RT5682_ADDA_CLK_2 0x0074 8262306a36Sopenharmony_ci#define RT5682_I2S1_F_DIV_CTRL_1 0x0075 8362306a36Sopenharmony_ci#define RT5682_I2S1_F_DIV_CTRL_2 0x0076 8462306a36Sopenharmony_ci/* Format - TDM Control */ 8562306a36Sopenharmony_ci#define RT5682_TDM_CTRL 0x0079 8662306a36Sopenharmony_ci#define RT5682_TDM_ADDA_CTRL_1 0x007a 8762306a36Sopenharmony_ci#define RT5682_TDM_ADDA_CTRL_2 0x007b 8862306a36Sopenharmony_ci#define RT5682_DATA_SEL_CTRL_1 0x007c 8962306a36Sopenharmony_ci#define RT5682_TDM_TCON_CTRL 0x007e 9062306a36Sopenharmony_ci/* Function - Analog */ 9162306a36Sopenharmony_ci#define RT5682_GLB_CLK 0x0080 9262306a36Sopenharmony_ci#define RT5682_PLL_CTRL_1 0x0081 9362306a36Sopenharmony_ci#define RT5682_PLL_CTRL_2 0x0082 9462306a36Sopenharmony_ci#define RT5682_PLL_TRACK_1 0x0083 9562306a36Sopenharmony_ci#define RT5682_PLL_TRACK_2 0x0084 9662306a36Sopenharmony_ci#define RT5682_PLL_TRACK_3 0x0085 9762306a36Sopenharmony_ci#define RT5682_PLL_TRACK_4 0x0086 9862306a36Sopenharmony_ci#define RT5682_PLL_TRACK_5 0x0087 9962306a36Sopenharmony_ci#define RT5682_PLL_TRACK_6 0x0088 10062306a36Sopenharmony_ci#define RT5682_PLL_TRACK_11 0x008c 10162306a36Sopenharmony_ci#define RT5682_SDW_REF_CLK 0x008d 10262306a36Sopenharmony_ci#define RT5682_DEPOP_1 0x008e 10362306a36Sopenharmony_ci#define RT5682_DEPOP_2 0x008f 10462306a36Sopenharmony_ci#define RT5682_HP_CHARGE_PUMP_1 0x0091 10562306a36Sopenharmony_ci#define RT5682_HP_CHARGE_PUMP_2 0x0092 10662306a36Sopenharmony_ci#define RT5682_MICBIAS_1 0x0093 10762306a36Sopenharmony_ci#define RT5682_MICBIAS_2 0x0094 10862306a36Sopenharmony_ci#define RT5682_PLL_TRACK_12 0x0098 10962306a36Sopenharmony_ci#define RT5682_PLL_TRACK_14 0x009a 11062306a36Sopenharmony_ci#define RT5682_PLL2_CTRL_1 0x009b 11162306a36Sopenharmony_ci#define RT5682_PLL2_CTRL_2 0x009c 11262306a36Sopenharmony_ci#define RT5682_PLL2_CTRL_3 0x009d 11362306a36Sopenharmony_ci#define RT5682_PLL2_CTRL_4 0x009e 11462306a36Sopenharmony_ci#define RT5682_RC_CLK_CTRL 0x009f 11562306a36Sopenharmony_ci#define RT5682_I2S_M_CLK_CTRL_1 0x00a0 11662306a36Sopenharmony_ci#define RT5682_I2S2_F_DIV_CTRL_1 0x00a3 11762306a36Sopenharmony_ci#define RT5682_I2S2_F_DIV_CTRL_2 0x00a4 11862306a36Sopenharmony_ci/* Function - Digital */ 11962306a36Sopenharmony_ci#define RT5682_EQ_CTRL_1 0x00ae 12062306a36Sopenharmony_ci#define RT5682_EQ_CTRL_2 0x00af 12162306a36Sopenharmony_ci#define RT5682_IRQ_CTRL_1 0x00b6 12262306a36Sopenharmony_ci#define RT5682_IRQ_CTRL_2 0x00b7 12362306a36Sopenharmony_ci#define RT5682_IRQ_CTRL_3 0x00b8 12462306a36Sopenharmony_ci#define RT5682_IRQ_CTRL_4 0x00b9 12562306a36Sopenharmony_ci#define RT5682_INT_ST_1 0x00be 12662306a36Sopenharmony_ci#define RT5682_GPIO_CTRL_1 0x00c0 12762306a36Sopenharmony_ci#define RT5682_GPIO_CTRL_2 0x00c1 12862306a36Sopenharmony_ci#define RT5682_GPIO_CTRL_3 0x00c2 12962306a36Sopenharmony_ci#define RT5682_HP_AMP_DET_CTRL_1 0x00d0 13062306a36Sopenharmony_ci#define RT5682_HP_AMP_DET_CTRL_2 0x00d1 13162306a36Sopenharmony_ci#define RT5682_MID_HP_AMP_DET 0x00d2 13262306a36Sopenharmony_ci#define RT5682_LOW_HP_AMP_DET 0x00d3 13362306a36Sopenharmony_ci#define RT5682_DELAY_BUF_CTRL 0x00d4 13462306a36Sopenharmony_ci#define RT5682_SV_ZCD_1 0x00d9 13562306a36Sopenharmony_ci#define RT5682_SV_ZCD_2 0x00da 13662306a36Sopenharmony_ci#define RT5682_IL_CMD_1 0x00db 13762306a36Sopenharmony_ci#define RT5682_IL_CMD_2 0x00dc 13862306a36Sopenharmony_ci#define RT5682_IL_CMD_3 0x00dd 13962306a36Sopenharmony_ci#define RT5682_IL_CMD_4 0x00de 14062306a36Sopenharmony_ci#define RT5682_IL_CMD_5 0x00df 14162306a36Sopenharmony_ci#define RT5682_IL_CMD_6 0x00e0 14262306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_1 0x00e2 14362306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_2 0x00e3 14462306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_3 0x00e4 14562306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_4 0x00e5 14662306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_5 0x00e6 14762306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_6 0x00e7 14862306a36Sopenharmony_ci#define RT5682_4BTN_IL_CMD_7 0x00e8 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci#define RT5682_ADC_STO1_HP_CTRL_1 0x00ea 15162306a36Sopenharmony_ci#define RT5682_ADC_STO1_HP_CTRL_2 0x00eb 15262306a36Sopenharmony_ci#define RT5682_AJD1_CTRL 0x00f0 15362306a36Sopenharmony_ci#define RT5682_JD1_THD 0x00f1 15462306a36Sopenharmony_ci#define RT5682_JD2_THD 0x00f2 15562306a36Sopenharmony_ci#define RT5682_JD_CTRL_1 0x00f6 15662306a36Sopenharmony_ci/* General Control */ 15762306a36Sopenharmony_ci#define RT5682_DUMMY_1 0x00fa 15862306a36Sopenharmony_ci#define RT5682_DUMMY_2 0x00fb 15962306a36Sopenharmony_ci#define RT5682_DUMMY_3 0x00fc 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define RT5682_DAC_ADC_DIG_VOL1 0x0100 16262306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_2 0x010b 16362306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_3 0x010c 16462306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_4 0x010d 16562306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_5 0x010e 16662306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_6 0x010f 16762306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_7 0x0110 16862306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_8 0x0111 16962306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_9 0x0112 17062306a36Sopenharmony_ci#define RT5682_BIAS_CUR_CTRL_10 0x0113 17162306a36Sopenharmony_ci#define RT5682_VREF_REC_OP_FB_CAP_CTRL 0x0117 17262306a36Sopenharmony_ci#define RT5682_CHARGE_PUMP_1 0x0125 17362306a36Sopenharmony_ci#define RT5682_DIG_IN_CTRL_1 0x0132 17462306a36Sopenharmony_ci#define RT5682_PAD_DRIVING_CTRL 0x0136 17562306a36Sopenharmony_ci#define RT5682_SOFT_RAMP_DEPOP 0x0138 17662306a36Sopenharmony_ci#define RT5682_CHOP_DAC 0x013a 17762306a36Sopenharmony_ci#define RT5682_CHOP_ADC 0x013b 17862306a36Sopenharmony_ci#define RT5682_CALIB_ADC_CTRL 0x013c 17962306a36Sopenharmony_ci#define RT5682_VOL_TEST 0x013f 18062306a36Sopenharmony_ci#define RT5682_SPKVDD_DET_STA 0x0142 18162306a36Sopenharmony_ci#define RT5682_TEST_MODE_CTRL_1 0x0145 18262306a36Sopenharmony_ci#define RT5682_TEST_MODE_CTRL_2 0x0146 18362306a36Sopenharmony_ci#define RT5682_TEST_MODE_CTRL_3 0x0147 18462306a36Sopenharmony_ci#define RT5682_TEST_MODE_CTRL_4 0x0148 18562306a36Sopenharmony_ci#define RT5682_TEST_MODE_CTRL_5 0x0149 18662306a36Sopenharmony_ci#define RT5682_PLL1_INTERNAL 0x0150 18762306a36Sopenharmony_ci#define RT5682_PLL2_INTERNAL 0x0156 18862306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_1 0x0160 18962306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_2 0x0161 19062306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_3 0x0162 19162306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_4 0x0163 19262306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_5 0x0164 19362306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_6 0x0165 19462306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_7 0x0166 19562306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_8 0x0167 19662306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_9 0x0168 19762306a36Sopenharmony_ci#define RT5682_STO_NG2_CTRL_10 0x0169 19862306a36Sopenharmony_ci#define RT5682_STO1_DAC_SIL_DET 0x0190 19962306a36Sopenharmony_ci#define RT5682_SIL_PSV_CTRL1 0x0194 20062306a36Sopenharmony_ci#define RT5682_SIL_PSV_CTRL2 0x0195 20162306a36Sopenharmony_ci#define RT5682_SIL_PSV_CTRL3 0x0197 20262306a36Sopenharmony_ci#define RT5682_SIL_PSV_CTRL4 0x0198 20362306a36Sopenharmony_ci#define RT5682_SIL_PSV_CTRL5 0x0199 20462306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_01 0x01af 20562306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_02 0x01b0 20662306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_03 0x01b1 20762306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_04 0x01b2 20862306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_05 0x01b3 20962306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_06 0x01b4 21062306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_07 0x01b5 21162306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_08 0x01b6 21262306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_09 0x01b7 21362306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_10 0x01b8 21462306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_11 0x01b9 21562306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_12 0x01ba 21662306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_13 0x01bb 21762306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_14 0x01bc 21862306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_15 0x01bd 21962306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_16 0x01be 22062306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_17 0x01bf 22162306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_18 0x01c0 22262306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_19 0x01c1 22362306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_20 0x01c2 22462306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_21 0x01c3 22562306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_22 0x01c4 22662306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_23 0x01c5 22762306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_24 0x01c6 22862306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_25 0x01c7 22962306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_26 0x01c8 23062306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_27 0x01c9 23162306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_28 0x01ca 23262306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_29 0x01cb 23362306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_30 0x01cc 23462306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_31 0x01cd 23562306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_32 0x01ce 23662306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_33 0x01cf 23762306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_34 0x01d0 23862306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_35 0x01d1 23962306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_36 0x01d2 24062306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_37 0x01d3 24162306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_38 0x01d4 24262306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_39 0x01d5 24362306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_40 0x01d6 24462306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_41 0x01d7 24562306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_42 0x01d8 24662306a36Sopenharmony_ci#define RT5682_HP_IMP_SENS_CTRL_43 0x01d9 24762306a36Sopenharmony_ci#define RT5682_HP_LOGIC_CTRL_1 0x01da 24862306a36Sopenharmony_ci#define RT5682_HP_LOGIC_CTRL_2 0x01db 24962306a36Sopenharmony_ci#define RT5682_HP_LOGIC_CTRL_3 0x01dc 25062306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_1 0x01de 25162306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_2 0x01df 25262306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_3 0x01e0 25362306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_4 0x01e1 25462306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_5 0x01e2 25562306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_6 0x01e3 25662306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_7 0x01e4 25762306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_9 0x01e6 25862306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_10 0x01e7 25962306a36Sopenharmony_ci#define RT5682_HP_CALIB_CTRL_11 0x01e8 26062306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_1 0x01ea 26162306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_2 0x01eb 26262306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_3 0x01ec 26362306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_4 0x01ed 26462306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_5 0x01ee 26562306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_6 0x01ef 26662306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_7 0x01f0 26762306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_8 0x01f1 26862306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_9 0x01f2 26962306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_10 0x01f3 27062306a36Sopenharmony_ci#define RT5682_HP_CALIB_STA_11 0x01f4 27162306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_1 0x0210 27262306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_2 0x0211 27362306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_3 0x0212 27462306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_4 0x0213 27562306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_5 0x0214 27662306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_6 0x0215 27762306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_7 0x0216 27862306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_8 0x0217 27962306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_9 0x0218 28062306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_10 0x0219 28162306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_11 0x021a 28262306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_12 0x021b 28362306a36Sopenharmony_ci#define RT5682_SAR_IL_CMD_13 0x021c 28462306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_1 0x0250 28562306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_2 0x0251 28662306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_3 0x0252 28762306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_4 0x0253 28862306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_5 0x0254 28962306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_6 0x0255 29062306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_7 0x0256 29162306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_8 0x0257 29262306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_9 0x0258 29362306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_10 0x0259 29462306a36Sopenharmony_ci#define RT5682_EFUSE_CTRL_11 0x025a 29562306a36Sopenharmony_ci#define RT5682_JD_TOP_VC_VTRL 0x0270 29662306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_0 0x02ff 29762306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_1 0x0300 29862306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_2 0x0301 29962306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_3 0x0302 30062306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_4 0x0303 30162306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_5 0x0304 30262306a36Sopenharmony_ci#define RT5682_DRC1_CTRL_6 0x0305 30362306a36Sopenharmony_ci#define RT5682_DRC1_HARD_LMT_CTRL_1 0x0306 30462306a36Sopenharmony_ci#define RT5682_DRC1_HARD_LMT_CTRL_2 0x0307 30562306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_1 0x0310 30662306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_2 0x0311 30762306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_3 0x0312 30862306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_4 0x0313 30962306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_5 0x0314 31062306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_6 0x0315 31162306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_7 0x0316 31262306a36Sopenharmony_ci#define RT5682_DRC1_PRIV_8 0x0317 31362306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL1 0x03c0 31462306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL2 0x03c1 31562306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL3 0x03c2 31662306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL4 0x03c3 31762306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL5 0x03c4 31862306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL6 0x03c5 31962306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL7 0x03c6 32062306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL8 0x03c7 32162306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL9 0x03c8 32262306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL10 0x03c9 32362306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL11 0x03ca 32462306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL12 0x03cb 32562306a36Sopenharmony_ci#define RT5682_EQ_AUTO_RCV_CTRL13 0x03cc 32662306a36Sopenharmony_ci#define RT5682_ADC_L_EQ_LPF1_A1 0x03d0 32762306a36Sopenharmony_ci#define RT5682_R_EQ_LPF1_A1 0x03d1 32862306a36Sopenharmony_ci#define RT5682_L_EQ_LPF1_H0 0x03d2 32962306a36Sopenharmony_ci#define RT5682_R_EQ_LPF1_H0 0x03d3 33062306a36Sopenharmony_ci#define RT5682_L_EQ_BPF1_A1 0x03d4 33162306a36Sopenharmony_ci#define RT5682_R_EQ_BPF1_A1 0x03d5 33262306a36Sopenharmony_ci#define RT5682_L_EQ_BPF1_A2 0x03d6 33362306a36Sopenharmony_ci#define RT5682_R_EQ_BPF1_A2 0x03d7 33462306a36Sopenharmony_ci#define RT5682_L_EQ_BPF1_H0 0x03d8 33562306a36Sopenharmony_ci#define RT5682_R_EQ_BPF1_H0 0x03d9 33662306a36Sopenharmony_ci#define RT5682_L_EQ_BPF2_A1 0x03da 33762306a36Sopenharmony_ci#define RT5682_R_EQ_BPF2_A1 0x03db 33862306a36Sopenharmony_ci#define RT5682_L_EQ_BPF2_A2 0x03dc 33962306a36Sopenharmony_ci#define RT5682_R_EQ_BPF2_A2 0x03dd 34062306a36Sopenharmony_ci#define RT5682_L_EQ_BPF2_H0 0x03de 34162306a36Sopenharmony_ci#define RT5682_R_EQ_BPF2_H0 0x03df 34262306a36Sopenharmony_ci#define RT5682_L_EQ_BPF3_A1 0x03e0 34362306a36Sopenharmony_ci#define RT5682_R_EQ_BPF3_A1 0x03e1 34462306a36Sopenharmony_ci#define RT5682_L_EQ_BPF3_A2 0x03e2 34562306a36Sopenharmony_ci#define RT5682_R_EQ_BPF3_A2 0x03e3 34662306a36Sopenharmony_ci#define RT5682_L_EQ_BPF3_H0 0x03e4 34762306a36Sopenharmony_ci#define RT5682_R_EQ_BPF3_H0 0x03e5 34862306a36Sopenharmony_ci#define RT5682_L_EQ_BPF4_A1 0x03e6 34962306a36Sopenharmony_ci#define RT5682_R_EQ_BPF4_A1 0x03e7 35062306a36Sopenharmony_ci#define RT5682_L_EQ_BPF4_A2 0x03e8 35162306a36Sopenharmony_ci#define RT5682_R_EQ_BPF4_A2 0x03e9 35262306a36Sopenharmony_ci#define RT5682_L_EQ_BPF4_H0 0x03ea 35362306a36Sopenharmony_ci#define RT5682_R_EQ_BPF4_H0 0x03eb 35462306a36Sopenharmony_ci#define RT5682_L_EQ_HPF1_A1 0x03ec 35562306a36Sopenharmony_ci#define RT5682_R_EQ_HPF1_A1 0x03ed 35662306a36Sopenharmony_ci#define RT5682_L_EQ_HPF1_H0 0x03ee 35762306a36Sopenharmony_ci#define RT5682_R_EQ_HPF1_H0 0x03ef 35862306a36Sopenharmony_ci#define RT5682_L_EQ_PRE_VOL 0x03f0 35962306a36Sopenharmony_ci#define RT5682_R_EQ_PRE_VOL 0x03f1 36062306a36Sopenharmony_ci#define RT5682_L_EQ_POST_VOL 0x03f2 36162306a36Sopenharmony_ci#define RT5682_R_EQ_POST_VOL 0x03f3 36262306a36Sopenharmony_ci#define RT5682_I2C_MODE 0xffff 36362306a36Sopenharmony_ci 36462306a36Sopenharmony_ci 36562306a36Sopenharmony_ci/* global definition */ 36662306a36Sopenharmony_ci#define RT5682_L_MUTE (0x1 << 15) 36762306a36Sopenharmony_ci#define RT5682_L_MUTE_SFT 15 36862306a36Sopenharmony_ci#define RT5682_VOL_L_MUTE (0x1 << 14) 36962306a36Sopenharmony_ci#define RT5682_VOL_L_SFT 14 37062306a36Sopenharmony_ci#define RT5682_R_MUTE (0x1 << 7) 37162306a36Sopenharmony_ci#define RT5682_R_MUTE_SFT 7 37262306a36Sopenharmony_ci#define RT5682_VOL_R_MUTE (0x1 << 6) 37362306a36Sopenharmony_ci#define RT5682_VOL_R_SFT 6 37462306a36Sopenharmony_ci#define RT5682_L_VOL_MASK (0x3f << 8) 37562306a36Sopenharmony_ci#define RT5682_L_VOL_SFT 8 37662306a36Sopenharmony_ci#define RT5682_R_VOL_MASK (0x3f) 37762306a36Sopenharmony_ci#define RT5682_R_VOL_SFT 0 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci/* Headphone Amp Control 2 (0x0003) */ 38062306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_AMP_MUTE_SFT 15 38162306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_AMP_MUTE (0x1 << 15) 38262306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_L_EN_SFT 14 38362306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_L_EN (0x1 << 14) 38462306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_R_EN_SFT 13 38562306a36Sopenharmony_ci#define RT5682_HP_C2_DAC_R_EN (0x1 << 13) 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/*Headphone Amp L/R Analog Gain and Digital NG2 Gain Control (0x0005 0x0006)*/ 38862306a36Sopenharmony_ci#define RT5682_G_HP (0xf << 8) 38962306a36Sopenharmony_ci#define RT5682_G_HP_SFT 8 39062306a36Sopenharmony_ci#define RT5682_G_STO_DA_DMIX (0xf) 39162306a36Sopenharmony_ci#define RT5682_G_STO_DA_SFT 0 39262306a36Sopenharmony_ci 39362306a36Sopenharmony_ci/* CBJ Control (0x000b) */ 39462306a36Sopenharmony_ci#define RT5682_BST_CBJ_MASK (0xf << 8) 39562306a36Sopenharmony_ci#define RT5682_BST_CBJ_SFT 8 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci/* Embeeded Jack and Type Detection Control 1 (0x0010) */ 39862306a36Sopenharmony_ci#define RT5682_EMB_JD_EN (0x1 << 15) 39962306a36Sopenharmony_ci#define RT5682_EMB_JD_EN_SFT 15 40062306a36Sopenharmony_ci#define RT5682_EMB_JD_RST (0x1 << 14) 40162306a36Sopenharmony_ci#define RT5682_JD_MODE (0x1 << 13) 40262306a36Sopenharmony_ci#define RT5682_JD_MODE_SFT 13 40362306a36Sopenharmony_ci#define RT5682_DET_TYPE (0x1 << 12) 40462306a36Sopenharmony_ci#define RT5682_DET_TYPE_SFT 12 40562306a36Sopenharmony_ci#define RT5682_POLA_EXT_JD_MASK (0x1 << 11) 40662306a36Sopenharmony_ci#define RT5682_POLA_EXT_JD_LOW (0x1 << 11) 40762306a36Sopenharmony_ci#define RT5682_POLA_EXT_JD_HIGH (0x0 << 11) 40862306a36Sopenharmony_ci#define RT5682_EXT_JD_DIG (0x1 << 9) 40962306a36Sopenharmony_ci#define RT5682_POL_FAST_OFF_MASK (0x1 << 8) 41062306a36Sopenharmony_ci#define RT5682_POL_FAST_OFF_HIGH (0x1 << 8) 41162306a36Sopenharmony_ci#define RT5682_POL_FAST_OFF_LOW (0x0 << 8) 41262306a36Sopenharmony_ci#define RT5682_FAST_OFF_MASK (0x1 << 7) 41362306a36Sopenharmony_ci#define RT5682_FAST_OFF_EN (0x1 << 7) 41462306a36Sopenharmony_ci#define RT5682_FAST_OFF_DIS (0x0 << 7) 41562306a36Sopenharmony_ci#define RT5682_VREF_POW_MASK (0x1 << 6) 41662306a36Sopenharmony_ci#define RT5682_VREF_POW_FSM (0x0 << 6) 41762306a36Sopenharmony_ci#define RT5682_VREF_POW_REG (0x1 << 6) 41862306a36Sopenharmony_ci#define RT5682_MB1_PATH_MASK (0x1 << 5) 41962306a36Sopenharmony_ci#define RT5682_CTRL_MB1_REG (0x1 << 5) 42062306a36Sopenharmony_ci#define RT5682_CTRL_MB1_FSM (0x0 << 5) 42162306a36Sopenharmony_ci#define RT5682_MB2_PATH_MASK (0x1 << 4) 42262306a36Sopenharmony_ci#define RT5682_CTRL_MB2_REG (0x1 << 4) 42362306a36Sopenharmony_ci#define RT5682_CTRL_MB2_FSM (0x0 << 4) 42462306a36Sopenharmony_ci#define RT5682_TRIG_JD_MASK (0x1 << 3) 42562306a36Sopenharmony_ci#define RT5682_TRIG_JD_HIGH (0x1 << 3) 42662306a36Sopenharmony_ci#define RT5682_TRIG_JD_LOW (0x0 << 3) 42762306a36Sopenharmony_ci#define RT5682_MIC_CAP_MASK (0x1 << 1) 42862306a36Sopenharmony_ci#define RT5682_MIC_CAP_HS (0x1 << 1) 42962306a36Sopenharmony_ci#define RT5682_MIC_CAP_HP (0x0 << 1) 43062306a36Sopenharmony_ci#define RT5682_MIC_CAP_SRC_MASK (0x1) 43162306a36Sopenharmony_ci#define RT5682_MIC_CAP_SRC_REG (0x1) 43262306a36Sopenharmony_ci#define RT5682_MIC_CAP_SRC_ANA (0x0) 43362306a36Sopenharmony_ci 43462306a36Sopenharmony_ci/* Embeeded Jack and Type Detection Control 2 (0x0011) */ 43562306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC (0x7 << 4) 43662306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_SFT 4 43762306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_GPIO_JD1 (0x0 << 4) 43862306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_GPIO_JD2 (0x1 << 4) 43962306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_JDH (0x2 << 4) 44062306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_JDL (0x3 << 4) 44162306a36Sopenharmony_ci#define RT5682_EXT_JD_SRC_MANUAL (0x4 << 4) 44262306a36Sopenharmony_ci#define RT5682_JACK_TYPE_MASK (0x3) 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci/* Combo Jack and Type Detection Control 3 (0x0012) */ 44562306a36Sopenharmony_ci#define RT5682_CBJ_IN_BUF_EN (0x1 << 7) 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_ci/* Combo Jack and Type Detection Control 4 (0x0013) */ 44862306a36Sopenharmony_ci#define RT5682_SEL_SHT_MID_TON_MASK (0x3 << 12) 44962306a36Sopenharmony_ci#define RT5682_SEL_SHT_MID_TON_2 (0x0 << 12) 45062306a36Sopenharmony_ci#define RT5682_SEL_SHT_MID_TON_3 (0x1 << 12) 45162306a36Sopenharmony_ci#define RT5682_CBJ_JD_TEST_MASK (0x1 << 6) 45262306a36Sopenharmony_ci#define RT5682_CBJ_JD_TEST_NORM (0x0 << 6) 45362306a36Sopenharmony_ci#define RT5682_CBJ_JD_TEST_MODE (0x1 << 6) 45462306a36Sopenharmony_ci 45562306a36Sopenharmony_ci/* DAC1 Digital Volume (0x0019) */ 45662306a36Sopenharmony_ci#define RT5682_DAC_L1_VOL_MASK (0xff << 8) 45762306a36Sopenharmony_ci#define RT5682_DAC_L1_VOL_SFT 8 45862306a36Sopenharmony_ci#define RT5682_DAC_R1_VOL_MASK (0xff) 45962306a36Sopenharmony_ci#define RT5682_DAC_R1_VOL_SFT 0 46062306a36Sopenharmony_ci 46162306a36Sopenharmony_ci/* ADC Digital Volume Control (0x001c) */ 46262306a36Sopenharmony_ci#define RT5682_ADC_L_VOL_MASK (0x7f << 8) 46362306a36Sopenharmony_ci#define RT5682_ADC_L_VOL_SFT 8 46462306a36Sopenharmony_ci#define RT5682_ADC_R_VOL_MASK (0x7f) 46562306a36Sopenharmony_ci#define RT5682_ADC_R_VOL_SFT 0 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_ci/* Stereo1 ADC Boost Gain Control (0x001f) */ 46862306a36Sopenharmony_ci#define RT5682_STO1_ADC_L_BST_MASK (0x3 << 14) 46962306a36Sopenharmony_ci#define RT5682_STO1_ADC_L_BST_SFT 14 47062306a36Sopenharmony_ci#define RT5682_STO1_ADC_R_BST_MASK (0x3 << 12) 47162306a36Sopenharmony_ci#define RT5682_STO1_ADC_R_BST_SFT 12 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/* Sidetone Control (0x0024) */ 47462306a36Sopenharmony_ci#define RT5682_ST_SRC_SEL (0x1 << 8) 47562306a36Sopenharmony_ci#define RT5682_ST_SRC_SFT 8 47662306a36Sopenharmony_ci#define RT5682_ST_EN_MASK (0x1 << 6) 47762306a36Sopenharmony_ci#define RT5682_ST_DIS (0x0 << 6) 47862306a36Sopenharmony_ci#define RT5682_ST_EN (0x1 << 6) 47962306a36Sopenharmony_ci#define RT5682_ST_EN_SFT 6 48062306a36Sopenharmony_ci 48162306a36Sopenharmony_ci/* Stereo1 ADC Mixer Control (0x0026) */ 48262306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_L1 (0x1 << 15) 48362306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_L1_SFT 15 48462306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_L2 (0x1 << 14) 48562306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_L2_SFT 14 48662306a36Sopenharmony_ci#define RT5682_STO1_ADC1L_SRC_MASK (0x1 << 13) 48762306a36Sopenharmony_ci#define RT5682_STO1_ADC1L_SRC_SFT 13 48862306a36Sopenharmony_ci#define RT5682_STO1_ADC1_SRC_ADC (0x1 << 13) 48962306a36Sopenharmony_ci#define RT5682_STO1_ADC1_SRC_DACMIX (0x0 << 13) 49062306a36Sopenharmony_ci#define RT5682_STO1_ADC2L_SRC_MASK (0x1 << 12) 49162306a36Sopenharmony_ci#define RT5682_STO1_ADC2L_SRC_SFT 12 49262306a36Sopenharmony_ci#define RT5682_STO1_ADCL_SRC_MASK (0x3 << 10) 49362306a36Sopenharmony_ci#define RT5682_STO1_ADCL_SRC_SFT 10 49462306a36Sopenharmony_ci#define RT5682_STO1_DD_L_SRC_MASK (0x1 << 9) 49562306a36Sopenharmony_ci#define RT5682_STO1_DD_L_SRC_SFT 9 49662306a36Sopenharmony_ci#define RT5682_STO1_DMIC_SRC_MASK (0x1 << 8) 49762306a36Sopenharmony_ci#define RT5682_STO1_DMIC_SRC_SFT 8 49862306a36Sopenharmony_ci#define RT5682_STO1_DMIC_SRC_DMIC2 (0x1 << 8) 49962306a36Sopenharmony_ci#define RT5682_STO1_DMIC_SRC_DMIC1 (0x0 << 8) 50062306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_R1 (0x1 << 7) 50162306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_R1_SFT 7 50262306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_R2 (0x1 << 6) 50362306a36Sopenharmony_ci#define RT5682_M_STO1_ADC_R2_SFT 6 50462306a36Sopenharmony_ci#define RT5682_STO1_ADC1R_SRC_MASK (0x1 << 5) 50562306a36Sopenharmony_ci#define RT5682_STO1_ADC1R_SRC_SFT 5 50662306a36Sopenharmony_ci#define RT5682_STO1_ADC2R_SRC_MASK (0x1 << 4) 50762306a36Sopenharmony_ci#define RT5682_STO1_ADC2R_SRC_SFT 4 50862306a36Sopenharmony_ci#define RT5682_STO1_ADCR_SRC_MASK (0x3 << 2) 50962306a36Sopenharmony_ci#define RT5682_STO1_ADCR_SRC_SFT 2 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_ci/* ADC Mixer to DAC Mixer Control (0x0029) */ 51262306a36Sopenharmony_ci#define RT5682_M_ADCMIX_L (0x1 << 15) 51362306a36Sopenharmony_ci#define RT5682_M_ADCMIX_L_SFT 15 51462306a36Sopenharmony_ci#define RT5682_M_DAC1_L (0x1 << 14) 51562306a36Sopenharmony_ci#define RT5682_M_DAC1_L_SFT 14 51662306a36Sopenharmony_ci#define RT5682_DAC1_R_SEL_MASK (0x1 << 10) 51762306a36Sopenharmony_ci#define RT5682_DAC1_R_SEL_SFT 10 51862306a36Sopenharmony_ci#define RT5682_DAC1_L_SEL_MASK (0x1 << 8) 51962306a36Sopenharmony_ci#define RT5682_DAC1_L_SEL_SFT 8 52062306a36Sopenharmony_ci#define RT5682_M_ADCMIX_R (0x1 << 7) 52162306a36Sopenharmony_ci#define RT5682_M_ADCMIX_R_SFT 7 52262306a36Sopenharmony_ci#define RT5682_M_DAC1_R (0x1 << 6) 52362306a36Sopenharmony_ci#define RT5682_M_DAC1_R_SFT 6 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci/* Stereo1 DAC Mixer Control (0x002a) */ 52662306a36Sopenharmony_ci#define RT5682_M_DAC_L1_STO_L (0x1 << 15) 52762306a36Sopenharmony_ci#define RT5682_M_DAC_L1_STO_L_SFT 15 52862306a36Sopenharmony_ci#define RT5682_G_DAC_L1_STO_L_MASK (0x1 << 14) 52962306a36Sopenharmony_ci#define RT5682_G_DAC_L1_STO_L_SFT 14 53062306a36Sopenharmony_ci#define RT5682_M_DAC_R1_STO_L (0x1 << 13) 53162306a36Sopenharmony_ci#define RT5682_M_DAC_R1_STO_L_SFT 13 53262306a36Sopenharmony_ci#define RT5682_G_DAC_R1_STO_L_MASK (0x1 << 12) 53362306a36Sopenharmony_ci#define RT5682_G_DAC_R1_STO_L_SFT 12 53462306a36Sopenharmony_ci#define RT5682_M_DAC_L1_STO_R (0x1 << 7) 53562306a36Sopenharmony_ci#define RT5682_M_DAC_L1_STO_R_SFT 7 53662306a36Sopenharmony_ci#define RT5682_G_DAC_L1_STO_R_MASK (0x1 << 6) 53762306a36Sopenharmony_ci#define RT5682_G_DAC_L1_STO_R_SFT 6 53862306a36Sopenharmony_ci#define RT5682_M_DAC_R1_STO_R (0x1 << 5) 53962306a36Sopenharmony_ci#define RT5682_M_DAC_R1_STO_R_SFT 5 54062306a36Sopenharmony_ci#define RT5682_G_DAC_R1_STO_R_MASK (0x1 << 4) 54162306a36Sopenharmony_ci#define RT5682_G_DAC_R1_STO_R_SFT 4 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ci/* Analog DAC1 Input Source Control (0x002b) */ 54462306a36Sopenharmony_ci#define RT5682_M_ST_STO_L (0x1 << 9) 54562306a36Sopenharmony_ci#define RT5682_M_ST_STO_L_SFT 9 54662306a36Sopenharmony_ci#define RT5682_M_ST_STO_R (0x1 << 8) 54762306a36Sopenharmony_ci#define RT5682_M_ST_STO_R_SFT 8 54862306a36Sopenharmony_ci#define RT5682_DAC_L1_SRC_MASK (0x3 << 4) 54962306a36Sopenharmony_ci#define RT5682_A_DACL1_SFT 4 55062306a36Sopenharmony_ci#define RT5682_DAC_R1_SRC_MASK (0x3) 55162306a36Sopenharmony_ci#define RT5682_A_DACR1_SFT 0 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci/* Digital Interface Data Control (0x0030) */ 55462306a36Sopenharmony_ci#define RT5682_IF2_ADC_SEL_MASK (0x3 << 0) 55562306a36Sopenharmony_ci#define RT5682_IF2_ADC_SEL_SFT 0 55662306a36Sopenharmony_ci 55762306a36Sopenharmony_ci/* REC Left Mixer Control 2 (0x003c) */ 55862306a36Sopenharmony_ci#define RT5682_G_CBJ_RM1_L (0x7 << 10) 55962306a36Sopenharmony_ci#define RT5682_G_CBJ_RM1_L_SFT 10 56062306a36Sopenharmony_ci#define RT5682_M_CBJ_RM1_L (0x1 << 7) 56162306a36Sopenharmony_ci#define RT5682_M_CBJ_RM1_L_SFT 7 56262306a36Sopenharmony_ci 56362306a36Sopenharmony_ci/* Power Management for Digital 1 (0x0061) */ 56462306a36Sopenharmony_ci#define RT5682_PWR_I2S1 (0x1 << 15) 56562306a36Sopenharmony_ci#define RT5682_PWR_I2S1_BIT 15 56662306a36Sopenharmony_ci#define RT5682_PWR_I2S2 (0x1 << 14) 56762306a36Sopenharmony_ci#define RT5682_PWR_I2S2_BIT 14 56862306a36Sopenharmony_ci#define RT5682_PWR_DAC_L1 (0x1 << 11) 56962306a36Sopenharmony_ci#define RT5682_PWR_DAC_L1_BIT 11 57062306a36Sopenharmony_ci#define RT5682_PWR_DAC_R1 (0x1 << 10) 57162306a36Sopenharmony_ci#define RT5682_PWR_DAC_R1_BIT 10 57262306a36Sopenharmony_ci#define RT5682_PWR_LDO (0x1 << 8) 57362306a36Sopenharmony_ci#define RT5682_PWR_LDO_BIT 8 57462306a36Sopenharmony_ci#define RT5682_PWR_ADC_L1 (0x1 << 4) 57562306a36Sopenharmony_ci#define RT5682_PWR_ADC_L1_BIT 4 57662306a36Sopenharmony_ci#define RT5682_PWR_ADC_R1 (0x1 << 3) 57762306a36Sopenharmony_ci#define RT5682_PWR_ADC_R1_BIT 3 57862306a36Sopenharmony_ci#define RT5682_DIG_GATE_CTRL (0x1 << 0) 57962306a36Sopenharmony_ci#define RT5682_DIG_GATE_CTRL_SFT 0 58062306a36Sopenharmony_ci 58162306a36Sopenharmony_ci 58262306a36Sopenharmony_ci/* Power Management for Digital 2 (0x0062) */ 58362306a36Sopenharmony_ci#define RT5682_PWR_ADC_S1F (0x1 << 15) 58462306a36Sopenharmony_ci#define RT5682_PWR_ADC_S1F_BIT 15 58562306a36Sopenharmony_ci#define RT5682_PWR_DAC_S1F (0x1 << 10) 58662306a36Sopenharmony_ci#define RT5682_PWR_DAC_S1F_BIT 10 58762306a36Sopenharmony_ci 58862306a36Sopenharmony_ci/* Power Management for Analog 1 (0x0063) */ 58962306a36Sopenharmony_ci#define RT5682_PWR_VREF1 (0x1 << 15) 59062306a36Sopenharmony_ci#define RT5682_PWR_VREF1_BIT 15 59162306a36Sopenharmony_ci#define RT5682_PWR_FV1 (0x1 << 14) 59262306a36Sopenharmony_ci#define RT5682_PWR_FV1_BIT 14 59362306a36Sopenharmony_ci#define RT5682_PWR_VREF2 (0x1 << 13) 59462306a36Sopenharmony_ci#define RT5682_PWR_VREF2_BIT 13 59562306a36Sopenharmony_ci#define RT5682_PWR_FV2 (0x1 << 12) 59662306a36Sopenharmony_ci#define RT5682_PWR_FV2_BIT 12 59762306a36Sopenharmony_ci#define RT5682_LDO1_DBG_MASK (0x3 << 10) 59862306a36Sopenharmony_ci#define RT5682_PWR_MB (0x1 << 9) 59962306a36Sopenharmony_ci#define RT5682_PWR_MB_BIT 9 60062306a36Sopenharmony_ci#define RT5682_PWR_BG (0x1 << 7) 60162306a36Sopenharmony_ci#define RT5682_PWR_BG_BIT 7 60262306a36Sopenharmony_ci#define RT5682_LDO1_BYPASS_MASK (0x1 << 6) 60362306a36Sopenharmony_ci#define RT5682_LDO1_BYPASS (0x1 << 6) 60462306a36Sopenharmony_ci#define RT5682_LDO1_NOT_BYPASS (0x0 << 6) 60562306a36Sopenharmony_ci#define RT5682_PWR_MA_BIT 6 60662306a36Sopenharmony_ci#define RT5682_LDO1_DVO_MASK (0x3 << 4) 60762306a36Sopenharmony_ci#define RT5682_LDO1_DVO_09 (0x0 << 4) 60862306a36Sopenharmony_ci#define RT5682_LDO1_DVO_10 (0x1 << 4) 60962306a36Sopenharmony_ci#define RT5682_LDO1_DVO_12 (0x2 << 4) 61062306a36Sopenharmony_ci#define RT5682_LDO1_DVO_14 (0x3 << 4) 61162306a36Sopenharmony_ci#define RT5682_HP_DRIVER_MASK (0x3 << 2) 61262306a36Sopenharmony_ci#define RT5682_HP_DRIVER_1X (0x0 << 2) 61362306a36Sopenharmony_ci#define RT5682_HP_DRIVER_3X (0x1 << 2) 61462306a36Sopenharmony_ci#define RT5682_HP_DRIVER_5X (0x3 << 2) 61562306a36Sopenharmony_ci#define RT5682_PWR_HA_L (0x1 << 1) 61662306a36Sopenharmony_ci#define RT5682_PWR_HA_L_BIT 1 61762306a36Sopenharmony_ci#define RT5682_PWR_HA_R (0x1 << 0) 61862306a36Sopenharmony_ci#define RT5682_PWR_HA_R_BIT 0 61962306a36Sopenharmony_ci 62062306a36Sopenharmony_ci/* Power Management for Analog 2 (0x0064) */ 62162306a36Sopenharmony_ci#define RT5682_PWR_MB1 (0x1 << 11) 62262306a36Sopenharmony_ci#define RT5682_PWR_MB1_PWR_DOWN (0x0 << 11) 62362306a36Sopenharmony_ci#define RT5682_PWR_MB1_BIT 11 62462306a36Sopenharmony_ci#define RT5682_PWR_MB2 (0x1 << 10) 62562306a36Sopenharmony_ci#define RT5682_PWR_MB2_PWR_DOWN (0x0 << 10) 62662306a36Sopenharmony_ci#define RT5682_PWR_MB2_BIT 10 62762306a36Sopenharmony_ci#define RT5682_PWR_JDH (0x1 << 3) 62862306a36Sopenharmony_ci#define RT5682_PWR_JDH_BIT 3 62962306a36Sopenharmony_ci#define RT5682_PWR_JDL (0x1 << 2) 63062306a36Sopenharmony_ci#define RT5682_PWR_JDL_BIT 2 63162306a36Sopenharmony_ci#define RT5682_PWR_RM1_L (0x1 << 1) 63262306a36Sopenharmony_ci#define RT5682_PWR_RM1_L_BIT 1 63362306a36Sopenharmony_ci 63462306a36Sopenharmony_ci/* Power Management for Analog 3 (0x0065) */ 63562306a36Sopenharmony_ci#define RT5682_PWR_CBJ (0x1 << 9) 63662306a36Sopenharmony_ci#define RT5682_PWR_CBJ_BIT 9 63762306a36Sopenharmony_ci#define RT5682_PWR_PLL (0x1 << 6) 63862306a36Sopenharmony_ci#define RT5682_PWR_PLL_BIT 6 63962306a36Sopenharmony_ci#define RT5682_PWR_PLL2B (0x1 << 5) 64062306a36Sopenharmony_ci#define RT5682_PWR_PLL2B_BIT 5 64162306a36Sopenharmony_ci#define RT5682_PWR_PLL2F (0x1 << 4) 64262306a36Sopenharmony_ci#define RT5682_PWR_PLL2F_BIT 4 64362306a36Sopenharmony_ci#define RT5682_PWR_LDO2 (0x1 << 2) 64462306a36Sopenharmony_ci#define RT5682_PWR_LDO2_BIT 2 64562306a36Sopenharmony_ci#define RT5682_PWR_DET_SPKVDD (0x1 << 1) 64662306a36Sopenharmony_ci#define RT5682_PWR_DET_SPKVDD_BIT 1 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_ci/* Power Management for Mixer (0x0066) */ 64962306a36Sopenharmony_ci#define RT5682_PWR_STO1_DAC_L (0x1 << 5) 65062306a36Sopenharmony_ci#define RT5682_PWR_STO1_DAC_L_BIT 5 65162306a36Sopenharmony_ci#define RT5682_PWR_STO1_DAC_R (0x1 << 4) 65262306a36Sopenharmony_ci#define RT5682_PWR_STO1_DAC_R_BIT 4 65362306a36Sopenharmony_ci 65462306a36Sopenharmony_ci/* MCLK and System Clock Detection Control (0x006b) */ 65562306a36Sopenharmony_ci#define RT5682_SYS_CLK_DET (0x1 << 15) 65662306a36Sopenharmony_ci#define RT5682_SYS_CLK_DET_SFT 15 65762306a36Sopenharmony_ci#define RT5682_PLL1_CLK_DET (0x1 << 14) 65862306a36Sopenharmony_ci#define RT5682_PLL1_CLK_DET_SFT 14 65962306a36Sopenharmony_ci#define RT5682_PLL2_CLK_DET (0x1 << 13) 66062306a36Sopenharmony_ci#define RT5682_PLL2_CLK_DET_SFT 13 66162306a36Sopenharmony_ci#define RT5682_POW_CLK_DET2_SFT 8 66262306a36Sopenharmony_ci#define RT5682_POW_CLK_DET_SFT 0 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_ci/* Digital Microphone Control 1 (0x006e) */ 66562306a36Sopenharmony_ci#define RT5682_DMIC_1_EN_MASK (0x1 << 15) 66662306a36Sopenharmony_ci#define RT5682_DMIC_1_EN_SFT 15 66762306a36Sopenharmony_ci#define RT5682_DMIC_1_DIS (0x0 << 15) 66862306a36Sopenharmony_ci#define RT5682_DMIC_1_EN (0x1 << 15) 66962306a36Sopenharmony_ci#define RT5682_FIFO_CLK_DIV_MASK (0x7 << 12) 67062306a36Sopenharmony_ci#define RT5682_FIFO_CLK_DIV_2 (0x1 << 12) 67162306a36Sopenharmony_ci#define RT5682_DMIC_1_DP_MASK (0x3 << 4) 67262306a36Sopenharmony_ci#define RT5682_DMIC_1_DP_SFT 4 67362306a36Sopenharmony_ci#define RT5682_DMIC_1_DP_GPIO2 (0x0 << 4) 67462306a36Sopenharmony_ci#define RT5682_DMIC_1_DP_GPIO5 (0x1 << 4) 67562306a36Sopenharmony_ci#define RT5682_DMIC_CLK_MASK (0xf << 0) 67662306a36Sopenharmony_ci#define RT5682_DMIC_CLK_SFT 0 67762306a36Sopenharmony_ci 67862306a36Sopenharmony_ci/* I2S1 Audio Serial Data Port Control (0x0070) */ 67962306a36Sopenharmony_ci#define RT5682_SEL_ADCDAT_MASK (0x1 << 15) 68062306a36Sopenharmony_ci#define RT5682_SEL_ADCDAT_OUT (0x0 << 15) 68162306a36Sopenharmony_ci#define RT5682_SEL_ADCDAT_IN (0x1 << 15) 68262306a36Sopenharmony_ci#define RT5682_SEL_ADCDAT_SFT 15 68362306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_MASK (0x7 << 12) 68462306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_SFT 12 68562306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_16 (0x0 << 12) 68662306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_20 (0x1 << 12) 68762306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_24 (0x2 << 12) 68862306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_32 (0x3 << 12) 68962306a36Sopenharmony_ci#define RT5682_I2S1_TX_CHL_8 (0x4 << 12) 69062306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_MASK (0x7 << 8) 69162306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_SFT 8 69262306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_16 (0x0 << 8) 69362306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_20 (0x1 << 8) 69462306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_24 (0x2 << 8) 69562306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_32 (0x3 << 8) 69662306a36Sopenharmony_ci#define RT5682_I2S1_RX_CHL_8 (0x4 << 8) 69762306a36Sopenharmony_ci#define RT5682_I2S1_MONO_MASK (0x1 << 7) 69862306a36Sopenharmony_ci#define RT5682_I2S1_MONO_EN (0x1 << 7) 69962306a36Sopenharmony_ci#define RT5682_I2S1_MONO_DIS (0x0 << 7) 70062306a36Sopenharmony_ci#define RT5682_I2S2_MONO_MASK (0x1 << 6) 70162306a36Sopenharmony_ci#define RT5682_I2S2_MONO_EN (0x1 << 6) 70262306a36Sopenharmony_ci#define RT5682_I2S2_MONO_DIS (0x0 << 6) 70362306a36Sopenharmony_ci#define RT5682_I2S1_DL_MASK (0x7 << 4) 70462306a36Sopenharmony_ci#define RT5682_I2S1_DL_SFT 4 70562306a36Sopenharmony_ci#define RT5682_I2S1_DL_16 (0x0 << 4) 70662306a36Sopenharmony_ci#define RT5682_I2S1_DL_20 (0x1 << 4) 70762306a36Sopenharmony_ci#define RT5682_I2S1_DL_24 (0x2 << 4) 70862306a36Sopenharmony_ci#define RT5682_I2S1_DL_32 (0x3 << 4) 70962306a36Sopenharmony_ci#define RT5682_I2S1_DL_8 (0x4 << 4) 71062306a36Sopenharmony_ci 71162306a36Sopenharmony_ci/* I2S1/2 Audio Serial Data Port Control (0x0070)(0x0071) */ 71262306a36Sopenharmony_ci#define RT5682_I2S2_MS_MASK (0x1 << 15) 71362306a36Sopenharmony_ci#define RT5682_I2S2_MS_SFT 15 71462306a36Sopenharmony_ci#define RT5682_I2S2_MS_M (0x0 << 15) 71562306a36Sopenharmony_ci#define RT5682_I2S2_MS_S (0x1 << 15) 71662306a36Sopenharmony_ci#define RT5682_I2S2_PIN_CFG_MASK (0x1 << 14) 71762306a36Sopenharmony_ci#define RT5682_I2S2_PIN_CFG_SFT 14 71862306a36Sopenharmony_ci#define RT5682_I2S2_CLK_SEL_MASK (0x1 << 11) 71962306a36Sopenharmony_ci#define RT5682_I2S2_CLK_SEL_SFT 11 72062306a36Sopenharmony_ci#define RT5682_I2S2_OUT_MASK (0x1 << 9) 72162306a36Sopenharmony_ci#define RT5682_I2S2_OUT_SFT 9 72262306a36Sopenharmony_ci#define RT5682_I2S2_OUT_UM (0x0 << 9) 72362306a36Sopenharmony_ci#define RT5682_I2S2_OUT_M (0x1 << 9) 72462306a36Sopenharmony_ci#define RT5682_I2S_BP_MASK (0x1 << 8) 72562306a36Sopenharmony_ci#define RT5682_I2S_BP_SFT 8 72662306a36Sopenharmony_ci#define RT5682_I2S_BP_NOR (0x0 << 8) 72762306a36Sopenharmony_ci#define RT5682_I2S_BP_INV (0x1 << 8) 72862306a36Sopenharmony_ci#define RT5682_I2S2_MONO_EN (0x1 << 6) 72962306a36Sopenharmony_ci#define RT5682_I2S2_MONO_DIS (0x0 << 6) 73062306a36Sopenharmony_ci#define RT5682_I2S2_DL_MASK (0x3 << 4) 73162306a36Sopenharmony_ci#define RT5682_I2S2_DL_SFT 4 73262306a36Sopenharmony_ci#define RT5682_I2S2_DL_16 (0x0 << 4) 73362306a36Sopenharmony_ci#define RT5682_I2S2_DL_20 (0x1 << 4) 73462306a36Sopenharmony_ci#define RT5682_I2S2_DL_24 (0x2 << 4) 73562306a36Sopenharmony_ci#define RT5682_I2S2_DL_8 (0x3 << 4) 73662306a36Sopenharmony_ci#define RT5682_I2S_DF_MASK (0x7) 73762306a36Sopenharmony_ci#define RT5682_I2S_DF_SFT 0 73862306a36Sopenharmony_ci#define RT5682_I2S_DF_I2S (0x0) 73962306a36Sopenharmony_ci#define RT5682_I2S_DF_LEFT (0x1) 74062306a36Sopenharmony_ci#define RT5682_I2S_DF_PCM_A (0x2) 74162306a36Sopenharmony_ci#define RT5682_I2S_DF_PCM_B (0x3) 74262306a36Sopenharmony_ci#define RT5682_I2S_DF_PCM_A_N (0x6) 74362306a36Sopenharmony_ci#define RT5682_I2S_DF_PCM_B_N (0x7) 74462306a36Sopenharmony_ci 74562306a36Sopenharmony_ci/* ADC/DAC Clock Control 1 (0x0073) */ 74662306a36Sopenharmony_ci#define RT5682_ADC_OSR_MASK (0xf << 12) 74762306a36Sopenharmony_ci#define RT5682_ADC_OSR_SFT 12 74862306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_1 (0x0 << 12) 74962306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_2 (0x1 << 12) 75062306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_4 (0x2 << 12) 75162306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_6 (0x3 << 12) 75262306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_8 (0x4 << 12) 75362306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_12 (0x5 << 12) 75462306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_16 (0x6 << 12) 75562306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_24 (0x7 << 12) 75662306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_32 (0x8 << 12) 75762306a36Sopenharmony_ci#define RT5682_ADC_OSR_D_48 (0x9 << 12) 75862306a36Sopenharmony_ci#define RT5682_I2S_M_DIV_MASK (0xf << 8) 75962306a36Sopenharmony_ci#define RT5682_I2S_M_DIV_SFT 8 76062306a36Sopenharmony_ci#define RT5682_I2S_M_D_1 (0x0 << 8) 76162306a36Sopenharmony_ci#define RT5682_I2S_M_D_2 (0x1 << 8) 76262306a36Sopenharmony_ci#define RT5682_I2S_M_D_3 (0x2 << 8) 76362306a36Sopenharmony_ci#define RT5682_I2S_M_D_4 (0x3 << 8) 76462306a36Sopenharmony_ci#define RT5682_I2S_M_D_6 (0x4 << 8) 76562306a36Sopenharmony_ci#define RT5682_I2S_M_D_8 (0x5 << 8) 76662306a36Sopenharmony_ci#define RT5682_I2S_M_D_12 (0x6 << 8) 76762306a36Sopenharmony_ci#define RT5682_I2S_M_D_16 (0x7 << 8) 76862306a36Sopenharmony_ci#define RT5682_I2S_M_D_24 (0x8 << 8) 76962306a36Sopenharmony_ci#define RT5682_I2S_M_D_32 (0x9 << 8) 77062306a36Sopenharmony_ci#define RT5682_I2S_M_D_48 (0x10 << 8) 77162306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_MASK (0x7 << 4) 77262306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_SFT 4 77362306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_MCLK (0x0 << 4) 77462306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_PLL1 (0x1 << 4) 77562306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_PLL2 (0x2 << 4) 77662306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_SDW (0x3 << 4) 77762306a36Sopenharmony_ci#define RT5682_I2S_CLK_SRC_RCCLK (0x4 << 4) /* 25M */ 77862306a36Sopenharmony_ci#define RT5682_DAC_OSR_MASK (0xf << 0) 77962306a36Sopenharmony_ci#define RT5682_DAC_OSR_SFT 0 78062306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_1 (0x0 << 0) 78162306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_2 (0x1 << 0) 78262306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_4 (0x2 << 0) 78362306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_6 (0x3 << 0) 78462306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_8 (0x4 << 0) 78562306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_12 (0x5 << 0) 78662306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_16 (0x6 << 0) 78762306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_24 (0x7 << 0) 78862306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_32 (0x8 << 0) 78962306a36Sopenharmony_ci#define RT5682_DAC_OSR_D_48 (0x9 << 0) 79062306a36Sopenharmony_ci 79162306a36Sopenharmony_ci/* ADC/DAC Clock Control 2 (0x0074) */ 79262306a36Sopenharmony_ci#define RT5682_I2S2_BCLK_MS2_MASK (0x1 << 11) 79362306a36Sopenharmony_ci#define RT5682_I2S2_BCLK_MS2_SFT 11 79462306a36Sopenharmony_ci#define RT5682_I2S2_BCLK_MS2_32 (0x0 << 11) 79562306a36Sopenharmony_ci#define RT5682_I2S2_BCLK_MS2_64 (0x1 << 11) 79662306a36Sopenharmony_ci 79762306a36Sopenharmony_ci 79862306a36Sopenharmony_ci/* TDM control 1 (0x0079) */ 79962306a36Sopenharmony_ci#define RT5682_TDM_TX_CH_MASK (0x3 << 12) 80062306a36Sopenharmony_ci#define RT5682_TDM_TX_CH_2 (0x0 << 12) 80162306a36Sopenharmony_ci#define RT5682_TDM_TX_CH_4 (0x1 << 12) 80262306a36Sopenharmony_ci#define RT5682_TDM_TX_CH_6 (0x2 << 12) 80362306a36Sopenharmony_ci#define RT5682_TDM_TX_CH_8 (0x3 << 12) 80462306a36Sopenharmony_ci#define RT5682_TDM_RX_CH_MASK (0x3 << 8) 80562306a36Sopenharmony_ci#define RT5682_TDM_RX_CH_2 (0x0 << 8) 80662306a36Sopenharmony_ci#define RT5682_TDM_RX_CH_4 (0x1 << 8) 80762306a36Sopenharmony_ci#define RT5682_TDM_RX_CH_6 (0x2 << 8) 80862306a36Sopenharmony_ci#define RT5682_TDM_RX_CH_8 (0x3 << 8) 80962306a36Sopenharmony_ci#define RT5682_TDM_ADC_LCA_MASK (0xf << 4) 81062306a36Sopenharmony_ci#define RT5682_TDM_ADC_LCA_SFT 4 81162306a36Sopenharmony_ci#define RT5682_TDM_ADC_DL_SFT 0 81262306a36Sopenharmony_ci 81362306a36Sopenharmony_ci/* TDM control 2 (0x007a) */ 81462306a36Sopenharmony_ci#define RT5682_IF1_ADC1_SEL_SFT 14 81562306a36Sopenharmony_ci#define RT5682_IF1_ADC2_SEL_SFT 12 81662306a36Sopenharmony_ci#define RT5682_IF1_ADC3_SEL_SFT 10 81762306a36Sopenharmony_ci#define RT5682_IF1_ADC4_SEL_SFT 8 81862306a36Sopenharmony_ci#define RT5682_TDM_ADC_SEL_SFT 4 81962306a36Sopenharmony_ci 82062306a36Sopenharmony_ci/* TDM control 3 (0x007b) */ 82162306a36Sopenharmony_ci#define RT5682_TDM_EN (0x1 << 7) 82262306a36Sopenharmony_ci 82362306a36Sopenharmony_ci/* TDM/I2S control (0x007e) */ 82462306a36Sopenharmony_ci#define RT5682_TDM_S_BP_MASK (0x1 << 15) 82562306a36Sopenharmony_ci#define RT5682_TDM_S_BP_SFT 15 82662306a36Sopenharmony_ci#define RT5682_TDM_S_BP_NOR (0x0 << 15) 82762306a36Sopenharmony_ci#define RT5682_TDM_S_BP_INV (0x1 << 15) 82862306a36Sopenharmony_ci#define RT5682_TDM_S_LP_MASK (0x1 << 14) 82962306a36Sopenharmony_ci#define RT5682_TDM_S_LP_SFT 14 83062306a36Sopenharmony_ci#define RT5682_TDM_S_LP_NOR (0x0 << 14) 83162306a36Sopenharmony_ci#define RT5682_TDM_S_LP_INV (0x1 << 14) 83262306a36Sopenharmony_ci#define RT5682_TDM_DF_MASK (0x7 << 11) 83362306a36Sopenharmony_ci#define RT5682_TDM_DF_SFT 11 83462306a36Sopenharmony_ci#define RT5682_TDM_DF_I2S (0x0 << 11) 83562306a36Sopenharmony_ci#define RT5682_TDM_DF_LEFT (0x1 << 11) 83662306a36Sopenharmony_ci#define RT5682_TDM_DF_PCM_A (0x2 << 11) 83762306a36Sopenharmony_ci#define RT5682_TDM_DF_PCM_B (0x3 << 11) 83862306a36Sopenharmony_ci#define RT5682_TDM_DF_PCM_A_N (0x6 << 11) 83962306a36Sopenharmony_ci#define RT5682_TDM_DF_PCM_B_N (0x7 << 11) 84062306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_MASK (0x3 << 9) 84162306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_SFT 9 84262306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_32 (0x0 << 9) 84362306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_64 (0x1 << 9) 84462306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_128 (0x2 << 9) 84562306a36Sopenharmony_ci#define RT5682_TDM_BCLK_MS1_256 (0x3 << 9) 84662306a36Sopenharmony_ci#define RT5682_TDM_CL_MASK (0x3 << 4) 84762306a36Sopenharmony_ci#define RT5682_TDM_CL_16 (0x0 << 4) 84862306a36Sopenharmony_ci#define RT5682_TDM_CL_20 (0x1 << 4) 84962306a36Sopenharmony_ci#define RT5682_TDM_CL_24 (0x2 << 4) 85062306a36Sopenharmony_ci#define RT5682_TDM_CL_32 (0x3 << 4) 85162306a36Sopenharmony_ci#define RT5682_TDM_M_BP_MASK (0x1 << 2) 85262306a36Sopenharmony_ci#define RT5682_TDM_M_BP_SFT 2 85362306a36Sopenharmony_ci#define RT5682_TDM_M_BP_NOR (0x0 << 2) 85462306a36Sopenharmony_ci#define RT5682_TDM_M_BP_INV (0x1 << 2) 85562306a36Sopenharmony_ci#define RT5682_TDM_M_LP_MASK (0x1 << 1) 85662306a36Sopenharmony_ci#define RT5682_TDM_M_LP_SFT 1 85762306a36Sopenharmony_ci#define RT5682_TDM_M_LP_NOR (0x0 << 1) 85862306a36Sopenharmony_ci#define RT5682_TDM_M_LP_INV (0x1 << 1) 85962306a36Sopenharmony_ci#define RT5682_TDM_MS_MASK (0x1 << 0) 86062306a36Sopenharmony_ci#define RT5682_TDM_MS_SFT 0 86162306a36Sopenharmony_ci#define RT5682_TDM_MS_S (0x0 << 0) 86262306a36Sopenharmony_ci#define RT5682_TDM_MS_M (0x1 << 0) 86362306a36Sopenharmony_ci 86462306a36Sopenharmony_ci/* Global Clock Control (0x0080) */ 86562306a36Sopenharmony_ci#define RT5682_SCLK_SRC_MASK (0x7 << 13) 86662306a36Sopenharmony_ci#define RT5682_SCLK_SRC_SFT 13 86762306a36Sopenharmony_ci#define RT5682_SCLK_SRC_MCLK (0x0 << 13) 86862306a36Sopenharmony_ci#define RT5682_SCLK_SRC_PLL1 (0x1 << 13) 86962306a36Sopenharmony_ci#define RT5682_SCLK_SRC_PLL2 (0x2 << 13) 87062306a36Sopenharmony_ci#define RT5682_SCLK_SRC_SDW (0x3 << 13) 87162306a36Sopenharmony_ci#define RT5682_SCLK_SRC_RCCLK (0x4 << 13) 87262306a36Sopenharmony_ci#define RT5682_PLL2_SRC_MASK (0x3 << 10) 87362306a36Sopenharmony_ci#define RT5682_PLL2_SRC_SFT 10 87462306a36Sopenharmony_ci#define RT5682_PLL2_SRC_MCLK (0x0 << 10) 87562306a36Sopenharmony_ci#define RT5682_PLL2_SRC_BCLK1 (0x1 << 10) 87662306a36Sopenharmony_ci#define RT5682_PLL2_SRC_SDW (0x2 << 10) 87762306a36Sopenharmony_ci#define RT5682_PLL2_SRC_RC (0x3 << 10) 87862306a36Sopenharmony_ci#define RT5682_PLL1_SRC_MASK (0x3 << 8) 87962306a36Sopenharmony_ci#define RT5682_PLL1_SRC_SFT 8 88062306a36Sopenharmony_ci#define RT5682_PLL1_SRC_MCLK (0x0 << 8) 88162306a36Sopenharmony_ci#define RT5682_PLL1_SRC_BCLK1 (0x1 << 8) 88262306a36Sopenharmony_ci#define RT5682_PLL1_SRC_SDW (0x2 << 8) 88362306a36Sopenharmony_ci#define RT5682_PLL1_SRC_RC (0x3 << 8) 88462306a36Sopenharmony_ci 88562306a36Sopenharmony_ci 88662306a36Sopenharmony_ci 88762306a36Sopenharmony_ci#define RT5682_PLL_INP_MAX 40000000 88862306a36Sopenharmony_ci#define RT5682_PLL_INP_MIN 256000 88962306a36Sopenharmony_ci/* PLL M/N/K Code Control 1 (0x0081) */ 89062306a36Sopenharmony_ci#define RT5682_PLL_N_MAX 0x001ff 89162306a36Sopenharmony_ci#define RT5682_PLL_N_MASK (RT5682_PLL_N_MAX << 7) 89262306a36Sopenharmony_ci#define RT5682_PLL_N_SFT 7 89362306a36Sopenharmony_ci#define RT5682_PLL_K_MAX 0x001f 89462306a36Sopenharmony_ci#define RT5682_PLL_K_MASK (RT5682_PLL_K_MAX) 89562306a36Sopenharmony_ci#define RT5682_PLL_K_SFT 0 89662306a36Sopenharmony_ci 89762306a36Sopenharmony_ci/* PLL M/N/K Code Control 2 (0x0082) */ 89862306a36Sopenharmony_ci#define RT5682_PLL_M_MAX 0x00f 89962306a36Sopenharmony_ci#define RT5682_PLL_M_MASK (RT5682_PLL_M_MAX << 12) 90062306a36Sopenharmony_ci#define RT5682_PLL_M_SFT 12 90162306a36Sopenharmony_ci#define RT5682_PLL_M_BP (0x1 << 11) 90262306a36Sopenharmony_ci#define RT5682_PLL_M_BP_SFT 11 90362306a36Sopenharmony_ci#define RT5682_PLL_K_BP (0x1 << 10) 90462306a36Sopenharmony_ci#define RT5682_PLL_K_BP_SFT 10 90562306a36Sopenharmony_ci#define RT5682_PLL_RST (0x1 << 1) 90662306a36Sopenharmony_ci 90762306a36Sopenharmony_ci/* PLL tracking mode 1 (0x0083) */ 90862306a36Sopenharmony_ci#define RT5682_DA_ASRC_MASK (0x1 << 13) 90962306a36Sopenharmony_ci#define RT5682_DA_ASRC_SFT 13 91062306a36Sopenharmony_ci#define RT5682_DAC_STO1_ASRC_MASK (0x1 << 12) 91162306a36Sopenharmony_ci#define RT5682_DAC_STO1_ASRC_SFT 12 91262306a36Sopenharmony_ci#define RT5682_AD_ASRC_MASK (0x1 << 8) 91362306a36Sopenharmony_ci#define RT5682_AD_ASRC_SFT 8 91462306a36Sopenharmony_ci#define RT5682_AD_ASRC_SEL_MASK (0x1 << 4) 91562306a36Sopenharmony_ci#define RT5682_AD_ASRC_SEL_SFT 4 91662306a36Sopenharmony_ci#define RT5682_DMIC_ASRC_MASK (0x1 << 3) 91762306a36Sopenharmony_ci#define RT5682_DMIC_ASRC_SFT 3 91862306a36Sopenharmony_ci#define RT5682_ADC_STO1_ASRC_MASK (0x1 << 2) 91962306a36Sopenharmony_ci#define RT5682_ADC_STO1_ASRC_SFT 2 92062306a36Sopenharmony_ci#define RT5682_DA_ASRC_SEL_MASK (0x1 << 0) 92162306a36Sopenharmony_ci#define RT5682_DA_ASRC_SEL_SFT 0 92262306a36Sopenharmony_ci 92362306a36Sopenharmony_ci/* PLL tracking mode 2 3 (0x0084)(0x0085)*/ 92462306a36Sopenharmony_ci#define RT5682_FILTER_CLK_SEL_MASK (0x7 << 12) 92562306a36Sopenharmony_ci#define RT5682_FILTER_CLK_SEL_SFT 12 92662306a36Sopenharmony_ci#define RT5682_FILTER_CLK_DIV_MASK (0xf << 8) 92762306a36Sopenharmony_ci#define RT5682_FILTER_CLK_DIV_SFT 8 92862306a36Sopenharmony_ci 92962306a36Sopenharmony_ci/* ASRC Control 4 (0x0086) */ 93062306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_N1_MASK (0x3 << 14) 93162306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_N1_SFT 14 93262306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_N2_MASK (0x3 << 12) 93362306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_N2_SFT 12 93462306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_M1_MASK (0x7 << 8) 93562306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_M1_SFT 8 93662306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_M2_MASK (0x7 << 4) 93762306a36Sopenharmony_ci#define RT5682_ASRCIN_FTK_M2_SFT 4 93862306a36Sopenharmony_ci 93962306a36Sopenharmony_ci/* SoundWire reference clk (0x008d) */ 94062306a36Sopenharmony_ci#define RT5682_PLL2_OUT_MASK (0x1 << 8) 94162306a36Sopenharmony_ci#define RT5682_PLL2_OUT_98M (0x0 << 8) 94262306a36Sopenharmony_ci#define RT5682_PLL2_OUT_49M (0x1 << 8) 94362306a36Sopenharmony_ci#define RT5682_SDW_REF_2_MASK (0xf << 4) 94462306a36Sopenharmony_ci#define RT5682_SDW_REF_2_SFT 4 94562306a36Sopenharmony_ci#define RT5682_SDW_REF_2_48K (0x0 << 4) 94662306a36Sopenharmony_ci#define RT5682_SDW_REF_2_96K (0x1 << 4) 94762306a36Sopenharmony_ci#define RT5682_SDW_REF_2_192K (0x2 << 4) 94862306a36Sopenharmony_ci#define RT5682_SDW_REF_2_32K (0x3 << 4) 94962306a36Sopenharmony_ci#define RT5682_SDW_REF_2_24K (0x4 << 4) 95062306a36Sopenharmony_ci#define RT5682_SDW_REF_2_16K (0x5 << 4) 95162306a36Sopenharmony_ci#define RT5682_SDW_REF_2_12K (0x6 << 4) 95262306a36Sopenharmony_ci#define RT5682_SDW_REF_2_8K (0x7 << 4) 95362306a36Sopenharmony_ci#define RT5682_SDW_REF_2_44K (0x8 << 4) 95462306a36Sopenharmony_ci#define RT5682_SDW_REF_2_88K (0x9 << 4) 95562306a36Sopenharmony_ci#define RT5682_SDW_REF_2_176K (0xa << 4) 95662306a36Sopenharmony_ci#define RT5682_SDW_REF_2_353K (0xb << 4) 95762306a36Sopenharmony_ci#define RT5682_SDW_REF_2_22K (0xc << 4) 95862306a36Sopenharmony_ci#define RT5682_SDW_REF_2_384K (0xd << 4) 95962306a36Sopenharmony_ci#define RT5682_SDW_REF_2_11K (0xe << 4) 96062306a36Sopenharmony_ci#define RT5682_SDW_REF_1_MASK (0xf << 0) 96162306a36Sopenharmony_ci#define RT5682_SDW_REF_1_SFT 0 96262306a36Sopenharmony_ci#define RT5682_SDW_REF_1_48K (0x0 << 0) 96362306a36Sopenharmony_ci#define RT5682_SDW_REF_1_96K (0x1 << 0) 96462306a36Sopenharmony_ci#define RT5682_SDW_REF_1_192K (0x2 << 0) 96562306a36Sopenharmony_ci#define RT5682_SDW_REF_1_32K (0x3 << 0) 96662306a36Sopenharmony_ci#define RT5682_SDW_REF_1_24K (0x4 << 0) 96762306a36Sopenharmony_ci#define RT5682_SDW_REF_1_16K (0x5 << 0) 96862306a36Sopenharmony_ci#define RT5682_SDW_REF_1_12K (0x6 << 0) 96962306a36Sopenharmony_ci#define RT5682_SDW_REF_1_8K (0x7 << 0) 97062306a36Sopenharmony_ci#define RT5682_SDW_REF_1_44K (0x8 << 0) 97162306a36Sopenharmony_ci#define RT5682_SDW_REF_1_88K (0x9 << 0) 97262306a36Sopenharmony_ci#define RT5682_SDW_REF_1_176K (0xa << 0) 97362306a36Sopenharmony_ci#define RT5682_SDW_REF_1_353K (0xb << 0) 97462306a36Sopenharmony_ci#define RT5682_SDW_REF_1_22K (0xc << 0) 97562306a36Sopenharmony_ci#define RT5682_SDW_REF_1_384K (0xd << 0) 97662306a36Sopenharmony_ci#define RT5682_SDW_REF_1_11K (0xe << 0) 97762306a36Sopenharmony_ci 97862306a36Sopenharmony_ci/* Depop Mode Control 1 (0x008e) */ 97962306a36Sopenharmony_ci#define RT5682_PUMP_EN (0x1 << 3) 98062306a36Sopenharmony_ci#define RT5682_PUMP_EN_SFT 3 98162306a36Sopenharmony_ci#define RT5682_CAPLESS_EN (0x1 << 0) 98262306a36Sopenharmony_ci#define RT5682_CAPLESS_EN_SFT 0 98362306a36Sopenharmony_ci 98462306a36Sopenharmony_ci/* Depop Mode Control 2 (0x8f) */ 98562306a36Sopenharmony_ci#define RT5682_RAMP_MASK (0x1 << 12) 98662306a36Sopenharmony_ci#define RT5682_RAMP_SFT 12 98762306a36Sopenharmony_ci#define RT5682_RAMP_DIS (0x0 << 12) 98862306a36Sopenharmony_ci#define RT5682_RAMP_EN (0x1 << 12) 98962306a36Sopenharmony_ci#define RT5682_BPS_MASK (0x1 << 11) 99062306a36Sopenharmony_ci#define RT5682_BPS_SFT 11 99162306a36Sopenharmony_ci#define RT5682_BPS_DIS (0x0 << 11) 99262306a36Sopenharmony_ci#define RT5682_BPS_EN (0x1 << 11) 99362306a36Sopenharmony_ci#define RT5682_FAST_UPDN_MASK (0x1 << 10) 99462306a36Sopenharmony_ci#define RT5682_FAST_UPDN_SFT 10 99562306a36Sopenharmony_ci#define RT5682_FAST_UPDN_DIS (0x0 << 10) 99662306a36Sopenharmony_ci#define RT5682_FAST_UPDN_EN (0x1 << 10) 99762306a36Sopenharmony_ci#define RT5682_VLO_MASK (0x1 << 7) 99862306a36Sopenharmony_ci#define RT5682_VLO_SFT 7 99962306a36Sopenharmony_ci#define RT5682_VLO_3V (0x0 << 7) 100062306a36Sopenharmony_ci#define RT5682_VLO_33V (0x1 << 7) 100162306a36Sopenharmony_ci 100262306a36Sopenharmony_ci/* HPOUT charge pump 1 (0x0091) */ 100362306a36Sopenharmony_ci#define RT5682_OSW_L_MASK (0x1 << 11) 100462306a36Sopenharmony_ci#define RT5682_OSW_L_SFT 11 100562306a36Sopenharmony_ci#define RT5682_OSW_L_DIS (0x0 << 11) 100662306a36Sopenharmony_ci#define RT5682_OSW_L_EN (0x1 << 11) 100762306a36Sopenharmony_ci#define RT5682_OSW_R_MASK (0x1 << 10) 100862306a36Sopenharmony_ci#define RT5682_OSW_R_SFT 10 100962306a36Sopenharmony_ci#define RT5682_OSW_R_DIS (0x0 << 10) 101062306a36Sopenharmony_ci#define RT5682_OSW_R_EN (0x1 << 10) 101162306a36Sopenharmony_ci#define RT5682_PM_HP_MASK (0x3 << 8) 101262306a36Sopenharmony_ci#define RT5682_PM_HP_SFT 8 101362306a36Sopenharmony_ci#define RT5682_PM_HP_LV (0x0 << 8) 101462306a36Sopenharmony_ci#define RT5682_PM_HP_MV (0x1 << 8) 101562306a36Sopenharmony_ci#define RT5682_PM_HP_HV (0x2 << 8) 101662306a36Sopenharmony_ci#define RT5682_IB_HP_MASK (0x3 << 6) 101762306a36Sopenharmony_ci#define RT5682_IB_HP_SFT 6 101862306a36Sopenharmony_ci#define RT5682_IB_HP_125IL (0x0 << 6) 101962306a36Sopenharmony_ci#define RT5682_IB_HP_25IL (0x1 << 6) 102062306a36Sopenharmony_ci#define RT5682_IB_HP_5IL (0x2 << 6) 102162306a36Sopenharmony_ci#define RT5682_IB_HP_1IL (0x3 << 6) 102262306a36Sopenharmony_ci 102362306a36Sopenharmony_ci/* Micbias Control1 (0x93) */ 102462306a36Sopenharmony_ci#define RT5682_MIC1_OV_MASK (0x3 << 14) 102562306a36Sopenharmony_ci#define RT5682_MIC1_OV_SFT 14 102662306a36Sopenharmony_ci#define RT5682_MIC1_OV_2V7 (0x0 << 14) 102762306a36Sopenharmony_ci#define RT5682_MIC1_OV_2V4 (0x1 << 14) 102862306a36Sopenharmony_ci#define RT5682_MIC1_OV_2V25 (0x3 << 14) 102962306a36Sopenharmony_ci#define RT5682_MIC1_OV_1V8 (0x4 << 14) 103062306a36Sopenharmony_ci#define RT5682_MIC1_CLK_MASK (0x1 << 13) 103162306a36Sopenharmony_ci#define RT5682_MIC1_CLK_SFT 13 103262306a36Sopenharmony_ci#define RT5682_MIC1_CLK_DIS (0x0 << 13) 103362306a36Sopenharmony_ci#define RT5682_MIC1_CLK_EN (0x1 << 13) 103462306a36Sopenharmony_ci#define RT5682_MIC1_OVCD_MASK (0x1 << 12) 103562306a36Sopenharmony_ci#define RT5682_MIC1_OVCD_SFT 12 103662306a36Sopenharmony_ci#define RT5682_MIC1_OVCD_DIS (0x0 << 12) 103762306a36Sopenharmony_ci#define RT5682_MIC1_OVCD_EN (0x1 << 12) 103862306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_MASK (0x3 << 10) 103962306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_SFT 10 104062306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_768UA (0x0 << 10) 104162306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_960UA (0x1 << 10) 104262306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_1152UA (0x2 << 10) 104362306a36Sopenharmony_ci#define RT5682_MIC1_OVTH_1960UA (0x3 << 10) 104462306a36Sopenharmony_ci#define RT5682_MIC2_OV_MASK (0x3 << 8) 104562306a36Sopenharmony_ci#define RT5682_MIC2_OV_SFT 8 104662306a36Sopenharmony_ci#define RT5682_MIC2_OV_2V7 (0x0 << 8) 104762306a36Sopenharmony_ci#define RT5682_MIC2_OV_2V4 (0x1 << 8) 104862306a36Sopenharmony_ci#define RT5682_MIC2_OV_2V25 (0x3 << 8) 104962306a36Sopenharmony_ci#define RT5682_MIC2_OV_1V8 (0x4 << 8) 105062306a36Sopenharmony_ci#define RT5682_MIC2_CLK_MASK (0x1 << 7) 105162306a36Sopenharmony_ci#define RT5682_MIC2_CLK_SFT 7 105262306a36Sopenharmony_ci#define RT5682_MIC2_CLK_DIS (0x0 << 7) 105362306a36Sopenharmony_ci#define RT5682_MIC2_CLK_EN (0x1 << 7) 105462306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_MASK (0x3 << 4) 105562306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_SFT 4 105662306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_768UA (0x0 << 4) 105762306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_960UA (0x1 << 4) 105862306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_1152UA (0x2 << 4) 105962306a36Sopenharmony_ci#define RT5682_MIC2_OVTH_1960UA (0x3 << 4) 106062306a36Sopenharmony_ci#define RT5682_PWR_MB_MASK (0x1 << 3) 106162306a36Sopenharmony_ci#define RT5682_PWR_MB_SFT 3 106262306a36Sopenharmony_ci#define RT5682_PWR_MB_PD (0x0 << 3) 106362306a36Sopenharmony_ci#define RT5682_PWR_MB_PU (0x1 << 3) 106462306a36Sopenharmony_ci 106562306a36Sopenharmony_ci/* Micbias Control2 (0x0094) */ 106662306a36Sopenharmony_ci#define RT5682_PWR_CLK25M_MASK (0x1 << 9) 106762306a36Sopenharmony_ci#define RT5682_PWR_CLK25M_SFT 9 106862306a36Sopenharmony_ci#define RT5682_PWR_CLK25M_PD (0x0 << 9) 106962306a36Sopenharmony_ci#define RT5682_PWR_CLK25M_PU (0x1 << 9) 107062306a36Sopenharmony_ci#define RT5682_PWR_CLK1M_MASK (0x1 << 8) 107162306a36Sopenharmony_ci#define RT5682_PWR_CLK1M_SFT 8 107262306a36Sopenharmony_ci#define RT5682_PWR_CLK1M_PD (0x0 << 8) 107362306a36Sopenharmony_ci#define RT5682_PWR_CLK1M_PU (0x1 << 8) 107462306a36Sopenharmony_ci 107562306a36Sopenharmony_ci/* PLL2 M/N/K Code Control 1 (0x009b) */ 107662306a36Sopenharmony_ci#define RT5682_PLL2F_K_MASK (0x1f << 8) 107762306a36Sopenharmony_ci#define RT5682_PLL2F_K_SFT 8 107862306a36Sopenharmony_ci#define RT5682_PLL2B_K_MASK (0xf << 4) 107962306a36Sopenharmony_ci#define RT5682_PLL2B_K_SFT 4 108062306a36Sopenharmony_ci#define RT5682_PLL2B_M_MASK (0xf << 0) 108162306a36Sopenharmony_ci 108262306a36Sopenharmony_ci/* PLL2 M/N/K Code Control 2 (0x009c) */ 108362306a36Sopenharmony_ci#define RT5682_PLL2F_M_MASK (0x3f << 8) 108462306a36Sopenharmony_ci#define RT5682_PLL2F_M_SFT 8 108562306a36Sopenharmony_ci#define RT5682_PLL2B_N_MASK (0x3f << 0) 108662306a36Sopenharmony_ci 108762306a36Sopenharmony_ci/* PLL2 M/N/K Code Control 2 (0x009d) */ 108862306a36Sopenharmony_ci#define RT5682_PLL2F_N_MASK (0x7f << 8) 108962306a36Sopenharmony_ci#define RT5682_PLL2F_N_SFT 8 109062306a36Sopenharmony_ci 109162306a36Sopenharmony_ci/* PLL2 M/N/K Code Control 2 (0x009e) */ 109262306a36Sopenharmony_ci#define RT5682_PLL2B_SEL_PS_MASK (0x1 << 13) 109362306a36Sopenharmony_ci#define RT5682_PLL2B_SEL_PS_SFT 13 109462306a36Sopenharmony_ci#define RT5682_PLL2B_PS_BYP_MASK (0x1 << 12) 109562306a36Sopenharmony_ci#define RT5682_PLL2B_PS_BYP_SFT 12 109662306a36Sopenharmony_ci#define RT5682_PLL2B_M_BP_MASK (0x1 << 11) 109762306a36Sopenharmony_ci#define RT5682_PLL2B_M_BP_SFT 11 109862306a36Sopenharmony_ci#define RT5682_PLL2F_M_BP_MASK (0x1 << 7) 109962306a36Sopenharmony_ci#define RT5682_PLL2F_M_BP_SFT 7 110062306a36Sopenharmony_ci 110162306a36Sopenharmony_ci/* RC Clock Control (0x009f) */ 110262306a36Sopenharmony_ci#define RT5682_POW_IRQ (0x1 << 15) 110362306a36Sopenharmony_ci#define RT5682_POW_JDH (0x1 << 14) 110462306a36Sopenharmony_ci#define RT5682_POW_JDL (0x1 << 13) 110562306a36Sopenharmony_ci#define RT5682_POW_ANA (0x1 << 12) 110662306a36Sopenharmony_ci 110762306a36Sopenharmony_ci/* I2S Master Mode Clock Control 1 (0x00a0) */ 110862306a36Sopenharmony_ci#define RT5682_CLK_SRC_MCLK (0x0) 110962306a36Sopenharmony_ci#define RT5682_CLK_SRC_PLL1 (0x1) 111062306a36Sopenharmony_ci#define RT5682_CLK_SRC_PLL2 (0x2) 111162306a36Sopenharmony_ci#define RT5682_CLK_SRC_SDW (0x3) 111262306a36Sopenharmony_ci#define RT5682_CLK_SRC_RCCLK (0x4) 111362306a36Sopenharmony_ci#define RT5682_I2S_PD_1 (0x0) 111462306a36Sopenharmony_ci#define RT5682_I2S_PD_2 (0x1) 111562306a36Sopenharmony_ci#define RT5682_I2S_PD_3 (0x2) 111662306a36Sopenharmony_ci#define RT5682_I2S_PD_4 (0x3) 111762306a36Sopenharmony_ci#define RT5682_I2S_PD_6 (0x4) 111862306a36Sopenharmony_ci#define RT5682_I2S_PD_8 (0x5) 111962306a36Sopenharmony_ci#define RT5682_I2S_PD_12 (0x6) 112062306a36Sopenharmony_ci#define RT5682_I2S_PD_16 (0x7) 112162306a36Sopenharmony_ci#define RT5682_I2S_PD_24 (0x8) 112262306a36Sopenharmony_ci#define RT5682_I2S_PD_32 (0x9) 112362306a36Sopenharmony_ci#define RT5682_I2S_PD_48 (0xa) 112462306a36Sopenharmony_ci#define RT5682_I2S2_SRC_MASK (0x3 << 4) 112562306a36Sopenharmony_ci#define RT5682_I2S2_SRC_SFT 4 112662306a36Sopenharmony_ci#define RT5682_I2S2_M_PD_MASK (0xf << 0) 112762306a36Sopenharmony_ci#define RT5682_I2S2_M_PD_SFT 0 112862306a36Sopenharmony_ci 112962306a36Sopenharmony_ci/* IRQ Control 1 (0x00b6) */ 113062306a36Sopenharmony_ci#define RT5682_JD1_PULSE_EN_MASK (0x1 << 10) 113162306a36Sopenharmony_ci#define RT5682_JD1_PULSE_EN_SFT 10 113262306a36Sopenharmony_ci#define RT5682_JD1_PULSE_DIS (0x0 << 10) 113362306a36Sopenharmony_ci#define RT5682_JD1_PULSE_EN (0x1 << 10) 113462306a36Sopenharmony_ci 113562306a36Sopenharmony_ci/* IRQ Control 2 (0x00b7) */ 113662306a36Sopenharmony_ci#define RT5682_JD1_EN_MASK (0x1 << 15) 113762306a36Sopenharmony_ci#define RT5682_JD1_EN_SFT 15 113862306a36Sopenharmony_ci#define RT5682_JD1_DIS (0x0 << 15) 113962306a36Sopenharmony_ci#define RT5682_JD1_EN (0x1 << 15) 114062306a36Sopenharmony_ci#define RT5682_JD1_POL_MASK (0x1 << 13) 114162306a36Sopenharmony_ci#define RT5682_JD1_POL_NOR (0x0 << 13) 114262306a36Sopenharmony_ci#define RT5682_JD1_POL_INV (0x1 << 13) 114362306a36Sopenharmony_ci#define RT5682_JD1_IRQ_MASK (0x1 << 10) 114462306a36Sopenharmony_ci#define RT5682_JD1_IRQ_LEV (0x0 << 10) 114562306a36Sopenharmony_ci#define RT5682_JD1_IRQ_PUL (0x1 << 10) 114662306a36Sopenharmony_ci 114762306a36Sopenharmony_ci/* IRQ Control 3 (0x00b8) */ 114862306a36Sopenharmony_ci#define RT5682_IL_IRQ_MASK (0x1 << 7) 114962306a36Sopenharmony_ci#define RT5682_IL_IRQ_DIS (0x0 << 7) 115062306a36Sopenharmony_ci#define RT5682_IL_IRQ_EN (0x1 << 7) 115162306a36Sopenharmony_ci#define RT5682_IL_IRQ_TYPE_MASK (0x1 << 4) 115262306a36Sopenharmony_ci#define RT5682_IL_IRQ_LEV (0x0 << 4) 115362306a36Sopenharmony_ci#define RT5682_IL_IRQ_PUL (0x1 << 4) 115462306a36Sopenharmony_ci 115562306a36Sopenharmony_ci/* GPIO Control 1 (0x00c0) */ 115662306a36Sopenharmony_ci#define RT5682_GP1_PIN_MASK (0x3 << 14) 115762306a36Sopenharmony_ci#define RT5682_GP1_PIN_SFT 14 115862306a36Sopenharmony_ci#define RT5682_GP1_PIN_GPIO1 (0x0 << 14) 115962306a36Sopenharmony_ci#define RT5682_GP1_PIN_IRQ (0x1 << 14) 116062306a36Sopenharmony_ci#define RT5682_GP1_PIN_DMIC_CLK (0x2 << 14) 116162306a36Sopenharmony_ci#define RT5682_GP2_PIN_MASK (0x3 << 12) 116262306a36Sopenharmony_ci#define RT5682_GP2_PIN_SFT 12 116362306a36Sopenharmony_ci#define RT5682_GP2_PIN_GPIO2 (0x0 << 12) 116462306a36Sopenharmony_ci#define RT5682_GP2_PIN_LRCK2 (0x1 << 12) 116562306a36Sopenharmony_ci#define RT5682_GP2_PIN_DMIC_SDA (0x2 << 12) 116662306a36Sopenharmony_ci#define RT5682_GP3_PIN_MASK (0x3 << 10) 116762306a36Sopenharmony_ci#define RT5682_GP3_PIN_SFT 10 116862306a36Sopenharmony_ci#define RT5682_GP3_PIN_GPIO3 (0x0 << 10) 116962306a36Sopenharmony_ci#define RT5682_GP3_PIN_BCLK2 (0x1 << 10) 117062306a36Sopenharmony_ci#define RT5682_GP3_PIN_DMIC_CLK (0x2 << 10) 117162306a36Sopenharmony_ci#define RT5682_GP4_PIN_MASK (0x3 << 8) 117262306a36Sopenharmony_ci#define RT5682_GP4_PIN_SFT 8 117362306a36Sopenharmony_ci#define RT5682_GP4_PIN_GPIO4 (0x0 << 8) 117462306a36Sopenharmony_ci#define RT5682_GP4_PIN_ADCDAT1 (0x1 << 8) 117562306a36Sopenharmony_ci#define RT5682_GP4_PIN_DMIC_CLK (0x2 << 8) 117662306a36Sopenharmony_ci#define RT5682_GP4_PIN_ADCDAT2 (0x3 << 8) 117762306a36Sopenharmony_ci#define RT5682_GP5_PIN_MASK (0x3 << 6) 117862306a36Sopenharmony_ci#define RT5682_GP5_PIN_SFT 6 117962306a36Sopenharmony_ci#define RT5682_GP5_PIN_GPIO5 (0x0 << 6) 118062306a36Sopenharmony_ci#define RT5682_GP5_PIN_DACDAT1 (0x1 << 6) 118162306a36Sopenharmony_ci#define RT5682_GP5_PIN_DMIC_SDA (0x2 << 6) 118262306a36Sopenharmony_ci#define RT5682_GP6_PIN_MASK (0x1 << 5) 118362306a36Sopenharmony_ci#define RT5682_GP6_PIN_SFT 5 118462306a36Sopenharmony_ci#define RT5682_GP6_PIN_GPIO6 (0x0 << 5) 118562306a36Sopenharmony_ci#define RT5682_GP6_PIN_LRCK1 (0x1 << 5) 118662306a36Sopenharmony_ci 118762306a36Sopenharmony_ci/* GPIO Control 2 (0x00c1)*/ 118862306a36Sopenharmony_ci#define RT5682_GP1_PF_MASK (0x1 << 15) 118962306a36Sopenharmony_ci#define RT5682_GP1_PF_IN (0x0 << 15) 119062306a36Sopenharmony_ci#define RT5682_GP1_PF_OUT (0x1 << 15) 119162306a36Sopenharmony_ci#define RT5682_GP1_OUT_MASK (0x1 << 14) 119262306a36Sopenharmony_ci#define RT5682_GP1_OUT_L (0x0 << 14) 119362306a36Sopenharmony_ci#define RT5682_GP1_OUT_H (0x1 << 14) 119462306a36Sopenharmony_ci#define RT5682_GP2_PF_MASK (0x1 << 13) 119562306a36Sopenharmony_ci#define RT5682_GP2_PF_IN (0x0 << 13) 119662306a36Sopenharmony_ci#define RT5682_GP2_PF_OUT (0x1 << 13) 119762306a36Sopenharmony_ci#define RT5682_GP2_OUT_MASK (0x1 << 12) 119862306a36Sopenharmony_ci#define RT5682_GP2_OUT_L (0x0 << 12) 119962306a36Sopenharmony_ci#define RT5682_GP2_OUT_H (0x1 << 12) 120062306a36Sopenharmony_ci#define RT5682_GP3_PF_MASK (0x1 << 11) 120162306a36Sopenharmony_ci#define RT5682_GP3_PF_IN (0x0 << 11) 120262306a36Sopenharmony_ci#define RT5682_GP3_PF_OUT (0x1 << 11) 120362306a36Sopenharmony_ci#define RT5682_GP3_OUT_MASK (0x1 << 10) 120462306a36Sopenharmony_ci#define RT5682_GP3_OUT_L (0x0 << 10) 120562306a36Sopenharmony_ci#define RT5682_GP3_OUT_H (0x1 << 10) 120662306a36Sopenharmony_ci#define RT5682_GP4_PF_MASK (0x1 << 9) 120762306a36Sopenharmony_ci#define RT5682_GP4_PF_IN (0x0 << 9) 120862306a36Sopenharmony_ci#define RT5682_GP4_PF_OUT (0x1 << 9) 120962306a36Sopenharmony_ci#define RT5682_GP4_OUT_MASK (0x1 << 8) 121062306a36Sopenharmony_ci#define RT5682_GP4_OUT_L (0x0 << 8) 121162306a36Sopenharmony_ci#define RT5682_GP4_OUT_H (0x1 << 8) 121262306a36Sopenharmony_ci#define RT5682_GP5_PF_MASK (0x1 << 7) 121362306a36Sopenharmony_ci#define RT5682_GP5_PF_IN (0x0 << 7) 121462306a36Sopenharmony_ci#define RT5682_GP5_PF_OUT (0x1 << 7) 121562306a36Sopenharmony_ci#define RT5682_GP5_OUT_MASK (0x1 << 6) 121662306a36Sopenharmony_ci#define RT5682_GP5_OUT_L (0x0 << 6) 121762306a36Sopenharmony_ci#define RT5682_GP5_OUT_H (0x1 << 6) 121862306a36Sopenharmony_ci#define RT5682_GP6_PF_MASK (0x1 << 5) 121962306a36Sopenharmony_ci#define RT5682_GP6_PF_IN (0x0 << 5) 122062306a36Sopenharmony_ci#define RT5682_GP6_PF_OUT (0x1 << 5) 122162306a36Sopenharmony_ci#define RT5682_GP6_OUT_MASK (0x1 << 4) 122262306a36Sopenharmony_ci#define RT5682_GP6_OUT_L (0x0 << 4) 122362306a36Sopenharmony_ci#define RT5682_GP6_OUT_H (0x1 << 4) 122462306a36Sopenharmony_ci 122562306a36Sopenharmony_ci 122662306a36Sopenharmony_ci/* GPIO Status (0x00c2) */ 122762306a36Sopenharmony_ci#define RT5682_GP6_STA (0x1 << 6) 122862306a36Sopenharmony_ci#define RT5682_GP5_STA (0x1 << 5) 122962306a36Sopenharmony_ci#define RT5682_GP4_STA (0x1 << 4) 123062306a36Sopenharmony_ci#define RT5682_GP3_STA (0x1 << 3) 123162306a36Sopenharmony_ci#define RT5682_GP2_STA (0x1 << 2) 123262306a36Sopenharmony_ci#define RT5682_GP1_STA (0x1 << 1) 123362306a36Sopenharmony_ci 123462306a36Sopenharmony_ci/* Soft volume and zero cross control 1 (0x00d9) */ 123562306a36Sopenharmony_ci#define RT5682_SV_MASK (0x1 << 15) 123662306a36Sopenharmony_ci#define RT5682_SV_SFT 15 123762306a36Sopenharmony_ci#define RT5682_SV_DIS (0x0 << 15) 123862306a36Sopenharmony_ci#define RT5682_SV_EN (0x1 << 15) 123962306a36Sopenharmony_ci#define RT5682_ZCD_MASK (0x1 << 10) 124062306a36Sopenharmony_ci#define RT5682_ZCD_SFT 10 124162306a36Sopenharmony_ci#define RT5682_ZCD_PD (0x0 << 10) 124262306a36Sopenharmony_ci#define RT5682_ZCD_PU (0x1 << 10) 124362306a36Sopenharmony_ci#define RT5682_SV_DLY_MASK (0xf) 124462306a36Sopenharmony_ci#define RT5682_SV_DLY_SFT 0 124562306a36Sopenharmony_ci 124662306a36Sopenharmony_ci/* Soft volume and zero cross control 2 (0x00da) */ 124762306a36Sopenharmony_ci#define RT5682_ZCD_BST1_CBJ_MASK (0x1 << 7) 124862306a36Sopenharmony_ci#define RT5682_ZCD_BST1_CBJ_SFT 7 124962306a36Sopenharmony_ci#define RT5682_ZCD_BST1_CBJ_DIS (0x0 << 7) 125062306a36Sopenharmony_ci#define RT5682_ZCD_BST1_CBJ_EN (0x1 << 7) 125162306a36Sopenharmony_ci#define RT5682_ZCD_RECMIX_MASK (0x1) 125262306a36Sopenharmony_ci#define RT5682_ZCD_RECMIX_SFT 0 125362306a36Sopenharmony_ci#define RT5682_ZCD_RECMIX_DIS (0x0) 125462306a36Sopenharmony_ci#define RT5682_ZCD_RECMIX_EN (0x1) 125562306a36Sopenharmony_ci 125662306a36Sopenharmony_ci/* 4 Button Inline Command Control 2 (0x00e3) */ 125762306a36Sopenharmony_ci#define RT5682_4BTN_IL_MASK (0x1 << 15) 125862306a36Sopenharmony_ci#define RT5682_4BTN_IL_EN (0x1 << 15) 125962306a36Sopenharmony_ci#define RT5682_4BTN_IL_DIS (0x0 << 15) 126062306a36Sopenharmony_ci#define RT5682_4BTN_IL_RST_MASK (0x1 << 14) 126162306a36Sopenharmony_ci#define RT5682_4BTN_IL_NOR (0x1 << 14) 126262306a36Sopenharmony_ci#define RT5682_4BTN_IL_RST (0x0 << 14) 126362306a36Sopenharmony_ci 126462306a36Sopenharmony_ci/* Analog JD Control (0x00f0) */ 126562306a36Sopenharmony_ci#define RT5682_JDH_RS_MASK (0x1 << 4) 126662306a36Sopenharmony_ci#define RT5682_JDH_NO_PLUG (0x1 << 4) 126762306a36Sopenharmony_ci#define RT5682_JDH_PLUG (0x0 << 4) 126862306a36Sopenharmony_ci 126962306a36Sopenharmony_ci/* Bias current control 8 (0x0111) */ 127062306a36Sopenharmony_ci#define RT5682_HPA_CP_BIAS_CTRL_MASK (0x3 << 2) 127162306a36Sopenharmony_ci#define RT5682_HPA_CP_BIAS_2UA (0x0 << 2) 127262306a36Sopenharmony_ci#define RT5682_HPA_CP_BIAS_3UA (0x1 << 2) 127362306a36Sopenharmony_ci#define RT5682_HPA_CP_BIAS_4UA (0x2 << 2) 127462306a36Sopenharmony_ci#define RT5682_HPA_CP_BIAS_6UA (0x3 << 2) 127562306a36Sopenharmony_ci 127662306a36Sopenharmony_ci/* Charge Pump Internal Register1 (0x0125) */ 127762306a36Sopenharmony_ci#define RT5682_CP_SW_SIZE_MASK (0x7 << 8) 127862306a36Sopenharmony_ci#define RT5682_CP_SW_SIZE_L (0x4 << 8) 127962306a36Sopenharmony_ci#define RT5682_CP_SW_SIZE_M (0x2 << 8) 128062306a36Sopenharmony_ci#define RT5682_CP_SW_SIZE_S (0x1 << 8) 128162306a36Sopenharmony_ci#define RT5682_CP_CLK_HP_MASK (0x3 << 4) 128262306a36Sopenharmony_ci#define RT5682_CP_CLK_HP_100KHZ (0x0 << 4) 128362306a36Sopenharmony_ci#define RT5682_CP_CLK_HP_200KHZ (0x1 << 4) 128462306a36Sopenharmony_ci#define RT5682_CP_CLK_HP_300KHZ (0x2 << 4) 128562306a36Sopenharmony_ci#define RT5682_CP_CLK_HP_600KHZ (0x3 << 4) 128662306a36Sopenharmony_ci 128762306a36Sopenharmony_ci/* Pad Driving Control (0x0136) */ 128862306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP1_MASK (0x3 << 14) 128962306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP1_SFT 14 129062306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP2_MASK (0x3 << 12) 129162306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP2_SFT 12 129262306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP3_MASK (0x3 << 10) 129362306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP3_SFT 10 129462306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP4_MASK (0x3 << 8) 129562306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP4_SFT 8 129662306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP5_MASK (0x3 << 6) 129762306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP5_SFT 6 129862306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP6_MASK (0x3 << 4) 129962306a36Sopenharmony_ci#define RT5682_PAD_DRV_GP6_SFT 4 130062306a36Sopenharmony_ci 130162306a36Sopenharmony_ci/* Chopper and Clock control for DAC (0x013a)*/ 130262306a36Sopenharmony_ci#define RT5682_CKXEN_DAC1_MASK (0x1 << 13) 130362306a36Sopenharmony_ci#define RT5682_CKXEN_DAC1_SFT 13 130462306a36Sopenharmony_ci#define RT5682_CKGEN_DAC1_MASK (0x1 << 12) 130562306a36Sopenharmony_ci#define RT5682_CKGEN_DAC1_SFT 12 130662306a36Sopenharmony_ci 130762306a36Sopenharmony_ci/* Chopper and Clock control for ADC (0x013b)*/ 130862306a36Sopenharmony_ci#define RT5682_CKXEN_ADC1_MASK (0x1 << 13) 130962306a36Sopenharmony_ci#define RT5682_CKXEN_ADC1_SFT 13 131062306a36Sopenharmony_ci#define RT5682_CKGEN_ADC1_MASK (0x1 << 12) 131162306a36Sopenharmony_ci#define RT5682_CKGEN_ADC1_SFT 12 131262306a36Sopenharmony_ci 131362306a36Sopenharmony_ci/* Volume test (0x013f)*/ 131462306a36Sopenharmony_ci#define RT5682_SEL_CLK_VOL_MASK (0x1 << 15) 131562306a36Sopenharmony_ci#define RT5682_SEL_CLK_VOL_EN (0x1 << 15) 131662306a36Sopenharmony_ci#define RT5682_SEL_CLK_VOL_DIS (0x0 << 15) 131762306a36Sopenharmony_ci 131862306a36Sopenharmony_ci/* Test Mode Control 1 (0x0145) */ 131962306a36Sopenharmony_ci#define RT5682_AD2DA_LB_MASK (0x1 << 10) 132062306a36Sopenharmony_ci#define RT5682_AD2DA_LB_SFT 10 132162306a36Sopenharmony_ci 132262306a36Sopenharmony_ci/* Stereo Noise Gate Control 1 (0x0160) */ 132362306a36Sopenharmony_ci#define RT5682_NG2_EN_MASK (0x1 << 15) 132462306a36Sopenharmony_ci#define RT5682_NG2_EN (0x1 << 15) 132562306a36Sopenharmony_ci#define RT5682_NG2_DIS (0x0 << 15) 132662306a36Sopenharmony_ci 132762306a36Sopenharmony_ci/* Stereo1 DAC Silence Detection Control (0x0190) */ 132862306a36Sopenharmony_ci#define RT5682_DEB_STO_DAC_MASK (0x7 << 4) 132962306a36Sopenharmony_ci#define RT5682_DEB_80_MS (0x0 << 4) 133062306a36Sopenharmony_ci 133162306a36Sopenharmony_ci/* HP Behavior Logic Control 2 (0x01db) */ 133262306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR2_MASK (0x1 << 4) 133362306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR2_REG (0x1 << 4) 133462306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR2_DC_CAL (0x0 << 4) 133562306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR1_MASK (0x7) 133662306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR1_1BIT (0x7) 133762306a36Sopenharmony_ci#define RT5682_HP_LC2_SIG_SOUR1_LEGA (0x2) 133862306a36Sopenharmony_ci 133962306a36Sopenharmony_ci/* SAR ADC Inline Command Control 1 (0x0210) */ 134062306a36Sopenharmony_ci#define RT5682_SAR_BUTT_DET_MASK (0x1 << 15) 134162306a36Sopenharmony_ci#define RT5682_SAR_BUTT_DET_EN (0x1 << 15) 134262306a36Sopenharmony_ci#define RT5682_SAR_BUTT_DET_DIS (0x0 << 15) 134362306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_MODE_MASK (0x1 << 14) 134462306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_POW_SAV (0x1 << 14) 134562306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_POW_NORM (0x0 << 14) 134662306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_RST_MASK (0x1 << 13) 134762306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_RST_NORMAL (0x1 << 13) 134862306a36Sopenharmony_ci#define RT5682_SAR_BUTDET_RST (0x0 << 13) 134962306a36Sopenharmony_ci#define RT5682_SAR_POW_MASK (0x1 << 12) 135062306a36Sopenharmony_ci#define RT5682_SAR_POW_EN (0x1 << 12) 135162306a36Sopenharmony_ci#define RT5682_SAR_POW_DIS (0x0 << 12) 135262306a36Sopenharmony_ci#define RT5682_SAR_RST_MASK (0x1 << 11) 135362306a36Sopenharmony_ci#define RT5682_SAR_RST_NORMAL (0x1 << 11) 135462306a36Sopenharmony_ci#define RT5682_SAR_RST (0x0 << 11) 135562306a36Sopenharmony_ci#define RT5682_SAR_BYPASS_MASK (0x1 << 10) 135662306a36Sopenharmony_ci#define RT5682_SAR_BYPASS_EN (0x1 << 10) 135762306a36Sopenharmony_ci#define RT5682_SAR_BYPASS_DIS (0x0 << 10) 135862306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_MASK (0x1 << 9) 135962306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_SEL (0x1 << 9) 136062306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_NOSEL (0x0 << 9) 136162306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB2_MASK (0x1 << 8) 136262306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB2_SEL (0x1 << 8) 136362306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB2_NOSEL (0x0 << 8) 136462306a36Sopenharmony_ci#define RT5682_SAR_SEL_MODE_MASK (0x1 << 7) 136562306a36Sopenharmony_ci#define RT5682_SAR_SEL_MODE_CMP (0x1 << 7) 136662306a36Sopenharmony_ci#define RT5682_SAR_SEL_MODE_ADC (0x0 << 7) 136762306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_MB2_MASK (0x1 << 5) 136862306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_MB2_AUTO (0x1 << 5) 136962306a36Sopenharmony_ci#define RT5682_SAR_SEL_MB1_MB2_MANU (0x0 << 5) 137062306a36Sopenharmony_ci#define RT5682_SAR_SEL_SIGNAL_MASK (0x1 << 4) 137162306a36Sopenharmony_ci#define RT5682_SAR_SEL_SIGNAL_AUTO (0x1 << 4) 137262306a36Sopenharmony_ci#define RT5682_SAR_SEL_SIGNAL_MANU (0x0 << 4) 137362306a36Sopenharmony_ci 137462306a36Sopenharmony_ci/* SAR ADC Inline Command Control 13 (0x021c) */ 137562306a36Sopenharmony_ci#define RT5682_SAR_SOUR_MASK (0x3f) 137662306a36Sopenharmony_ci#define RT5682_SAR_SOUR_BTN (0x3f) 137762306a36Sopenharmony_ci#define RT5682_SAR_SOUR_TYPE (0x0) 137862306a36Sopenharmony_ci 137962306a36Sopenharmony_ci/* soundwire timeout */ 138062306a36Sopenharmony_ci#define RT5682_PROBE_TIMEOUT 5000 138162306a36Sopenharmony_ci 138262306a36Sopenharmony_ci 138362306a36Sopenharmony_ci#define RT5682_STEREO_RATES SNDRV_PCM_RATE_8000_192000 138462306a36Sopenharmony_ci#define RT5682_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 138562306a36Sopenharmony_ci SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8) 138662306a36Sopenharmony_ci 138762306a36Sopenharmony_ci/* System Clock Source */ 138862306a36Sopenharmony_cienum { 138962306a36Sopenharmony_ci RT5682_SCLK_S_MCLK, 139062306a36Sopenharmony_ci RT5682_SCLK_S_PLL1, 139162306a36Sopenharmony_ci RT5682_SCLK_S_PLL2, 139262306a36Sopenharmony_ci RT5682_SCLK_S_RCCLK, 139362306a36Sopenharmony_ci}; 139462306a36Sopenharmony_ci 139562306a36Sopenharmony_ci/* PLL Source */ 139662306a36Sopenharmony_cienum { 139762306a36Sopenharmony_ci RT5682_PLL1_S_MCLK, 139862306a36Sopenharmony_ci RT5682_PLL1_S_BCLK1, 139962306a36Sopenharmony_ci RT5682_PLL1_S_RCCLK, 140062306a36Sopenharmony_ci RT5682_PLL2_S_MCLK, 140162306a36Sopenharmony_ci}; 140262306a36Sopenharmony_ci 140362306a36Sopenharmony_cienum { 140462306a36Sopenharmony_ci RT5682_PLL1, 140562306a36Sopenharmony_ci RT5682_PLL2, 140662306a36Sopenharmony_ci RT5682_PLLS, 140762306a36Sopenharmony_ci}; 140862306a36Sopenharmony_ci 140962306a36Sopenharmony_cienum { 141062306a36Sopenharmony_ci RT5682_AIF1, 141162306a36Sopenharmony_ci RT5682_AIF2, 141262306a36Sopenharmony_ci RT5682_SDW, 141362306a36Sopenharmony_ci RT5682_AIFS 141462306a36Sopenharmony_ci}; 141562306a36Sopenharmony_ci 141662306a36Sopenharmony_ci/* filter mask */ 141762306a36Sopenharmony_cienum { 141862306a36Sopenharmony_ci RT5682_DA_STEREO1_FILTER = 0x1, 141962306a36Sopenharmony_ci RT5682_AD_STEREO1_FILTER = (0x1 << 1), 142062306a36Sopenharmony_ci}; 142162306a36Sopenharmony_ci 142262306a36Sopenharmony_cienum { 142362306a36Sopenharmony_ci RT5682_CLK_SEL_SYS, 142462306a36Sopenharmony_ci RT5682_CLK_SEL_I2S1_ASRC, 142562306a36Sopenharmony_ci RT5682_CLK_SEL_I2S2_ASRC, 142662306a36Sopenharmony_ci}; 142762306a36Sopenharmony_ci 142862306a36Sopenharmony_ci#define RT5682_NUM_SUPPLIES 5 142962306a36Sopenharmony_ci 143062306a36Sopenharmony_cistruct rt5682_priv { 143162306a36Sopenharmony_ci struct snd_soc_component *component; 143262306a36Sopenharmony_ci struct device *i2c_dev; 143362306a36Sopenharmony_ci struct rt5682_platform_data pdata; 143462306a36Sopenharmony_ci struct gpio_desc *ldo1_en; 143562306a36Sopenharmony_ci struct regmap *regmap; 143662306a36Sopenharmony_ci struct regmap *sdw_regmap; 143762306a36Sopenharmony_ci struct snd_soc_jack *hs_jack; 143862306a36Sopenharmony_ci struct regulator_bulk_data supplies[RT5682_NUM_SUPPLIES]; 143962306a36Sopenharmony_ci struct delayed_work jack_detect_work; 144062306a36Sopenharmony_ci struct delayed_work jd_check_work; 144162306a36Sopenharmony_ci struct mutex disable_irq_lock; /* imp-def irq lock protection */ 144262306a36Sopenharmony_ci bool disable_irq; 144362306a36Sopenharmony_ci struct mutex calibrate_mutex; 144462306a36Sopenharmony_ci struct sdw_slave *slave; 144562306a36Sopenharmony_ci struct sdw_bus_params params; 144662306a36Sopenharmony_ci bool hw_init; 144762306a36Sopenharmony_ci bool first_hw_init; 144862306a36Sopenharmony_ci bool is_sdw; 144962306a36Sopenharmony_ci 145062306a36Sopenharmony_ci#ifdef CONFIG_COMMON_CLK 145162306a36Sopenharmony_ci struct clk_hw dai_clks_hw[RT5682_DAI_NUM_CLKS]; 145262306a36Sopenharmony_ci struct clk *mclk; 145362306a36Sopenharmony_ci#endif 145462306a36Sopenharmony_ci 145562306a36Sopenharmony_ci int sysclk; 145662306a36Sopenharmony_ci int sysclk_src; 145762306a36Sopenharmony_ci int lrck[RT5682_AIFS]; 145862306a36Sopenharmony_ci int bclk[RT5682_AIFS]; 145962306a36Sopenharmony_ci int master[RT5682_AIFS]; 146062306a36Sopenharmony_ci 146162306a36Sopenharmony_ci int pll_src[RT5682_PLLS]; 146262306a36Sopenharmony_ci int pll_in[RT5682_PLLS]; 146362306a36Sopenharmony_ci int pll_out[RT5682_PLLS]; 146462306a36Sopenharmony_ci 146562306a36Sopenharmony_ci int jack_type; 146662306a36Sopenharmony_ci int irq; 146762306a36Sopenharmony_ci int irq_work_delay_time; 146862306a36Sopenharmony_ci}; 146962306a36Sopenharmony_ci 147062306a36Sopenharmony_ciextern const char *rt5682_supply_names[RT5682_NUM_SUPPLIES]; 147162306a36Sopenharmony_ci 147262306a36Sopenharmony_ciint rt5682_sel_asrc_clk_src(struct snd_soc_component *component, 147362306a36Sopenharmony_ci unsigned int filter_mask, unsigned int clk_src); 147462306a36Sopenharmony_ci 147562306a36Sopenharmony_civoid rt5682_apply_patch_list(struct rt5682_priv *rt5682, struct device *dev); 147662306a36Sopenharmony_ci 147762306a36Sopenharmony_civoid rt5682_jack_detect_handler(struct work_struct *work); 147862306a36Sopenharmony_ci 147962306a36Sopenharmony_cibool rt5682_volatile_register(struct device *dev, unsigned int reg); 148062306a36Sopenharmony_cibool rt5682_readable_register(struct device *dev, unsigned int reg); 148162306a36Sopenharmony_ci 148262306a36Sopenharmony_ciint rt5682_register_component(struct device *dev); 148362306a36Sopenharmony_civoid rt5682_calibrate(struct rt5682_priv *rt5682); 148462306a36Sopenharmony_civoid rt5682_reset(struct rt5682_priv *rt5682); 148562306a36Sopenharmony_ciint rt5682_parse_dt(struct rt5682_priv *rt5682, struct device *dev); 148662306a36Sopenharmony_ciint rt5682_get_ldo1(struct rt5682_priv *rt5682, struct device *dev); 148762306a36Sopenharmony_ci 148862306a36Sopenharmony_ciint rt5682_register_dai_clks(struct rt5682_priv *rt5682); 148962306a36Sopenharmony_ci 149062306a36Sopenharmony_ci#define RT5682_REG_NUM 318 149162306a36Sopenharmony_ciextern const struct reg_default rt5682_reg[RT5682_REG_NUM]; 149262306a36Sopenharmony_ci 149362306a36Sopenharmony_ciextern const struct snd_soc_dai_ops rt5682_aif1_dai_ops; 149462306a36Sopenharmony_ciextern const struct snd_soc_dai_ops rt5682_aif2_dai_ops; 149562306a36Sopenharmony_ciextern const struct snd_soc_component_driver rt5682_soc_component_dev; 149662306a36Sopenharmony_ci 149762306a36Sopenharmony_ci#endif /* __RT5682_H__ */ 1498