162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * rt5640.h -- RT5640 ALSA SoC audio driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright 2011 Realtek Microelectronics 662306a36Sopenharmony_ci * Author: Johnny Hsu <johnnyhsu@realtek.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef _RT5640_H 1062306a36Sopenharmony_ci#define _RT5640_H 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/clk.h> 1362306a36Sopenharmony_ci#include <linux/gpio/consumer.h> 1462306a36Sopenharmony_ci#include <linux/workqueue.h> 1562306a36Sopenharmony_ci#include <dt-bindings/sound/rt5640.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci/* Info */ 1862306a36Sopenharmony_ci#define RT5640_RESET 0x00 1962306a36Sopenharmony_ci#define RT5640_VENDOR_ID 0xfd 2062306a36Sopenharmony_ci#define RT5640_VENDOR_ID1 0xfe 2162306a36Sopenharmony_ci#define RT5640_VENDOR_ID2 0xff 2262306a36Sopenharmony_ci/* I/O - Output */ 2362306a36Sopenharmony_ci#define RT5640_SPK_VOL 0x01 2462306a36Sopenharmony_ci#define RT5640_HP_VOL 0x02 2562306a36Sopenharmony_ci#define RT5640_OUTPUT 0x03 2662306a36Sopenharmony_ci#define RT5640_MONO_OUT 0x04 2762306a36Sopenharmony_ci/* I/O - Input */ 2862306a36Sopenharmony_ci#define RT5640_IN1_IN2 0x0d 2962306a36Sopenharmony_ci#define RT5640_IN3_IN4 0x0e 3062306a36Sopenharmony_ci#define RT5640_INL_INR_VOL 0x0f 3162306a36Sopenharmony_ci/* I/O - ADC/DAC/DMIC */ 3262306a36Sopenharmony_ci#define RT5640_DAC1_DIG_VOL 0x19 3362306a36Sopenharmony_ci#define RT5640_DAC2_DIG_VOL 0x1a 3462306a36Sopenharmony_ci#define RT5640_DAC2_CTRL 0x1b 3562306a36Sopenharmony_ci#define RT5640_ADC_DIG_VOL 0x1c 3662306a36Sopenharmony_ci#define RT5640_ADC_DATA 0x1d 3762306a36Sopenharmony_ci#define RT5640_ADC_BST_VOL 0x1e 3862306a36Sopenharmony_ci/* Mixer - D-D */ 3962306a36Sopenharmony_ci#define RT5640_STO_ADC_MIXER 0x27 4062306a36Sopenharmony_ci#define RT5640_MONO_ADC_MIXER 0x28 4162306a36Sopenharmony_ci#define RT5640_AD_DA_MIXER 0x29 4262306a36Sopenharmony_ci#define RT5640_STO_DAC_MIXER 0x2a 4362306a36Sopenharmony_ci#define RT5640_MONO_DAC_MIXER 0x2b 4462306a36Sopenharmony_ci#define RT5640_DIG_MIXER 0x2c 4562306a36Sopenharmony_ci#define RT5640_DSP_PATH1 0x2d 4662306a36Sopenharmony_ci#define RT5640_DSP_PATH2 0x2e 4762306a36Sopenharmony_ci#define RT5640_DIG_INF_DATA 0x2f 4862306a36Sopenharmony_ci/* Mixer - ADC */ 4962306a36Sopenharmony_ci#define RT5640_REC_L1_MIXER 0x3b 5062306a36Sopenharmony_ci#define RT5640_REC_L2_MIXER 0x3c 5162306a36Sopenharmony_ci#define RT5640_REC_R1_MIXER 0x3d 5262306a36Sopenharmony_ci#define RT5640_REC_R2_MIXER 0x3e 5362306a36Sopenharmony_ci/* Mixer - DAC */ 5462306a36Sopenharmony_ci#define RT5640_HPO_MIXER 0x45 5562306a36Sopenharmony_ci#define RT5640_SPK_L_MIXER 0x46 5662306a36Sopenharmony_ci#define RT5640_SPK_R_MIXER 0x47 5762306a36Sopenharmony_ci#define RT5640_SPO_L_MIXER 0x48 5862306a36Sopenharmony_ci#define RT5640_SPO_R_MIXER 0x49 5962306a36Sopenharmony_ci#define RT5640_SPO_CLSD_RATIO 0x4a 6062306a36Sopenharmony_ci#define RT5640_MONO_MIXER 0x4c 6162306a36Sopenharmony_ci#define RT5640_OUT_L1_MIXER 0x4d 6262306a36Sopenharmony_ci#define RT5640_OUT_L2_MIXER 0x4e 6362306a36Sopenharmony_ci#define RT5640_OUT_L3_MIXER 0x4f 6462306a36Sopenharmony_ci#define RT5640_OUT_R1_MIXER 0x50 6562306a36Sopenharmony_ci#define RT5640_OUT_R2_MIXER 0x51 6662306a36Sopenharmony_ci#define RT5640_OUT_R3_MIXER 0x52 6762306a36Sopenharmony_ci#define RT5640_LOUT_MIXER 0x53 6862306a36Sopenharmony_ci/* Power */ 6962306a36Sopenharmony_ci#define RT5640_PWR_DIG1 0x61 7062306a36Sopenharmony_ci#define RT5640_PWR_DIG2 0x62 7162306a36Sopenharmony_ci#define RT5640_PWR_ANLG1 0x63 7262306a36Sopenharmony_ci#define RT5640_PWR_ANLG2 0x64 7362306a36Sopenharmony_ci#define RT5640_PWR_MIXER 0x65 7462306a36Sopenharmony_ci#define RT5640_PWR_VOL 0x66 7562306a36Sopenharmony_ci/* Private Register Control */ 7662306a36Sopenharmony_ci#define RT5640_PRIV_INDEX 0x6a 7762306a36Sopenharmony_ci#define RT5640_PRIV_DATA 0x6c 7862306a36Sopenharmony_ci/* Format - ADC/DAC */ 7962306a36Sopenharmony_ci#define RT5640_I2S1_SDP 0x70 8062306a36Sopenharmony_ci#define RT5640_I2S2_SDP 0x71 8162306a36Sopenharmony_ci#define RT5640_ADDA_CLK1 0x73 8262306a36Sopenharmony_ci#define RT5640_ADDA_CLK2 0x74 8362306a36Sopenharmony_ci#define RT5640_DMIC 0x75 8462306a36Sopenharmony_ci/* Function - Analog */ 8562306a36Sopenharmony_ci#define RT5640_GLB_CLK 0x80 8662306a36Sopenharmony_ci#define RT5640_PLL_CTRL1 0x81 8762306a36Sopenharmony_ci#define RT5640_PLL_CTRL2 0x82 8862306a36Sopenharmony_ci#define RT5640_ASRC_1 0x83 8962306a36Sopenharmony_ci#define RT5640_ASRC_2 0x84 9062306a36Sopenharmony_ci#define RT5640_ASRC_3 0x85 9162306a36Sopenharmony_ci#define RT5640_ASRC_4 0x89 9262306a36Sopenharmony_ci#define RT5640_ASRC_5 0x8a 9362306a36Sopenharmony_ci#define RT5640_HP_OVCD 0x8b 9462306a36Sopenharmony_ci#define RT5640_CLS_D_OVCD 0x8c 9562306a36Sopenharmony_ci#define RT5640_CLS_D_OUT 0x8d 9662306a36Sopenharmony_ci#define RT5640_DEPOP_M1 0x8e 9762306a36Sopenharmony_ci#define RT5640_DEPOP_M2 0x8f 9862306a36Sopenharmony_ci#define RT5640_DEPOP_M3 0x90 9962306a36Sopenharmony_ci#define RT5640_CHARGE_PUMP 0x91 10062306a36Sopenharmony_ci#define RT5640_PV_DET_SPK_G 0x92 10162306a36Sopenharmony_ci#define RT5640_MICBIAS 0x93 10262306a36Sopenharmony_ci/* Function - Digital */ 10362306a36Sopenharmony_ci#define RT5640_EQ_CTRL1 0xb0 10462306a36Sopenharmony_ci#define RT5640_EQ_CTRL2 0xb1 10562306a36Sopenharmony_ci#define RT5640_WIND_FILTER 0xb2 10662306a36Sopenharmony_ci#define RT5640_DRC_AGC_1 0xb4 10762306a36Sopenharmony_ci#define RT5640_DRC_AGC_2 0xb5 10862306a36Sopenharmony_ci#define RT5640_DRC_AGC_3 0xb6 10962306a36Sopenharmony_ci#define RT5640_SVOL_ZC 0xb7 11062306a36Sopenharmony_ci#define RT5640_ANC_CTRL1 0xb8 11162306a36Sopenharmony_ci#define RT5640_ANC_CTRL2 0xb9 11262306a36Sopenharmony_ci#define RT5640_ANC_CTRL3 0xba 11362306a36Sopenharmony_ci#define RT5640_JD_CTRL 0xbb 11462306a36Sopenharmony_ci#define RT5640_ANC_JD 0xbc 11562306a36Sopenharmony_ci#define RT5640_IRQ_CTRL1 0xbd 11662306a36Sopenharmony_ci#define RT5640_IRQ_CTRL2 0xbe 11762306a36Sopenharmony_ci#define RT5640_INT_IRQ_ST 0xbf 11862306a36Sopenharmony_ci#define RT5640_GPIO_CTRL1 0xc0 11962306a36Sopenharmony_ci#define RT5640_GPIO_CTRL2 0xc1 12062306a36Sopenharmony_ci#define RT5640_GPIO_CTRL3 0xc2 12162306a36Sopenharmony_ci#define RT5640_DSP_CTRL1 0xc4 12262306a36Sopenharmony_ci#define RT5640_DSP_CTRL2 0xc5 12362306a36Sopenharmony_ci#define RT5640_DSP_CTRL3 0xc6 12462306a36Sopenharmony_ci#define RT5640_DSP_CTRL4 0xc7 12562306a36Sopenharmony_ci#define RT5640_PGM_REG_ARR1 0xc8 12662306a36Sopenharmony_ci#define RT5640_PGM_REG_ARR2 0xc9 12762306a36Sopenharmony_ci#define RT5640_PGM_REG_ARR3 0xca 12862306a36Sopenharmony_ci#define RT5640_PGM_REG_ARR4 0xcb 12962306a36Sopenharmony_ci#define RT5640_PGM_REG_ARR5 0xcc 13062306a36Sopenharmony_ci#define RT5640_SCB_FUNC 0xcd 13162306a36Sopenharmony_ci#define RT5640_SCB_CTRL 0xce 13262306a36Sopenharmony_ci#define RT5640_BASE_BACK 0xcf 13362306a36Sopenharmony_ci#define RT5640_MP3_PLUS1 0xd0 13462306a36Sopenharmony_ci#define RT5640_MP3_PLUS2 0xd1 13562306a36Sopenharmony_ci#define RT5640_3D_HP 0xd2 13662306a36Sopenharmony_ci#define RT5640_ADJ_HPF 0xd3 13762306a36Sopenharmony_ci#define RT5640_HP_CALIB_AMP_DET 0xd6 13862306a36Sopenharmony_ci#define RT5640_HP_CALIB2 0xd7 13962306a36Sopenharmony_ci#define RT5640_SV_ZCD1 0xd9 14062306a36Sopenharmony_ci#define RT5640_SV_ZCD2 0xda 14162306a36Sopenharmony_ci/* Dummy Register */ 14262306a36Sopenharmony_ci#define RT5640_DUMMY1 0xfa 14362306a36Sopenharmony_ci#define RT5640_DUMMY2 0xfb 14462306a36Sopenharmony_ci#define RT5640_DUMMY3 0xfc 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci 14762306a36Sopenharmony_ci/* Index of Codec Private Register definition */ 14862306a36Sopenharmony_ci#define RT5640_BIAS_CUR4 0x15 14962306a36Sopenharmony_ci#define RT5640_CHPUMP_INT_REG1 0x24 15062306a36Sopenharmony_ci#define RT5640_MAMP_INT_REG2 0x37 15162306a36Sopenharmony_ci#define RT5640_3D_SPK 0x63 15262306a36Sopenharmony_ci#define RT5640_WND_1 0x6c 15362306a36Sopenharmony_ci#define RT5640_WND_2 0x6d 15462306a36Sopenharmony_ci#define RT5640_WND_3 0x6e 15562306a36Sopenharmony_ci#define RT5640_WND_4 0x6f 15662306a36Sopenharmony_ci#define RT5640_WND_5 0x70 15762306a36Sopenharmony_ci#define RT5640_WND_8 0x73 15862306a36Sopenharmony_ci#define RT5640_DIP_SPK_INF 0x75 15962306a36Sopenharmony_ci#define RT5640_HP_DCC_INT1 0x77 16062306a36Sopenharmony_ci#define RT5640_EQ_BW_LOP 0xa0 16162306a36Sopenharmony_ci#define RT5640_EQ_GN_LOP 0xa1 16262306a36Sopenharmony_ci#define RT5640_EQ_FC_BP1 0xa2 16362306a36Sopenharmony_ci#define RT5640_EQ_BW_BP1 0xa3 16462306a36Sopenharmony_ci#define RT5640_EQ_GN_BP1 0xa4 16562306a36Sopenharmony_ci#define RT5640_EQ_FC_BP2 0xa5 16662306a36Sopenharmony_ci#define RT5640_EQ_BW_BP2 0xa6 16762306a36Sopenharmony_ci#define RT5640_EQ_GN_BP2 0xa7 16862306a36Sopenharmony_ci#define RT5640_EQ_FC_BP3 0xa8 16962306a36Sopenharmony_ci#define RT5640_EQ_BW_BP3 0xa9 17062306a36Sopenharmony_ci#define RT5640_EQ_GN_BP3 0xaa 17162306a36Sopenharmony_ci#define RT5640_EQ_FC_BP4 0xab 17262306a36Sopenharmony_ci#define RT5640_EQ_BW_BP4 0xac 17362306a36Sopenharmony_ci#define RT5640_EQ_GN_BP4 0xad 17462306a36Sopenharmony_ci#define RT5640_EQ_FC_HIP1 0xae 17562306a36Sopenharmony_ci#define RT5640_EQ_GN_HIP1 0xaf 17662306a36Sopenharmony_ci#define RT5640_EQ_FC_HIP2 0xb0 17762306a36Sopenharmony_ci#define RT5640_EQ_BW_HIP2 0xb1 17862306a36Sopenharmony_ci#define RT5640_EQ_GN_HIP2 0xb2 17962306a36Sopenharmony_ci#define RT5640_EQ_PRE_VOL 0xb3 18062306a36Sopenharmony_ci#define RT5640_EQ_PST_VOL 0xb4 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/* global definition */ 18362306a36Sopenharmony_ci#define RT5640_L_MUTE (0x1 << 15) 18462306a36Sopenharmony_ci#define RT5640_L_MUTE_SFT 15 18562306a36Sopenharmony_ci#define RT5640_VOL_L_MUTE (0x1 << 14) 18662306a36Sopenharmony_ci#define RT5640_VOL_L_SFT 14 18762306a36Sopenharmony_ci#define RT5640_R_MUTE (0x1 << 7) 18862306a36Sopenharmony_ci#define RT5640_R_MUTE_SFT 7 18962306a36Sopenharmony_ci#define RT5640_VOL_R_MUTE (0x1 << 6) 19062306a36Sopenharmony_ci#define RT5640_VOL_R_SFT 6 19162306a36Sopenharmony_ci#define RT5640_L_VOL_MASK (0x3f << 8) 19262306a36Sopenharmony_ci#define RT5640_L_VOL_SFT 8 19362306a36Sopenharmony_ci#define RT5640_R_VOL_MASK (0x3f) 19462306a36Sopenharmony_ci#define RT5640_R_VOL_SFT 0 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/* SW Reset & Device ID (0x00) */ 19762306a36Sopenharmony_ci#define RT5640_ID_MASK (0x3 << 1) 19862306a36Sopenharmony_ci#define RT5640_ID_5639 (0x0 << 1) 19962306a36Sopenharmony_ci#define RT5640_ID_5640 (0x2 << 1) 20062306a36Sopenharmony_ci#define RT5640_ID_5642 (0x3 << 1) 20162306a36Sopenharmony_ci 20262306a36Sopenharmony_ci 20362306a36Sopenharmony_ci/* IN1 and IN2 Control (0x0d) */ 20462306a36Sopenharmony_ci/* IN3 and IN4 Control (0x0e) */ 20562306a36Sopenharmony_ci#define RT5640_BST_SFT1 12 20662306a36Sopenharmony_ci#define RT5640_BST_SFT2 8 20762306a36Sopenharmony_ci#define RT5640_IN_DF1 (0x1 << 7) 20862306a36Sopenharmony_ci#define RT5640_IN_SFT1 7 20962306a36Sopenharmony_ci#define RT5640_IN_DF2 (0x1 << 6) 21062306a36Sopenharmony_ci#define RT5640_IN_SFT2 6 21162306a36Sopenharmony_ci 21262306a36Sopenharmony_ci/* INL and INR Volume Control (0x0f) */ 21362306a36Sopenharmony_ci#define RT5640_INL_SEL_MASK (0x1 << 15) 21462306a36Sopenharmony_ci#define RT5640_INL_SEL_SFT 15 21562306a36Sopenharmony_ci#define RT5640_INL_SEL_IN4P (0x0 << 15) 21662306a36Sopenharmony_ci#define RT5640_INL_SEL_MONOP (0x1 << 15) 21762306a36Sopenharmony_ci#define RT5640_INL_VOL_MASK (0x1f << 8) 21862306a36Sopenharmony_ci#define RT5640_INL_VOL_SFT 8 21962306a36Sopenharmony_ci#define RT5640_INR_SEL_MASK (0x1 << 7) 22062306a36Sopenharmony_ci#define RT5640_INR_SEL_SFT 7 22162306a36Sopenharmony_ci#define RT5640_INR_SEL_IN4N (0x0 << 7) 22262306a36Sopenharmony_ci#define RT5640_INR_SEL_MONON (0x1 << 7) 22362306a36Sopenharmony_ci#define RT5640_INR_VOL_MASK (0x1f) 22462306a36Sopenharmony_ci#define RT5640_INR_VOL_SFT 0 22562306a36Sopenharmony_ci 22662306a36Sopenharmony_ci/* DAC1 Digital Volume (0x19) */ 22762306a36Sopenharmony_ci#define RT5640_DAC_L1_VOL_MASK (0xff << 8) 22862306a36Sopenharmony_ci#define RT5640_DAC_L1_VOL_SFT 8 22962306a36Sopenharmony_ci#define RT5640_DAC_R1_VOL_MASK (0xff) 23062306a36Sopenharmony_ci#define RT5640_DAC_R1_VOL_SFT 0 23162306a36Sopenharmony_ci 23262306a36Sopenharmony_ci/* DAC2 Digital Volume (0x1a) */ 23362306a36Sopenharmony_ci#define RT5640_DAC_L2_VOL_MASK (0xff << 8) 23462306a36Sopenharmony_ci#define RT5640_DAC_L2_VOL_SFT 8 23562306a36Sopenharmony_ci#define RT5640_DAC_R2_VOL_MASK (0xff) 23662306a36Sopenharmony_ci#define RT5640_DAC_R2_VOL_SFT 0 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci/* DAC2 Control (0x1b) */ 23962306a36Sopenharmony_ci#define RT5640_M_DAC_L2_VOL (0x1 << 13) 24062306a36Sopenharmony_ci#define RT5640_M_DAC_L2_VOL_SFT 13 24162306a36Sopenharmony_ci#define RT5640_M_DAC_R2_VOL (0x1 << 12) 24262306a36Sopenharmony_ci#define RT5640_M_DAC_R2_VOL_SFT 12 24362306a36Sopenharmony_ci 24462306a36Sopenharmony_ci/* ADC Digital Volume Control (0x1c) */ 24562306a36Sopenharmony_ci#define RT5640_ADC_L_VOL_MASK (0x7f << 8) 24662306a36Sopenharmony_ci#define RT5640_ADC_L_VOL_SFT 8 24762306a36Sopenharmony_ci#define RT5640_ADC_R_VOL_MASK (0x7f) 24862306a36Sopenharmony_ci#define RT5640_ADC_R_VOL_SFT 0 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci/* Mono ADC Digital Volume Control (0x1d) */ 25162306a36Sopenharmony_ci#define RT5640_MONO_ADC_L_VOL_MASK (0x7f << 8) 25262306a36Sopenharmony_ci#define RT5640_MONO_ADC_L_VOL_SFT 8 25362306a36Sopenharmony_ci#define RT5640_MONO_ADC_R_VOL_MASK (0x7f) 25462306a36Sopenharmony_ci#define RT5640_MONO_ADC_R_VOL_SFT 0 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci/* ADC Boost Volume Control (0x1e) */ 25762306a36Sopenharmony_ci#define RT5640_ADC_L_BST_MASK (0x3 << 14) 25862306a36Sopenharmony_ci#define RT5640_ADC_L_BST_SFT 14 25962306a36Sopenharmony_ci#define RT5640_ADC_R_BST_MASK (0x3 << 12) 26062306a36Sopenharmony_ci#define RT5640_ADC_R_BST_SFT 12 26162306a36Sopenharmony_ci#define RT5640_ADC_COMP_MASK (0x3 << 10) 26262306a36Sopenharmony_ci#define RT5640_ADC_COMP_SFT 10 26362306a36Sopenharmony_ci 26462306a36Sopenharmony_ci/* Stereo ADC Mixer Control (0x27) */ 26562306a36Sopenharmony_ci#define RT5640_M_ADC_L1 (0x1 << 14) 26662306a36Sopenharmony_ci#define RT5640_M_ADC_L1_SFT 14 26762306a36Sopenharmony_ci#define RT5640_M_ADC_L2 (0x1 << 13) 26862306a36Sopenharmony_ci#define RT5640_M_ADC_L2_SFT 13 26962306a36Sopenharmony_ci#define RT5640_ADC_1_SRC_MASK (0x1 << 12) 27062306a36Sopenharmony_ci#define RT5640_ADC_1_SRC_SFT 12 27162306a36Sopenharmony_ci#define RT5640_ADC_1_SRC_ADC (0x1 << 12) 27262306a36Sopenharmony_ci#define RT5640_ADC_1_SRC_DACMIX (0x0 << 12) 27362306a36Sopenharmony_ci#define RT5640_ADC_2_SRC_MASK (0x3 << 10) 27462306a36Sopenharmony_ci#define RT5640_ADC_2_SRC_SFT 10 27562306a36Sopenharmony_ci#define RT5640_ADC_2_SRC_DMIC1 (0x0 << 10) 27662306a36Sopenharmony_ci#define RT5640_ADC_2_SRC_DMIC2 (0x1 << 10) 27762306a36Sopenharmony_ci#define RT5640_ADC_2_SRC_DACMIX (0x2 << 10) 27862306a36Sopenharmony_ci#define RT5640_M_ADC_R1 (0x1 << 6) 27962306a36Sopenharmony_ci#define RT5640_M_ADC_R1_SFT 6 28062306a36Sopenharmony_ci#define RT5640_M_ADC_R2 (0x1 << 5) 28162306a36Sopenharmony_ci#define RT5640_M_ADC_R2_SFT 5 28262306a36Sopenharmony_ci 28362306a36Sopenharmony_ci/* Mono ADC Mixer Control (0x28) */ 28462306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L1 (0x1 << 14) 28562306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L1_SFT 14 28662306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L2 (0x1 << 13) 28762306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L2_SFT 13 28862306a36Sopenharmony_ci#define RT5640_MONO_ADC_L1_SRC_MASK (0x1 << 12) 28962306a36Sopenharmony_ci#define RT5640_MONO_ADC_L1_SRC_SFT 12 29062306a36Sopenharmony_ci#define RT5640_MONO_ADC_L1_SRC_DACMIXL (0x0 << 12) 29162306a36Sopenharmony_ci#define RT5640_MONO_ADC_L1_SRC_ADCL (0x1 << 12) 29262306a36Sopenharmony_ci#define RT5640_MONO_ADC_L2_SRC_MASK (0x3 << 10) 29362306a36Sopenharmony_ci#define RT5640_MONO_ADC_L2_SRC_SFT 10 29462306a36Sopenharmony_ci#define RT5640_MONO_ADC_L2_SRC_DMIC_L1 (0x0 << 10) 29562306a36Sopenharmony_ci#define RT5640_MONO_ADC_L2_SRC_DMIC_L2 (0x1 << 10) 29662306a36Sopenharmony_ci#define RT5640_MONO_ADC_L2_SRC_DACMIXL (0x2 << 10) 29762306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R1 (0x1 << 6) 29862306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R1_SFT 6 29962306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R2 (0x1 << 5) 30062306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R2_SFT 5 30162306a36Sopenharmony_ci#define RT5640_MONO_ADC_R1_SRC_MASK (0x1 << 4) 30262306a36Sopenharmony_ci#define RT5640_MONO_ADC_R1_SRC_SFT 4 30362306a36Sopenharmony_ci#define RT5640_MONO_ADC_R1_SRC_ADCR (0x1 << 4) 30462306a36Sopenharmony_ci#define RT5640_MONO_ADC_R1_SRC_DACMIXR (0x0 << 4) 30562306a36Sopenharmony_ci#define RT5640_MONO_ADC_R2_SRC_MASK (0x3 << 2) 30662306a36Sopenharmony_ci#define RT5640_MONO_ADC_R2_SRC_SFT 2 30762306a36Sopenharmony_ci#define RT5640_MONO_ADC_R2_SRC_DMIC_R1 (0x0 << 2) 30862306a36Sopenharmony_ci#define RT5640_MONO_ADC_R2_SRC_DMIC_R2 (0x1 << 2) 30962306a36Sopenharmony_ci#define RT5640_MONO_ADC_R2_SRC_DACMIXR (0x2 << 2) 31062306a36Sopenharmony_ci 31162306a36Sopenharmony_ci/* ADC Mixer to DAC Mixer Control (0x29) */ 31262306a36Sopenharmony_ci#define RT5640_M_ADCMIX_L (0x1 << 15) 31362306a36Sopenharmony_ci#define RT5640_M_ADCMIX_L_SFT 15 31462306a36Sopenharmony_ci#define RT5640_M_IF1_DAC_L (0x1 << 14) 31562306a36Sopenharmony_ci#define RT5640_M_IF1_DAC_L_SFT 14 31662306a36Sopenharmony_ci#define RT5640_M_ADCMIX_R (0x1 << 7) 31762306a36Sopenharmony_ci#define RT5640_M_ADCMIX_R_SFT 7 31862306a36Sopenharmony_ci#define RT5640_M_IF1_DAC_R (0x1 << 6) 31962306a36Sopenharmony_ci#define RT5640_M_IF1_DAC_R_SFT 6 32062306a36Sopenharmony_ci 32162306a36Sopenharmony_ci/* Stereo DAC Mixer Control (0x2a) */ 32262306a36Sopenharmony_ci#define RT5640_M_DAC_L1 (0x1 << 14) 32362306a36Sopenharmony_ci#define RT5640_M_DAC_L1_SFT 14 32462306a36Sopenharmony_ci#define RT5640_DAC_L1_STO_L_VOL_MASK (0x1 << 13) 32562306a36Sopenharmony_ci#define RT5640_DAC_L1_STO_L_VOL_SFT 13 32662306a36Sopenharmony_ci#define RT5640_M_DAC_L2 (0x1 << 12) 32762306a36Sopenharmony_ci#define RT5640_M_DAC_L2_SFT 12 32862306a36Sopenharmony_ci#define RT5640_DAC_L2_STO_L_VOL_MASK (0x1 << 11) 32962306a36Sopenharmony_ci#define RT5640_DAC_L2_STO_L_VOL_SFT 11 33062306a36Sopenharmony_ci#define RT5640_M_ANC_DAC_L (0x1 << 10) 33162306a36Sopenharmony_ci#define RT5640_M_ANC_DAC_L_SFT 10 33262306a36Sopenharmony_ci#define RT5640_M_DAC_R1 (0x1 << 6) 33362306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SFT 6 33462306a36Sopenharmony_ci#define RT5640_DAC_R1_STO_R_VOL_MASK (0x1 << 5) 33562306a36Sopenharmony_ci#define RT5640_DAC_R1_STO_R_VOL_SFT 5 33662306a36Sopenharmony_ci#define RT5640_M_DAC_R2 (0x1 << 4) 33762306a36Sopenharmony_ci#define RT5640_M_DAC_R2_SFT 4 33862306a36Sopenharmony_ci#define RT5640_DAC_R2_STO_R_VOL_MASK (0x1 << 3) 33962306a36Sopenharmony_ci#define RT5640_DAC_R2_STO_R_VOL_SFT 3 34062306a36Sopenharmony_ci#define RT5640_M_ANC_DAC_R (0x1 << 2) 34162306a36Sopenharmony_ci#define RT5640_M_ANC_DAC_R_SFT 2 34262306a36Sopenharmony_ci 34362306a36Sopenharmony_ci/* Mono DAC Mixer Control (0x2b) */ 34462306a36Sopenharmony_ci#define RT5640_M_DAC_L1_MONO_L (0x1 << 14) 34562306a36Sopenharmony_ci#define RT5640_M_DAC_L1_MONO_L_SFT 14 34662306a36Sopenharmony_ci#define RT5640_DAC_L1_MONO_L_VOL_MASK (0x1 << 13) 34762306a36Sopenharmony_ci#define RT5640_DAC_L1_MONO_L_VOL_SFT 13 34862306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MONO_L (0x1 << 12) 34962306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MONO_L_SFT 12 35062306a36Sopenharmony_ci#define RT5640_DAC_L2_MONO_L_VOL_MASK (0x1 << 11) 35162306a36Sopenharmony_ci#define RT5640_DAC_L2_MONO_L_VOL_SFT 11 35262306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MONO_L (0x1 << 10) 35362306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MONO_L_SFT 10 35462306a36Sopenharmony_ci#define RT5640_DAC_R2_MONO_L_VOL_MASK (0x1 << 9) 35562306a36Sopenharmony_ci#define RT5640_DAC_R2_MONO_L_VOL_SFT 9 35662306a36Sopenharmony_ci#define RT5640_M_DAC_R1_MONO_R (0x1 << 6) 35762306a36Sopenharmony_ci#define RT5640_M_DAC_R1_MONO_R_SFT 6 35862306a36Sopenharmony_ci#define RT5640_DAC_R1_MONO_R_VOL_MASK (0x1 << 5) 35962306a36Sopenharmony_ci#define RT5640_DAC_R1_MONO_R_VOL_SFT 5 36062306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MONO_R (0x1 << 4) 36162306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MONO_R_SFT 4 36262306a36Sopenharmony_ci#define RT5640_DAC_R2_MONO_R_VOL_MASK (0x1 << 3) 36362306a36Sopenharmony_ci#define RT5640_DAC_R2_MONO_R_VOL_SFT 3 36462306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MONO_R (0x1 << 2) 36562306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MONO_R_SFT 2 36662306a36Sopenharmony_ci#define RT5640_DAC_L2_MONO_R_VOL_MASK (0x1 << 1) 36762306a36Sopenharmony_ci#define RT5640_DAC_L2_MONO_R_VOL_SFT 1 36862306a36Sopenharmony_ci 36962306a36Sopenharmony_ci/* Digital Mixer Control (0x2c) */ 37062306a36Sopenharmony_ci#define RT5640_M_STO_L_DAC_L (0x1 << 15) 37162306a36Sopenharmony_ci#define RT5640_M_STO_L_DAC_L_SFT 15 37262306a36Sopenharmony_ci#define RT5640_STO_L_DAC_L_VOL_MASK (0x1 << 14) 37362306a36Sopenharmony_ci#define RT5640_STO_L_DAC_L_VOL_SFT 14 37462306a36Sopenharmony_ci#define RT5640_M_DAC_L2_DAC_L (0x1 << 13) 37562306a36Sopenharmony_ci#define RT5640_M_DAC_L2_DAC_L_SFT 13 37662306a36Sopenharmony_ci#define RT5640_DAC_L2_DAC_L_VOL_MASK (0x1 << 12) 37762306a36Sopenharmony_ci#define RT5640_DAC_L2_DAC_L_VOL_SFT 12 37862306a36Sopenharmony_ci#define RT5640_M_STO_R_DAC_R (0x1 << 11) 37962306a36Sopenharmony_ci#define RT5640_M_STO_R_DAC_R_SFT 11 38062306a36Sopenharmony_ci#define RT5640_STO_R_DAC_R_VOL_MASK (0x1 << 10) 38162306a36Sopenharmony_ci#define RT5640_STO_R_DAC_R_VOL_SFT 10 38262306a36Sopenharmony_ci#define RT5640_M_DAC_R2_DAC_R (0x1 << 9) 38362306a36Sopenharmony_ci#define RT5640_M_DAC_R2_DAC_R_SFT 9 38462306a36Sopenharmony_ci#define RT5640_DAC_R2_DAC_R_VOL_MASK (0x1 << 8) 38562306a36Sopenharmony_ci#define RT5640_DAC_R2_DAC_R_VOL_SFT 8 38662306a36Sopenharmony_ci 38762306a36Sopenharmony_ci/* DSP Path Control 1 (0x2d) */ 38862306a36Sopenharmony_ci#define RT5640_RXDP_SRC_MASK (0x1 << 15) 38962306a36Sopenharmony_ci#define RT5640_RXDP_SRC_SFT 15 39062306a36Sopenharmony_ci#define RT5640_RXDP_SRC_NOR (0x0 << 15) 39162306a36Sopenharmony_ci#define RT5640_RXDP_SRC_DIV3 (0x1 << 15) 39262306a36Sopenharmony_ci#define RT5640_TXDP_SRC_MASK (0x1 << 14) 39362306a36Sopenharmony_ci#define RT5640_TXDP_SRC_SFT 14 39462306a36Sopenharmony_ci#define RT5640_TXDP_SRC_NOR (0x0 << 14) 39562306a36Sopenharmony_ci#define RT5640_TXDP_SRC_DIV3 (0x1 << 14) 39662306a36Sopenharmony_ci 39762306a36Sopenharmony_ci/* DSP Path Control 2 (0x2e) */ 39862306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_MASK (0x3 << 14) 39962306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_SFT 14 40062306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_IF2 (0x0 << 14) 40162306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_IF3 (0x1 << 14) 40262306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_TXDC (0x2 << 14) 40362306a36Sopenharmony_ci#define RT5640_DAC_L2_SEL_BASS (0x3 << 14) 40462306a36Sopenharmony_ci#define RT5640_DAC_R2_SEL_MASK (0x3 << 12) 40562306a36Sopenharmony_ci#define RT5640_DAC_R2_SEL_SFT 12 40662306a36Sopenharmony_ci#define RT5640_DAC_R2_SEL_IF2 (0x0 << 12) 40762306a36Sopenharmony_ci#define RT5640_DAC_R2_SEL_IF3 (0x1 << 12) 40862306a36Sopenharmony_ci#define RT5640_DAC_R2_SEL_TXDC (0x2 << 12) 40962306a36Sopenharmony_ci#define RT5640_IF2_ADC_L_SEL_MASK (0x1 << 11) 41062306a36Sopenharmony_ci#define RT5640_IF2_ADC_L_SEL_SFT 11 41162306a36Sopenharmony_ci#define RT5640_IF2_ADC_L_SEL_TXDP (0x0 << 11) 41262306a36Sopenharmony_ci#define RT5640_IF2_ADC_L_SEL_PASS (0x1 << 11) 41362306a36Sopenharmony_ci#define RT5640_IF2_ADC_R_SEL_MASK (0x1 << 10) 41462306a36Sopenharmony_ci#define RT5640_IF2_ADC_R_SEL_SFT 10 41562306a36Sopenharmony_ci#define RT5640_IF2_ADC_R_SEL_TXDP (0x0 << 10) 41662306a36Sopenharmony_ci#define RT5640_IF2_ADC_R_SEL_PASS (0x1 << 10) 41762306a36Sopenharmony_ci#define RT5640_RXDC_SEL_MASK (0x3 << 8) 41862306a36Sopenharmony_ci#define RT5640_RXDC_SEL_SFT 8 41962306a36Sopenharmony_ci#define RT5640_RXDC_SEL_NOR (0x0 << 8) 42062306a36Sopenharmony_ci#define RT5640_RXDC_SEL_L2R (0x1 << 8) 42162306a36Sopenharmony_ci#define RT5640_RXDC_SEL_R2L (0x2 << 8) 42262306a36Sopenharmony_ci#define RT5640_RXDC_SEL_SWAP (0x3 << 8) 42362306a36Sopenharmony_ci#define RT5640_RXDP_SEL_MASK (0x3 << 6) 42462306a36Sopenharmony_ci#define RT5640_RXDP_SEL_SFT 6 42562306a36Sopenharmony_ci#define RT5640_RXDP_SEL_NOR (0x0 << 6) 42662306a36Sopenharmony_ci#define RT5640_RXDP_SEL_L2R (0x1 << 6) 42762306a36Sopenharmony_ci#define RT5640_RXDP_SEL_R2L (0x2 << 6) 42862306a36Sopenharmony_ci#define RT5640_RXDP_SEL_SWAP (0x3 << 6) 42962306a36Sopenharmony_ci#define RT5640_TXDC_SEL_MASK (0x3 << 4) 43062306a36Sopenharmony_ci#define RT5640_TXDC_SEL_SFT 4 43162306a36Sopenharmony_ci#define RT5640_TXDC_SEL_NOR (0x0 << 4) 43262306a36Sopenharmony_ci#define RT5640_TXDC_SEL_L2R (0x1 << 4) 43362306a36Sopenharmony_ci#define RT5640_TXDC_SEL_R2L (0x2 << 4) 43462306a36Sopenharmony_ci#define RT5640_TXDC_SEL_SWAP (0x3 << 4) 43562306a36Sopenharmony_ci#define RT5640_TXDP_SEL_MASK (0x3 << 2) 43662306a36Sopenharmony_ci#define RT5640_TXDP_SEL_SFT 2 43762306a36Sopenharmony_ci#define RT5640_TXDP_SEL_NOR (0x0 << 2) 43862306a36Sopenharmony_ci#define RT5640_TXDP_SEL_L2R (0x1 << 2) 43962306a36Sopenharmony_ci#define RT5640_TXDP_SEL_R2L (0x2 << 2) 44062306a36Sopenharmony_ci#define RT5640_TRXDP_SEL_SWAP (0x3 << 2) 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_ci/* Digital Interface Data Control (0x2f) */ 44362306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_MASK (0x3 << 14) 44462306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_SFT 14 44562306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_NOR (0x0 << 14) 44662306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_SWAP (0x1 << 14) 44762306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_L2R (0x2 << 14) 44862306a36Sopenharmony_ci#define RT5640_IF1_DAC_SEL_R2L (0x3 << 14) 44962306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_MASK (0x3 << 12) 45062306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_SFT 12 45162306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_NOR (0x0 << 12) 45262306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_SWAP (0x1 << 12) 45362306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_L2R (0x2 << 12) 45462306a36Sopenharmony_ci#define RT5640_IF1_ADC_SEL_R2L (0x3 << 12) 45562306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_MASK (0x3 << 10) 45662306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_SFT 10 45762306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_NOR (0x0 << 10) 45862306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_SWAP (0x1 << 10) 45962306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_L2R (0x2 << 10) 46062306a36Sopenharmony_ci#define RT5640_IF2_DAC_SEL_R2L (0x3 << 10) 46162306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_MASK (0x3 << 8) 46262306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_SFT 8 46362306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_NOR (0x0 << 8) 46462306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_SWAP (0x1 << 8) 46562306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_L2R (0x2 << 8) 46662306a36Sopenharmony_ci#define RT5640_IF2_ADC_SEL_R2L (0x3 << 8) 46762306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_MASK (0x3 << 6) 46862306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_SFT 6 46962306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_NOR (0x0 << 6) 47062306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_SWAP (0x1 << 6) 47162306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_L2R (0x2 << 6) 47262306a36Sopenharmony_ci#define RT5640_IF3_DAC_SEL_R2L (0x3 << 6) 47362306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_MASK (0x3 << 4) 47462306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_SFT 4 47562306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_NOR (0x0 << 4) 47662306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_SWAP (0x1 << 4) 47762306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_L2R (0x2 << 4) 47862306a36Sopenharmony_ci#define RT5640_IF3_ADC_SEL_R2L (0x3 << 4) 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_ci/* REC Left Mixer Control 1 (0x3b) */ 48162306a36Sopenharmony_ci#define RT5640_G_HP_L_RM_L_MASK (0x7 << 13) 48262306a36Sopenharmony_ci#define RT5640_G_HP_L_RM_L_SFT 13 48362306a36Sopenharmony_ci#define RT5640_G_IN_L_RM_L_MASK (0x7 << 10) 48462306a36Sopenharmony_ci#define RT5640_G_IN_L_RM_L_SFT 10 48562306a36Sopenharmony_ci#define RT5640_G_BST4_RM_L_MASK (0x7 << 7) 48662306a36Sopenharmony_ci#define RT5640_G_BST4_RM_L_SFT 7 48762306a36Sopenharmony_ci#define RT5640_G_BST3_RM_L_MASK (0x7 << 4) 48862306a36Sopenharmony_ci#define RT5640_G_BST3_RM_L_SFT 4 48962306a36Sopenharmony_ci#define RT5640_G_BST2_RM_L_MASK (0x7 << 1) 49062306a36Sopenharmony_ci#define RT5640_G_BST2_RM_L_SFT 1 49162306a36Sopenharmony_ci 49262306a36Sopenharmony_ci/* REC Left Mixer Control 2 (0x3c) */ 49362306a36Sopenharmony_ci#define RT5640_G_BST1_RM_L_MASK (0x7 << 13) 49462306a36Sopenharmony_ci#define RT5640_G_BST1_RM_L_SFT 13 49562306a36Sopenharmony_ci#define RT5640_G_OM_L_RM_L_MASK (0x7 << 10) 49662306a36Sopenharmony_ci#define RT5640_G_OM_L_RM_L_SFT 10 49762306a36Sopenharmony_ci#define RT5640_M_HP_L_RM_L (0x1 << 6) 49862306a36Sopenharmony_ci#define RT5640_M_HP_L_RM_L_SFT 6 49962306a36Sopenharmony_ci#define RT5640_M_IN_L_RM_L (0x1 << 5) 50062306a36Sopenharmony_ci#define RT5640_M_IN_L_RM_L_SFT 5 50162306a36Sopenharmony_ci#define RT5640_M_BST4_RM_L (0x1 << 4) 50262306a36Sopenharmony_ci#define RT5640_M_BST4_RM_L_SFT 4 50362306a36Sopenharmony_ci#define RT5640_M_BST3_RM_L (0x1 << 3) 50462306a36Sopenharmony_ci#define RT5640_M_BST3_RM_L_SFT 3 50562306a36Sopenharmony_ci#define RT5640_M_BST2_RM_L (0x1 << 2) 50662306a36Sopenharmony_ci#define RT5640_M_BST2_RM_L_SFT 2 50762306a36Sopenharmony_ci#define RT5640_M_BST1_RM_L (0x1 << 1) 50862306a36Sopenharmony_ci#define RT5640_M_BST1_RM_L_SFT 1 50962306a36Sopenharmony_ci#define RT5640_M_OM_L_RM_L (0x1) 51062306a36Sopenharmony_ci#define RT5640_M_OM_L_RM_L_SFT 0 51162306a36Sopenharmony_ci 51262306a36Sopenharmony_ci/* REC Right Mixer Control 1 (0x3d) */ 51362306a36Sopenharmony_ci#define RT5640_G_HP_R_RM_R_MASK (0x7 << 13) 51462306a36Sopenharmony_ci#define RT5640_G_HP_R_RM_R_SFT 13 51562306a36Sopenharmony_ci#define RT5640_G_IN_R_RM_R_MASK (0x7 << 10) 51662306a36Sopenharmony_ci#define RT5640_G_IN_R_RM_R_SFT 10 51762306a36Sopenharmony_ci#define RT5640_G_BST4_RM_R_MASK (0x7 << 7) 51862306a36Sopenharmony_ci#define RT5640_G_BST4_RM_R_SFT 7 51962306a36Sopenharmony_ci#define RT5640_G_BST3_RM_R_MASK (0x7 << 4) 52062306a36Sopenharmony_ci#define RT5640_G_BST3_RM_R_SFT 4 52162306a36Sopenharmony_ci#define RT5640_G_BST2_RM_R_MASK (0x7 << 1) 52262306a36Sopenharmony_ci#define RT5640_G_BST2_RM_R_SFT 1 52362306a36Sopenharmony_ci 52462306a36Sopenharmony_ci/* REC Right Mixer Control 2 (0x3e) */ 52562306a36Sopenharmony_ci#define RT5640_G_BST1_RM_R_MASK (0x7 << 13) 52662306a36Sopenharmony_ci#define RT5640_G_BST1_RM_R_SFT 13 52762306a36Sopenharmony_ci#define RT5640_G_OM_R_RM_R_MASK (0x7 << 10) 52862306a36Sopenharmony_ci#define RT5640_G_OM_R_RM_R_SFT 10 52962306a36Sopenharmony_ci#define RT5640_M_HP_R_RM_R (0x1 << 6) 53062306a36Sopenharmony_ci#define RT5640_M_HP_R_RM_R_SFT 6 53162306a36Sopenharmony_ci#define RT5640_M_IN_R_RM_R (0x1 << 5) 53262306a36Sopenharmony_ci#define RT5640_M_IN_R_RM_R_SFT 5 53362306a36Sopenharmony_ci#define RT5640_M_BST4_RM_R (0x1 << 4) 53462306a36Sopenharmony_ci#define RT5640_M_BST4_RM_R_SFT 4 53562306a36Sopenharmony_ci#define RT5640_M_BST3_RM_R (0x1 << 3) 53662306a36Sopenharmony_ci#define RT5640_M_BST3_RM_R_SFT 3 53762306a36Sopenharmony_ci#define RT5640_M_BST2_RM_R (0x1 << 2) 53862306a36Sopenharmony_ci#define RT5640_M_BST2_RM_R_SFT 2 53962306a36Sopenharmony_ci#define RT5640_M_BST1_RM_R (0x1 << 1) 54062306a36Sopenharmony_ci#define RT5640_M_BST1_RM_R_SFT 1 54162306a36Sopenharmony_ci#define RT5640_M_OM_R_RM_R (0x1) 54262306a36Sopenharmony_ci#define RT5640_M_OM_R_RM_R_SFT 0 54362306a36Sopenharmony_ci 54462306a36Sopenharmony_ci/* HPMIX Control (0x45) */ 54562306a36Sopenharmony_ci#define RT5640_M_DAC2_HM (0x1 << 15) 54662306a36Sopenharmony_ci#define RT5640_M_DAC2_HM_SFT 15 54762306a36Sopenharmony_ci#define RT5640_M_DAC1_HM (0x1 << 14) 54862306a36Sopenharmony_ci#define RT5640_M_DAC1_HM_SFT 14 54962306a36Sopenharmony_ci#define RT5640_M_HPVOL_HM (0x1 << 13) 55062306a36Sopenharmony_ci#define RT5640_M_HPVOL_HM_SFT 13 55162306a36Sopenharmony_ci#define RT5640_G_HPOMIX_MASK (0x1 << 12) 55262306a36Sopenharmony_ci#define RT5640_G_HPOMIX_SFT 12 55362306a36Sopenharmony_ci 55462306a36Sopenharmony_ci/* SPK Left Mixer Control (0x46) */ 55562306a36Sopenharmony_ci#define RT5640_G_RM_L_SM_L_MASK (0x3 << 14) 55662306a36Sopenharmony_ci#define RT5640_G_RM_L_SM_L_SFT 14 55762306a36Sopenharmony_ci#define RT5640_G_IN_L_SM_L_MASK (0x3 << 12) 55862306a36Sopenharmony_ci#define RT5640_G_IN_L_SM_L_SFT 12 55962306a36Sopenharmony_ci#define RT5640_G_DAC_L1_SM_L_MASK (0x3 << 10) 56062306a36Sopenharmony_ci#define RT5640_G_DAC_L1_SM_L_SFT 10 56162306a36Sopenharmony_ci#define RT5640_G_DAC_L2_SM_L_MASK (0x3 << 8) 56262306a36Sopenharmony_ci#define RT5640_G_DAC_L2_SM_L_SFT 8 56362306a36Sopenharmony_ci#define RT5640_G_OM_L_SM_L_MASK (0x3 << 6) 56462306a36Sopenharmony_ci#define RT5640_G_OM_L_SM_L_SFT 6 56562306a36Sopenharmony_ci#define RT5640_M_RM_L_SM_L (0x1 << 5) 56662306a36Sopenharmony_ci#define RT5640_M_RM_L_SM_L_SFT 5 56762306a36Sopenharmony_ci#define RT5640_M_IN_L_SM_L (0x1 << 4) 56862306a36Sopenharmony_ci#define RT5640_M_IN_L_SM_L_SFT 4 56962306a36Sopenharmony_ci#define RT5640_M_DAC_L1_SM_L (0x1 << 3) 57062306a36Sopenharmony_ci#define RT5640_M_DAC_L1_SM_L_SFT 3 57162306a36Sopenharmony_ci#define RT5640_M_DAC_L2_SM_L (0x1 << 2) 57262306a36Sopenharmony_ci#define RT5640_M_DAC_L2_SM_L_SFT 2 57362306a36Sopenharmony_ci#define RT5640_M_OM_L_SM_L (0x1 << 1) 57462306a36Sopenharmony_ci#define RT5640_M_OM_L_SM_L_SFT 1 57562306a36Sopenharmony_ci 57662306a36Sopenharmony_ci/* SPK Right Mixer Control (0x47) */ 57762306a36Sopenharmony_ci#define RT5640_G_RM_R_SM_R_MASK (0x3 << 14) 57862306a36Sopenharmony_ci#define RT5640_G_RM_R_SM_R_SFT 14 57962306a36Sopenharmony_ci#define RT5640_G_IN_R_SM_R_MASK (0x3 << 12) 58062306a36Sopenharmony_ci#define RT5640_G_IN_R_SM_R_SFT 12 58162306a36Sopenharmony_ci#define RT5640_G_DAC_R1_SM_R_MASK (0x3 << 10) 58262306a36Sopenharmony_ci#define RT5640_G_DAC_R1_SM_R_SFT 10 58362306a36Sopenharmony_ci#define RT5640_G_DAC_R2_SM_R_MASK (0x3 << 8) 58462306a36Sopenharmony_ci#define RT5640_G_DAC_R2_SM_R_SFT 8 58562306a36Sopenharmony_ci#define RT5640_G_OM_R_SM_R_MASK (0x3 << 6) 58662306a36Sopenharmony_ci#define RT5640_G_OM_R_SM_R_SFT 6 58762306a36Sopenharmony_ci#define RT5640_M_RM_R_SM_R (0x1 << 5) 58862306a36Sopenharmony_ci#define RT5640_M_RM_R_SM_R_SFT 5 58962306a36Sopenharmony_ci#define RT5640_M_IN_R_SM_R (0x1 << 4) 59062306a36Sopenharmony_ci#define RT5640_M_IN_R_SM_R_SFT 4 59162306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SM_R (0x1 << 3) 59262306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SM_R_SFT 3 59362306a36Sopenharmony_ci#define RT5640_M_DAC_R2_SM_R (0x1 << 2) 59462306a36Sopenharmony_ci#define RT5640_M_DAC_R2_SM_R_SFT 2 59562306a36Sopenharmony_ci#define RT5640_M_OM_R_SM_R (0x1 << 1) 59662306a36Sopenharmony_ci#define RT5640_M_OM_R_SM_R_SFT 1 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_ci/* SPOLMIX Control (0x48) */ 59962306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SPM_L (0x1 << 15) 60062306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SPM_L_SFT 15 60162306a36Sopenharmony_ci#define RT5640_M_DAC_L1_SPM_L (0x1 << 14) 60262306a36Sopenharmony_ci#define RT5640_M_DAC_L1_SPM_L_SFT 14 60362306a36Sopenharmony_ci#define RT5640_M_SV_R_SPM_L (0x1 << 13) 60462306a36Sopenharmony_ci#define RT5640_M_SV_R_SPM_L_SFT 13 60562306a36Sopenharmony_ci#define RT5640_M_SV_L_SPM_L (0x1 << 12) 60662306a36Sopenharmony_ci#define RT5640_M_SV_L_SPM_L_SFT 12 60762306a36Sopenharmony_ci#define RT5640_M_BST1_SPM_L (0x1 << 11) 60862306a36Sopenharmony_ci#define RT5640_M_BST1_SPM_L_SFT 11 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_ci/* SPORMIX Control (0x49) */ 61162306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SPM_R (0x1 << 13) 61262306a36Sopenharmony_ci#define RT5640_M_DAC_R1_SPM_R_SFT 13 61362306a36Sopenharmony_ci#define RT5640_M_SV_R_SPM_R (0x1 << 12) 61462306a36Sopenharmony_ci#define RT5640_M_SV_R_SPM_R_SFT 12 61562306a36Sopenharmony_ci#define RT5640_M_BST1_SPM_R (0x1 << 11) 61662306a36Sopenharmony_ci#define RT5640_M_BST1_SPM_R_SFT 11 61762306a36Sopenharmony_ci 61862306a36Sopenharmony_ci/* SPOLMIX / SPORMIX Ratio Control (0x4a) */ 61962306a36Sopenharmony_ci#define RT5640_SPO_CLSD_RATIO_MASK (0x7) 62062306a36Sopenharmony_ci#define RT5640_SPO_CLSD_RATIO_SFT 0 62162306a36Sopenharmony_ci 62262306a36Sopenharmony_ci/* Mono Output Mixer Control (0x4c) */ 62362306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MM (0x1 << 15) 62462306a36Sopenharmony_ci#define RT5640_M_DAC_R2_MM_SFT 15 62562306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MM (0x1 << 14) 62662306a36Sopenharmony_ci#define RT5640_M_DAC_L2_MM_SFT 14 62762306a36Sopenharmony_ci#define RT5640_M_OV_R_MM (0x1 << 13) 62862306a36Sopenharmony_ci#define RT5640_M_OV_R_MM_SFT 13 62962306a36Sopenharmony_ci#define RT5640_M_OV_L_MM (0x1 << 12) 63062306a36Sopenharmony_ci#define RT5640_M_OV_L_MM_SFT 12 63162306a36Sopenharmony_ci#define RT5640_M_BST1_MM (0x1 << 11) 63262306a36Sopenharmony_ci#define RT5640_M_BST1_MM_SFT 11 63362306a36Sopenharmony_ci#define RT5640_G_MONOMIX_MASK (0x1 << 10) 63462306a36Sopenharmony_ci#define RT5640_G_MONOMIX_SFT 10 63562306a36Sopenharmony_ci 63662306a36Sopenharmony_ci/* Output Left Mixer Control 1 (0x4d) */ 63762306a36Sopenharmony_ci#define RT5640_G_BST3_OM_L_MASK (0x7 << 13) 63862306a36Sopenharmony_ci#define RT5640_G_BST3_OM_L_SFT 13 63962306a36Sopenharmony_ci#define RT5640_G_BST2_OM_L_MASK (0x7 << 10) 64062306a36Sopenharmony_ci#define RT5640_G_BST2_OM_L_SFT 10 64162306a36Sopenharmony_ci#define RT5640_G_BST1_OM_L_MASK (0x7 << 7) 64262306a36Sopenharmony_ci#define RT5640_G_BST1_OM_L_SFT 7 64362306a36Sopenharmony_ci#define RT5640_G_IN_L_OM_L_MASK (0x7 << 4) 64462306a36Sopenharmony_ci#define RT5640_G_IN_L_OM_L_SFT 4 64562306a36Sopenharmony_ci#define RT5640_G_RM_L_OM_L_MASK (0x7 << 1) 64662306a36Sopenharmony_ci#define RT5640_G_RM_L_OM_L_SFT 1 64762306a36Sopenharmony_ci 64862306a36Sopenharmony_ci/* Output Left Mixer Control 2 (0x4e) */ 64962306a36Sopenharmony_ci#define RT5640_G_DAC_R2_OM_L_MASK (0x7 << 13) 65062306a36Sopenharmony_ci#define RT5640_G_DAC_R2_OM_L_SFT 13 65162306a36Sopenharmony_ci#define RT5640_G_DAC_L2_OM_L_MASK (0x7 << 10) 65262306a36Sopenharmony_ci#define RT5640_G_DAC_L2_OM_L_SFT 10 65362306a36Sopenharmony_ci#define RT5640_G_DAC_L1_OM_L_MASK (0x7 << 7) 65462306a36Sopenharmony_ci#define RT5640_G_DAC_L1_OM_L_SFT 7 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_ci/* Output Left Mixer Control 3 (0x4f) */ 65762306a36Sopenharmony_ci#define RT5640_M_SM_L_OM_L (0x1 << 8) 65862306a36Sopenharmony_ci#define RT5640_M_SM_L_OM_L_SFT 8 65962306a36Sopenharmony_ci#define RT5640_M_BST3_OM_L (0x1 << 7) 66062306a36Sopenharmony_ci#define RT5640_M_BST3_OM_L_SFT 7 66162306a36Sopenharmony_ci#define RT5640_M_BST2_OM_L (0x1 << 6) 66262306a36Sopenharmony_ci#define RT5640_M_BST2_OM_L_SFT 6 66362306a36Sopenharmony_ci#define RT5640_M_BST1_OM_L (0x1 << 5) 66462306a36Sopenharmony_ci#define RT5640_M_BST1_OM_L_SFT 5 66562306a36Sopenharmony_ci#define RT5640_M_IN_L_OM_L (0x1 << 4) 66662306a36Sopenharmony_ci#define RT5640_M_IN_L_OM_L_SFT 4 66762306a36Sopenharmony_ci#define RT5640_M_RM_L_OM_L (0x1 << 3) 66862306a36Sopenharmony_ci#define RT5640_M_RM_L_OM_L_SFT 3 66962306a36Sopenharmony_ci#define RT5640_M_DAC_R2_OM_L (0x1 << 2) 67062306a36Sopenharmony_ci#define RT5640_M_DAC_R2_OM_L_SFT 2 67162306a36Sopenharmony_ci#define RT5640_M_DAC_L2_OM_L (0x1 << 1) 67262306a36Sopenharmony_ci#define RT5640_M_DAC_L2_OM_L_SFT 1 67362306a36Sopenharmony_ci#define RT5640_M_DAC_L1_OM_L (0x1) 67462306a36Sopenharmony_ci#define RT5640_M_DAC_L1_OM_L_SFT 0 67562306a36Sopenharmony_ci 67662306a36Sopenharmony_ci/* Output Right Mixer Control 1 (0x50) */ 67762306a36Sopenharmony_ci#define RT5640_G_BST4_OM_R_MASK (0x7 << 13) 67862306a36Sopenharmony_ci#define RT5640_G_BST4_OM_R_SFT 13 67962306a36Sopenharmony_ci#define RT5640_G_BST2_OM_R_MASK (0x7 << 10) 68062306a36Sopenharmony_ci#define RT5640_G_BST2_OM_R_SFT 10 68162306a36Sopenharmony_ci#define RT5640_G_BST1_OM_R_MASK (0x7 << 7) 68262306a36Sopenharmony_ci#define RT5640_G_BST1_OM_R_SFT 7 68362306a36Sopenharmony_ci#define RT5640_G_IN_R_OM_R_MASK (0x7 << 4) 68462306a36Sopenharmony_ci#define RT5640_G_IN_R_OM_R_SFT 4 68562306a36Sopenharmony_ci#define RT5640_G_RM_R_OM_R_MASK (0x7 << 1) 68662306a36Sopenharmony_ci#define RT5640_G_RM_R_OM_R_SFT 1 68762306a36Sopenharmony_ci 68862306a36Sopenharmony_ci/* Output Right Mixer Control 2 (0x51) */ 68962306a36Sopenharmony_ci#define RT5640_G_DAC_L2_OM_R_MASK (0x7 << 13) 69062306a36Sopenharmony_ci#define RT5640_G_DAC_L2_OM_R_SFT 13 69162306a36Sopenharmony_ci#define RT5640_G_DAC_R2_OM_R_MASK (0x7 << 10) 69262306a36Sopenharmony_ci#define RT5640_G_DAC_R2_OM_R_SFT 10 69362306a36Sopenharmony_ci#define RT5640_G_DAC_R1_OM_R_MASK (0x7 << 7) 69462306a36Sopenharmony_ci#define RT5640_G_DAC_R1_OM_R_SFT 7 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ci/* Output Right Mixer Control 3 (0x52) */ 69762306a36Sopenharmony_ci#define RT5640_M_SM_L_OM_R (0x1 << 8) 69862306a36Sopenharmony_ci#define RT5640_M_SM_L_OM_R_SFT 8 69962306a36Sopenharmony_ci#define RT5640_M_BST4_OM_R (0x1 << 7) 70062306a36Sopenharmony_ci#define RT5640_M_BST4_OM_R_SFT 7 70162306a36Sopenharmony_ci#define RT5640_M_BST2_OM_R (0x1 << 6) 70262306a36Sopenharmony_ci#define RT5640_M_BST2_OM_R_SFT 6 70362306a36Sopenharmony_ci#define RT5640_M_BST1_OM_R (0x1 << 5) 70462306a36Sopenharmony_ci#define RT5640_M_BST1_OM_R_SFT 5 70562306a36Sopenharmony_ci#define RT5640_M_IN_R_OM_R (0x1 << 4) 70662306a36Sopenharmony_ci#define RT5640_M_IN_R_OM_R_SFT 4 70762306a36Sopenharmony_ci#define RT5640_M_RM_R_OM_R (0x1 << 3) 70862306a36Sopenharmony_ci#define RT5640_M_RM_R_OM_R_SFT 3 70962306a36Sopenharmony_ci#define RT5640_M_DAC_L2_OM_R (0x1 << 2) 71062306a36Sopenharmony_ci#define RT5640_M_DAC_L2_OM_R_SFT 2 71162306a36Sopenharmony_ci#define RT5640_M_DAC_R2_OM_R (0x1 << 1) 71262306a36Sopenharmony_ci#define RT5640_M_DAC_R2_OM_R_SFT 1 71362306a36Sopenharmony_ci#define RT5640_M_DAC_R1_OM_R (0x1) 71462306a36Sopenharmony_ci#define RT5640_M_DAC_R1_OM_R_SFT 0 71562306a36Sopenharmony_ci 71662306a36Sopenharmony_ci/* LOUT Mixer Control (0x53) */ 71762306a36Sopenharmony_ci#define RT5640_M_DAC_L1_LM (0x1 << 15) 71862306a36Sopenharmony_ci#define RT5640_M_DAC_L1_LM_SFT 15 71962306a36Sopenharmony_ci#define RT5640_M_DAC_R1_LM (0x1 << 14) 72062306a36Sopenharmony_ci#define RT5640_M_DAC_R1_LM_SFT 14 72162306a36Sopenharmony_ci#define RT5640_M_OV_L_LM (0x1 << 13) 72262306a36Sopenharmony_ci#define RT5640_M_OV_L_LM_SFT 13 72362306a36Sopenharmony_ci#define RT5640_M_OV_R_LM (0x1 << 12) 72462306a36Sopenharmony_ci#define RT5640_M_OV_R_LM_SFT 12 72562306a36Sopenharmony_ci#define RT5640_G_LOUTMIX_MASK (0x1 << 11) 72662306a36Sopenharmony_ci#define RT5640_G_LOUTMIX_SFT 11 72762306a36Sopenharmony_ci 72862306a36Sopenharmony_ci/* Power Management for Digital 1 (0x61) */ 72962306a36Sopenharmony_ci#define RT5640_PWR_I2S1 (0x1 << 15) 73062306a36Sopenharmony_ci#define RT5640_PWR_I2S1_BIT 15 73162306a36Sopenharmony_ci#define RT5640_PWR_I2S2 (0x1 << 14) 73262306a36Sopenharmony_ci#define RT5640_PWR_I2S2_BIT 14 73362306a36Sopenharmony_ci#define RT5640_PWR_DAC_L1 (0x1 << 12) 73462306a36Sopenharmony_ci#define RT5640_PWR_DAC_L1_BIT 12 73562306a36Sopenharmony_ci#define RT5640_PWR_DAC_R1 (0x1 << 11) 73662306a36Sopenharmony_ci#define RT5640_PWR_DAC_R1_BIT 11 73762306a36Sopenharmony_ci#define RT5640_PWR_DAC_L2 (0x1 << 7) 73862306a36Sopenharmony_ci#define RT5640_PWR_DAC_L2_BIT 7 73962306a36Sopenharmony_ci#define RT5640_PWR_DAC_R2 (0x1 << 6) 74062306a36Sopenharmony_ci#define RT5640_PWR_DAC_R2_BIT 6 74162306a36Sopenharmony_ci#define RT5640_PWR_ADC_L (0x1 << 2) 74262306a36Sopenharmony_ci#define RT5640_PWR_ADC_L_BIT 2 74362306a36Sopenharmony_ci#define RT5640_PWR_ADC_R (0x1 << 1) 74462306a36Sopenharmony_ci#define RT5640_PWR_ADC_R_BIT 1 74562306a36Sopenharmony_ci#define RT5640_PWR_CLS_D (0x1) 74662306a36Sopenharmony_ci#define RT5640_PWR_CLS_D_BIT 0 74762306a36Sopenharmony_ci 74862306a36Sopenharmony_ci/* Power Management for Digital 2 (0x62) */ 74962306a36Sopenharmony_ci#define RT5640_PWR_ADC_SF (0x1 << 15) 75062306a36Sopenharmony_ci#define RT5640_PWR_ADC_SF_BIT 15 75162306a36Sopenharmony_ci#define RT5640_PWR_ADC_MF_L (0x1 << 14) 75262306a36Sopenharmony_ci#define RT5640_PWR_ADC_MF_L_BIT 14 75362306a36Sopenharmony_ci#define RT5640_PWR_ADC_MF_R (0x1 << 13) 75462306a36Sopenharmony_ci#define RT5640_PWR_ADC_MF_R_BIT 13 75562306a36Sopenharmony_ci#define RT5640_PWR_I2S_DSP (0x1 << 12) 75662306a36Sopenharmony_ci#define RT5640_PWR_I2S_DSP_BIT 12 75762306a36Sopenharmony_ci 75862306a36Sopenharmony_ci/* Power Management for Analog 1 (0x63) */ 75962306a36Sopenharmony_ci#define RT5640_PWR_VREF1 (0x1 << 15) 76062306a36Sopenharmony_ci#define RT5640_PWR_VREF1_BIT 15 76162306a36Sopenharmony_ci#define RT5640_PWR_FV1 (0x1 << 14) 76262306a36Sopenharmony_ci#define RT5640_PWR_FV1_BIT 14 76362306a36Sopenharmony_ci#define RT5640_PWR_MB (0x1 << 13) 76462306a36Sopenharmony_ci#define RT5640_PWR_MB_BIT 13 76562306a36Sopenharmony_ci#define RT5640_PWR_LM (0x1 << 12) 76662306a36Sopenharmony_ci#define RT5640_PWR_LM_BIT 12 76762306a36Sopenharmony_ci#define RT5640_PWR_BG (0x1 << 11) 76862306a36Sopenharmony_ci#define RT5640_PWR_BG_BIT 11 76962306a36Sopenharmony_ci#define RT5640_PWR_MM (0x1 << 10) 77062306a36Sopenharmony_ci#define RT5640_PWR_MM_BIT 10 77162306a36Sopenharmony_ci#define RT5640_PWR_MA (0x1 << 8) 77262306a36Sopenharmony_ci#define RT5640_PWR_MA_BIT 8 77362306a36Sopenharmony_ci#define RT5640_PWR_HP_L (0x1 << 7) 77462306a36Sopenharmony_ci#define RT5640_PWR_HP_L_BIT 7 77562306a36Sopenharmony_ci#define RT5640_PWR_HP_R (0x1 << 6) 77662306a36Sopenharmony_ci#define RT5640_PWR_HP_R_BIT 6 77762306a36Sopenharmony_ci#define RT5640_PWR_HA (0x1 << 5) 77862306a36Sopenharmony_ci#define RT5640_PWR_HA_BIT 5 77962306a36Sopenharmony_ci#define RT5640_PWR_VREF2 (0x1 << 4) 78062306a36Sopenharmony_ci#define RT5640_PWR_VREF2_BIT 4 78162306a36Sopenharmony_ci#define RT5640_PWR_FV2 (0x1 << 3) 78262306a36Sopenharmony_ci#define RT5640_PWR_FV2_BIT 3 78362306a36Sopenharmony_ci#define RT5640_PWR_LDO2 (0x1 << 2) 78462306a36Sopenharmony_ci#define RT5640_PWR_LDO2_BIT 2 78562306a36Sopenharmony_ci 78662306a36Sopenharmony_ci/* Power Management for Analog 2 (0x64) */ 78762306a36Sopenharmony_ci#define RT5640_PWR_BST1 (0x1 << 15) 78862306a36Sopenharmony_ci#define RT5640_PWR_BST1_BIT 15 78962306a36Sopenharmony_ci#define RT5640_PWR_BST2 (0x1 << 14) 79062306a36Sopenharmony_ci#define RT5640_PWR_BST2_BIT 14 79162306a36Sopenharmony_ci#define RT5640_PWR_BST3 (0x1 << 13) 79262306a36Sopenharmony_ci#define RT5640_PWR_BST3_BIT 13 79362306a36Sopenharmony_ci#define RT5640_PWR_BST4 (0x1 << 12) 79462306a36Sopenharmony_ci#define RT5640_PWR_BST4_BIT 12 79562306a36Sopenharmony_ci#define RT5640_PWR_MB1 (0x1 << 11) 79662306a36Sopenharmony_ci#define RT5640_PWR_MB1_BIT 11 79762306a36Sopenharmony_ci#define RT5640_PWR_PLL (0x1 << 9) 79862306a36Sopenharmony_ci#define RT5640_PWR_PLL_BIT 9 79962306a36Sopenharmony_ci 80062306a36Sopenharmony_ci/* Power Management for Mixer (0x65) */ 80162306a36Sopenharmony_ci#define RT5640_PWR_OM_L (0x1 << 15) 80262306a36Sopenharmony_ci#define RT5640_PWR_OM_L_BIT 15 80362306a36Sopenharmony_ci#define RT5640_PWR_OM_R (0x1 << 14) 80462306a36Sopenharmony_ci#define RT5640_PWR_OM_R_BIT 14 80562306a36Sopenharmony_ci#define RT5640_PWR_SM_L (0x1 << 13) 80662306a36Sopenharmony_ci#define RT5640_PWR_SM_L_BIT 13 80762306a36Sopenharmony_ci#define RT5640_PWR_SM_R (0x1 << 12) 80862306a36Sopenharmony_ci#define RT5640_PWR_SM_R_BIT 12 80962306a36Sopenharmony_ci#define RT5640_PWR_RM_L (0x1 << 11) 81062306a36Sopenharmony_ci#define RT5640_PWR_RM_L_BIT 11 81162306a36Sopenharmony_ci#define RT5640_PWR_RM_R (0x1 << 10) 81262306a36Sopenharmony_ci#define RT5640_PWR_RM_R_BIT 10 81362306a36Sopenharmony_ci 81462306a36Sopenharmony_ci/* Power Management for Volume (0x66) */ 81562306a36Sopenharmony_ci#define RT5640_PWR_SV_L (0x1 << 15) 81662306a36Sopenharmony_ci#define RT5640_PWR_SV_L_BIT 15 81762306a36Sopenharmony_ci#define RT5640_PWR_SV_R (0x1 << 14) 81862306a36Sopenharmony_ci#define RT5640_PWR_SV_R_BIT 14 81962306a36Sopenharmony_ci#define RT5640_PWR_OV_L (0x1 << 13) 82062306a36Sopenharmony_ci#define RT5640_PWR_OV_L_BIT 13 82162306a36Sopenharmony_ci#define RT5640_PWR_OV_R (0x1 << 12) 82262306a36Sopenharmony_ci#define RT5640_PWR_OV_R_BIT 12 82362306a36Sopenharmony_ci#define RT5640_PWR_HV_L (0x1 << 11) 82462306a36Sopenharmony_ci#define RT5640_PWR_HV_L_BIT 11 82562306a36Sopenharmony_ci#define RT5640_PWR_HV_R (0x1 << 10) 82662306a36Sopenharmony_ci#define RT5640_PWR_HV_R_BIT 10 82762306a36Sopenharmony_ci#define RT5640_PWR_IN_L (0x1 << 9) 82862306a36Sopenharmony_ci#define RT5640_PWR_IN_L_BIT 9 82962306a36Sopenharmony_ci#define RT5640_PWR_IN_R (0x1 << 8) 83062306a36Sopenharmony_ci#define RT5640_PWR_IN_R_BIT 8 83162306a36Sopenharmony_ci 83262306a36Sopenharmony_ci/* I2S1/2/3 Audio Serial Data Port Control (0x70 0x71 0x72) */ 83362306a36Sopenharmony_ci#define RT5640_I2S_MS_MASK (0x1 << 15) 83462306a36Sopenharmony_ci#define RT5640_I2S_MS_SFT 15 83562306a36Sopenharmony_ci#define RT5640_I2S_MS_M (0x0 << 15) 83662306a36Sopenharmony_ci#define RT5640_I2S_MS_S (0x1 << 15) 83762306a36Sopenharmony_ci#define RT5640_I2S_IF_MASK (0x7 << 12) 83862306a36Sopenharmony_ci#define RT5640_I2S_IF_SFT 12 83962306a36Sopenharmony_ci#define RT5640_I2S_O_CP_MASK (0x3 << 10) 84062306a36Sopenharmony_ci#define RT5640_I2S_O_CP_SFT 10 84162306a36Sopenharmony_ci#define RT5640_I2S_O_CP_OFF (0x0 << 10) 84262306a36Sopenharmony_ci#define RT5640_I2S_O_CP_U_LAW (0x1 << 10) 84362306a36Sopenharmony_ci#define RT5640_I2S_O_CP_A_LAW (0x2 << 10) 84462306a36Sopenharmony_ci#define RT5640_I2S_I_CP_MASK (0x3 << 8) 84562306a36Sopenharmony_ci#define RT5640_I2S_I_CP_SFT 8 84662306a36Sopenharmony_ci#define RT5640_I2S_I_CP_OFF (0x0 << 8) 84762306a36Sopenharmony_ci#define RT5640_I2S_I_CP_U_LAW (0x1 << 8) 84862306a36Sopenharmony_ci#define RT5640_I2S_I_CP_A_LAW (0x2 << 8) 84962306a36Sopenharmony_ci#define RT5640_I2S_BP_MASK (0x1 << 7) 85062306a36Sopenharmony_ci#define RT5640_I2S_BP_SFT 7 85162306a36Sopenharmony_ci#define RT5640_I2S_BP_NOR (0x0 << 7) 85262306a36Sopenharmony_ci#define RT5640_I2S_BP_INV (0x1 << 7) 85362306a36Sopenharmony_ci#define RT5640_I2S_DL_MASK (0x3 << 2) 85462306a36Sopenharmony_ci#define RT5640_I2S_DL_SFT 2 85562306a36Sopenharmony_ci#define RT5640_I2S_DL_16 (0x0 << 2) 85662306a36Sopenharmony_ci#define RT5640_I2S_DL_20 (0x1 << 2) 85762306a36Sopenharmony_ci#define RT5640_I2S_DL_24 (0x2 << 2) 85862306a36Sopenharmony_ci#define RT5640_I2S_DL_8 (0x3 << 2) 85962306a36Sopenharmony_ci#define RT5640_I2S_DF_MASK (0x3) 86062306a36Sopenharmony_ci#define RT5640_I2S_DF_SFT 0 86162306a36Sopenharmony_ci#define RT5640_I2S_DF_I2S (0x0) 86262306a36Sopenharmony_ci#define RT5640_I2S_DF_LEFT (0x1) 86362306a36Sopenharmony_ci#define RT5640_I2S_DF_PCM_A (0x2) 86462306a36Sopenharmony_ci#define RT5640_I2S_DF_PCM_B (0x3) 86562306a36Sopenharmony_ci 86662306a36Sopenharmony_ci/* I2S2 Audio Serial Data Port Control (0x71) */ 86762306a36Sopenharmony_ci#define RT5640_I2S2_SDI_MASK (0x1 << 6) 86862306a36Sopenharmony_ci#define RT5640_I2S2_SDI_SFT 6 86962306a36Sopenharmony_ci#define RT5640_I2S2_SDI_I2S1 (0x0 << 6) 87062306a36Sopenharmony_ci#define RT5640_I2S2_SDI_I2S2 (0x1 << 6) 87162306a36Sopenharmony_ci 87262306a36Sopenharmony_ci/* ADC/DAC Clock Control 1 (0x73) */ 87362306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS1_MASK (0x1 << 15) 87462306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS1_SFT 15 87562306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS1_32 (0x0 << 15) 87662306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS1_64 (0x1 << 15) 87762306a36Sopenharmony_ci#define RT5640_I2S_PD1_MASK (0x7 << 12) 87862306a36Sopenharmony_ci#define RT5640_I2S_PD1_SFT 12 87962306a36Sopenharmony_ci#define RT5640_I2S_PD1_1 (0x0 << 12) 88062306a36Sopenharmony_ci#define RT5640_I2S_PD1_2 (0x1 << 12) 88162306a36Sopenharmony_ci#define RT5640_I2S_PD1_3 (0x2 << 12) 88262306a36Sopenharmony_ci#define RT5640_I2S_PD1_4 (0x3 << 12) 88362306a36Sopenharmony_ci#define RT5640_I2S_PD1_6 (0x4 << 12) 88462306a36Sopenharmony_ci#define RT5640_I2S_PD1_8 (0x5 << 12) 88562306a36Sopenharmony_ci#define RT5640_I2S_PD1_12 (0x6 << 12) 88662306a36Sopenharmony_ci#define RT5640_I2S_PD1_16 (0x7 << 12) 88762306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS2_MASK (0x1 << 11) 88862306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS2_SFT 11 88962306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS2_32 (0x0 << 11) 89062306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS2_64 (0x1 << 11) 89162306a36Sopenharmony_ci#define RT5640_I2S_PD2_MASK (0x7 << 8) 89262306a36Sopenharmony_ci#define RT5640_I2S_PD2_SFT 8 89362306a36Sopenharmony_ci#define RT5640_I2S_PD2_1 (0x0 << 8) 89462306a36Sopenharmony_ci#define RT5640_I2S_PD2_2 (0x1 << 8) 89562306a36Sopenharmony_ci#define RT5640_I2S_PD2_3 (0x2 << 8) 89662306a36Sopenharmony_ci#define RT5640_I2S_PD2_4 (0x3 << 8) 89762306a36Sopenharmony_ci#define RT5640_I2S_PD2_6 (0x4 << 8) 89862306a36Sopenharmony_ci#define RT5640_I2S_PD2_8 (0x5 << 8) 89962306a36Sopenharmony_ci#define RT5640_I2S_PD2_12 (0x6 << 8) 90062306a36Sopenharmony_ci#define RT5640_I2S_PD2_16 (0x7 << 8) 90162306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS3_MASK (0x1 << 7) 90262306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS3_SFT 7 90362306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS3_32 (0x0 << 7) 90462306a36Sopenharmony_ci#define RT5640_I2S_BCLK_MS3_64 (0x1 << 7) 90562306a36Sopenharmony_ci#define RT5640_I2S_PD3_MASK (0x7 << 4) 90662306a36Sopenharmony_ci#define RT5640_I2S_PD3_SFT 4 90762306a36Sopenharmony_ci#define RT5640_I2S_PD3_1 (0x0 << 4) 90862306a36Sopenharmony_ci#define RT5640_I2S_PD3_2 (0x1 << 4) 90962306a36Sopenharmony_ci#define RT5640_I2S_PD3_3 (0x2 << 4) 91062306a36Sopenharmony_ci#define RT5640_I2S_PD3_4 (0x3 << 4) 91162306a36Sopenharmony_ci#define RT5640_I2S_PD3_6 (0x4 << 4) 91262306a36Sopenharmony_ci#define RT5640_I2S_PD3_8 (0x5 << 4) 91362306a36Sopenharmony_ci#define RT5640_I2S_PD3_12 (0x6 << 4) 91462306a36Sopenharmony_ci#define RT5640_I2S_PD3_16 (0x7 << 4) 91562306a36Sopenharmony_ci#define RT5640_DAC_OSR_MASK (0x3 << 2) 91662306a36Sopenharmony_ci#define RT5640_DAC_OSR_SFT 2 91762306a36Sopenharmony_ci#define RT5640_DAC_OSR_128 (0x0 << 2) 91862306a36Sopenharmony_ci#define RT5640_DAC_OSR_64 (0x1 << 2) 91962306a36Sopenharmony_ci#define RT5640_DAC_OSR_32 (0x2 << 2) 92062306a36Sopenharmony_ci#define RT5640_DAC_OSR_16 (0x3 << 2) 92162306a36Sopenharmony_ci#define RT5640_ADC_OSR_MASK (0x3) 92262306a36Sopenharmony_ci#define RT5640_ADC_OSR_SFT 0 92362306a36Sopenharmony_ci#define RT5640_ADC_OSR_128 (0x0) 92462306a36Sopenharmony_ci#define RT5640_ADC_OSR_64 (0x1) 92562306a36Sopenharmony_ci#define RT5640_ADC_OSR_32 (0x2) 92662306a36Sopenharmony_ci#define RT5640_ADC_OSR_16 (0x3) 92762306a36Sopenharmony_ci 92862306a36Sopenharmony_ci/* ADC/DAC Clock Control 2 (0x74) */ 92962306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_MASK (0x3 << 14) 93062306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_SFT 14 93162306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_128 (0x0 << 14) 93262306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_64 (0x1 << 14) 93362306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_32 (0x2 << 14) 93462306a36Sopenharmony_ci#define RT5640_DAC_L_OSR_16 (0x3 << 14) 93562306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_MASK (0x3 << 12) 93662306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_SFT 12 93762306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_128 (0x0 << 12) 93862306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_64 (0x1 << 12) 93962306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_32 (0x2 << 12) 94062306a36Sopenharmony_ci#define RT5640_ADC_R_OSR_16 (0x3 << 12) 94162306a36Sopenharmony_ci#define RT5640_DAHPF_EN (0x1 << 11) 94262306a36Sopenharmony_ci#define RT5640_DAHPF_EN_SFT 11 94362306a36Sopenharmony_ci#define RT5640_ADHPF_EN (0x1 << 10) 94462306a36Sopenharmony_ci#define RT5640_ADHPF_EN_SFT 10 94562306a36Sopenharmony_ci 94662306a36Sopenharmony_ci/* Digital Microphone Control (0x75) */ 94762306a36Sopenharmony_ci#define RT5640_DMIC_1_EN_MASK (0x1 << 15) 94862306a36Sopenharmony_ci#define RT5640_DMIC_1_EN_SFT 15 94962306a36Sopenharmony_ci#define RT5640_DMIC_1_DIS (0x0 << 15) 95062306a36Sopenharmony_ci#define RT5640_DMIC_1_EN (0x1 << 15) 95162306a36Sopenharmony_ci#define RT5640_DMIC_2_EN_MASK (0x1 << 14) 95262306a36Sopenharmony_ci#define RT5640_DMIC_2_EN_SFT 14 95362306a36Sopenharmony_ci#define RT5640_DMIC_2_DIS (0x0 << 14) 95462306a36Sopenharmony_ci#define RT5640_DMIC_2_EN (0x1 << 14) 95562306a36Sopenharmony_ci#define RT5640_DMIC_1L_LH_MASK (0x1 << 13) 95662306a36Sopenharmony_ci#define RT5640_DMIC_1L_LH_SFT 13 95762306a36Sopenharmony_ci#define RT5640_DMIC_1L_LH_FALLING (0x0 << 13) 95862306a36Sopenharmony_ci#define RT5640_DMIC_1L_LH_RISING (0x1 << 13) 95962306a36Sopenharmony_ci#define RT5640_DMIC_1R_LH_MASK (0x1 << 12) 96062306a36Sopenharmony_ci#define RT5640_DMIC_1R_LH_SFT 12 96162306a36Sopenharmony_ci#define RT5640_DMIC_1R_LH_FALLING (0x0 << 12) 96262306a36Sopenharmony_ci#define RT5640_DMIC_1R_LH_RISING (0x1 << 12) 96362306a36Sopenharmony_ci#define RT5640_DMIC_1_DP_MASK (0x1 << 11) 96462306a36Sopenharmony_ci#define RT5640_DMIC_1_DP_SFT 11 96562306a36Sopenharmony_ci#define RT5640_DMIC_1_DP_GPIO3 (0x0 << 11) 96662306a36Sopenharmony_ci#define RT5640_DMIC_1_DP_IN1P (0x1 << 11) 96762306a36Sopenharmony_ci#define RT5640_DMIC_2_DP_MASK (0x1 << 10) 96862306a36Sopenharmony_ci#define RT5640_DMIC_2_DP_SFT 10 96962306a36Sopenharmony_ci#define RT5640_DMIC_2_DP_GPIO4 (0x0 << 10) 97062306a36Sopenharmony_ci#define RT5640_DMIC_2_DP_IN1N (0x1 << 10) 97162306a36Sopenharmony_ci#define RT5640_DMIC_2L_LH_MASK (0x1 << 9) 97262306a36Sopenharmony_ci#define RT5640_DMIC_2L_LH_SFT 9 97362306a36Sopenharmony_ci#define RT5640_DMIC_2L_LH_FALLING (0x0 << 9) 97462306a36Sopenharmony_ci#define RT5640_DMIC_2L_LH_RISING (0x1 << 9) 97562306a36Sopenharmony_ci#define RT5640_DMIC_2R_LH_MASK (0x1 << 8) 97662306a36Sopenharmony_ci#define RT5640_DMIC_2R_LH_SFT 8 97762306a36Sopenharmony_ci#define RT5640_DMIC_2R_LH_FALLING (0x0 << 8) 97862306a36Sopenharmony_ci#define RT5640_DMIC_2R_LH_RISING (0x1 << 8) 97962306a36Sopenharmony_ci#define RT5640_DMIC_CLK_MASK (0x7 << 5) 98062306a36Sopenharmony_ci#define RT5640_DMIC_CLK_SFT 5 98162306a36Sopenharmony_ci 98262306a36Sopenharmony_ci/* Global Clock Control (0x80) */ 98362306a36Sopenharmony_ci#define RT5640_SCLK_SRC_MASK (0x3 << 14) 98462306a36Sopenharmony_ci#define RT5640_SCLK_SRC_SFT 14 98562306a36Sopenharmony_ci#define RT5640_SCLK_SRC_MCLK (0x0 << 14) 98662306a36Sopenharmony_ci#define RT5640_SCLK_SRC_PLL1 (0x1 << 14) 98762306a36Sopenharmony_ci#define RT5640_SCLK_SRC_RCCLK (0x2 << 14) 98862306a36Sopenharmony_ci#define RT5640_PLL1_SRC_MASK (0x3 << 12) 98962306a36Sopenharmony_ci#define RT5640_PLL1_SRC_SFT 12 99062306a36Sopenharmony_ci#define RT5640_PLL1_SRC_MCLK (0x0 << 12) 99162306a36Sopenharmony_ci#define RT5640_PLL1_SRC_BCLK1 (0x1 << 12) 99262306a36Sopenharmony_ci#define RT5640_PLL1_SRC_BCLK2 (0x2 << 12) 99362306a36Sopenharmony_ci#define RT5640_PLL1_SRC_BCLK3 (0x3 << 12) 99462306a36Sopenharmony_ci#define RT5640_PLL1_PD_MASK (0x1 << 3) 99562306a36Sopenharmony_ci#define RT5640_PLL1_PD_SFT 3 99662306a36Sopenharmony_ci#define RT5640_PLL1_PD_1 (0x0 << 3) 99762306a36Sopenharmony_ci#define RT5640_PLL1_PD_2 (0x1 << 3) 99862306a36Sopenharmony_ci 99962306a36Sopenharmony_ci#define RT5640_PLL_INP_MAX 40000000 100062306a36Sopenharmony_ci#define RT5640_PLL_INP_MIN 256000 100162306a36Sopenharmony_ci/* PLL M/N/K Code Control 1 (0x81) */ 100262306a36Sopenharmony_ci#define RT5640_PLL_N_MAX 0x1ff 100362306a36Sopenharmony_ci#define RT5640_PLL_N_MASK (RT5640_PLL_N_MAX << 7) 100462306a36Sopenharmony_ci#define RT5640_PLL_N_SFT 7 100562306a36Sopenharmony_ci#define RT5640_PLL_K_MAX 0x1f 100662306a36Sopenharmony_ci#define RT5640_PLL_K_MASK (RT5640_PLL_K_MAX) 100762306a36Sopenharmony_ci#define RT5640_PLL_K_SFT 0 100862306a36Sopenharmony_ci 100962306a36Sopenharmony_ci/* PLL M/N/K Code Control 2 (0x82) */ 101062306a36Sopenharmony_ci#define RT5640_PLL_M_MAX 0xf 101162306a36Sopenharmony_ci#define RT5640_PLL_M_MASK (RT5640_PLL_M_MAX << 12) 101262306a36Sopenharmony_ci#define RT5640_PLL_M_SFT 12 101362306a36Sopenharmony_ci#define RT5640_PLL_M_BP (0x1 << 11) 101462306a36Sopenharmony_ci#define RT5640_PLL_M_BP_SFT 11 101562306a36Sopenharmony_ci 101662306a36Sopenharmony_ci/* ASRC Control 1 (0x83) */ 101762306a36Sopenharmony_ci#define RT5640_STO_T_MASK (0x1 << 15) 101862306a36Sopenharmony_ci#define RT5640_STO_T_SFT 15 101962306a36Sopenharmony_ci#define RT5640_STO_T_SCLK (0x0 << 15) 102062306a36Sopenharmony_ci#define RT5640_STO_T_LRCK1 (0x1 << 15) 102162306a36Sopenharmony_ci#define RT5640_M1_T_MASK (0x1 << 14) 102262306a36Sopenharmony_ci#define RT5640_M1_T_SFT 14 102362306a36Sopenharmony_ci#define RT5640_M1_T_I2S2 (0x0 << 14) 102462306a36Sopenharmony_ci#define RT5640_M1_T_I2S2_D3 (0x1 << 14) 102562306a36Sopenharmony_ci#define RT5640_I2S2_F_MASK (0x1 << 12) 102662306a36Sopenharmony_ci#define RT5640_I2S2_F_SFT 12 102762306a36Sopenharmony_ci#define RT5640_I2S2_F_I2S2_D2 (0x0 << 12) 102862306a36Sopenharmony_ci#define RT5640_I2S2_F_I2S1_TCLK (0x1 << 12) 102962306a36Sopenharmony_ci#define RT5640_DMIC_1_M_MASK (0x1 << 9) 103062306a36Sopenharmony_ci#define RT5640_DMIC_1_M_SFT 9 103162306a36Sopenharmony_ci#define RT5640_DMIC_1_M_NOR (0x0 << 9) 103262306a36Sopenharmony_ci#define RT5640_DMIC_1_M_ASYN (0x1 << 9) 103362306a36Sopenharmony_ci#define RT5640_DMIC_2_M_MASK (0x1 << 8) 103462306a36Sopenharmony_ci#define RT5640_DMIC_2_M_SFT 8 103562306a36Sopenharmony_ci#define RT5640_DMIC_2_M_NOR (0x0 << 8) 103662306a36Sopenharmony_ci#define RT5640_DMIC_2_M_ASYN (0x1 << 8) 103762306a36Sopenharmony_ci 103862306a36Sopenharmony_ci/* ASRC clock source selection (0x84) */ 103962306a36Sopenharmony_ci#define RT5640_CLK_SEL_SYS (0x0) 104062306a36Sopenharmony_ci#define RT5640_CLK_SEL_ASRC (0x1) 104162306a36Sopenharmony_ci 104262306a36Sopenharmony_ci/* ASRC Control 2 (0x84) */ 104362306a36Sopenharmony_ci#define RT5640_MDA_L_M_MASK (0x1 << 15) 104462306a36Sopenharmony_ci#define RT5640_MDA_L_M_SFT 15 104562306a36Sopenharmony_ci#define RT5640_MDA_L_M_NOR (0x0 << 15) 104662306a36Sopenharmony_ci#define RT5640_MDA_L_M_ASYN (0x1 << 15) 104762306a36Sopenharmony_ci#define RT5640_MDA_R_M_MASK (0x1 << 14) 104862306a36Sopenharmony_ci#define RT5640_MDA_R_M_SFT 14 104962306a36Sopenharmony_ci#define RT5640_MDA_R_M_NOR (0x0 << 14) 105062306a36Sopenharmony_ci#define RT5640_MDA_R_M_ASYN (0x1 << 14) 105162306a36Sopenharmony_ci#define RT5640_MAD_L_M_MASK (0x1 << 13) 105262306a36Sopenharmony_ci#define RT5640_MAD_L_M_SFT 13 105362306a36Sopenharmony_ci#define RT5640_MAD_L_M_NOR (0x0 << 13) 105462306a36Sopenharmony_ci#define RT5640_MAD_L_M_ASYN (0x1 << 13) 105562306a36Sopenharmony_ci#define RT5640_MAD_R_M_MASK (0x1 << 12) 105662306a36Sopenharmony_ci#define RT5640_MAD_R_M_SFT 12 105762306a36Sopenharmony_ci#define RT5640_MAD_R_M_NOR (0x0 << 12) 105862306a36Sopenharmony_ci#define RT5640_MAD_R_M_ASYN (0x1 << 12) 105962306a36Sopenharmony_ci#define RT5640_ADC_M_MASK (0x1 << 11) 106062306a36Sopenharmony_ci#define RT5640_ADC_M_SFT 11 106162306a36Sopenharmony_ci#define RT5640_ADC_M_NOR (0x0 << 11) 106262306a36Sopenharmony_ci#define RT5640_ADC_M_ASYN (0x1 << 11) 106362306a36Sopenharmony_ci#define RT5640_STO_DAC_M_MASK (0x1 << 5) 106462306a36Sopenharmony_ci#define RT5640_STO_DAC_M_SFT 5 106562306a36Sopenharmony_ci#define RT5640_STO_DAC_M_NOR (0x0 << 5) 106662306a36Sopenharmony_ci#define RT5640_STO_DAC_M_ASYN (0x1 << 5) 106762306a36Sopenharmony_ci#define RT5640_I2S1_R_D_MASK (0x1 << 4) 106862306a36Sopenharmony_ci#define RT5640_I2S1_R_D_SFT 4 106962306a36Sopenharmony_ci#define RT5640_I2S1_R_D_DIS (0x0 << 4) 107062306a36Sopenharmony_ci#define RT5640_I2S1_R_D_EN (0x1 << 4) 107162306a36Sopenharmony_ci#define RT5640_I2S2_R_D_MASK (0x1 << 3) 107262306a36Sopenharmony_ci#define RT5640_I2S2_R_D_SFT 3 107362306a36Sopenharmony_ci#define RT5640_I2S2_R_D_DIS (0x0 << 3) 107462306a36Sopenharmony_ci#define RT5640_I2S2_R_D_EN (0x1 << 3) 107562306a36Sopenharmony_ci#define RT5640_PRE_SCLK_MASK (0x3) 107662306a36Sopenharmony_ci#define RT5640_PRE_SCLK_SFT 0 107762306a36Sopenharmony_ci#define RT5640_PRE_SCLK_512 (0x0) 107862306a36Sopenharmony_ci#define RT5640_PRE_SCLK_1024 (0x1) 107962306a36Sopenharmony_ci#define RT5640_PRE_SCLK_2048 (0x2) 108062306a36Sopenharmony_ci 108162306a36Sopenharmony_ci/* ASRC Control 3 (0x85) */ 108262306a36Sopenharmony_ci#define RT5640_I2S1_RATE_MASK (0xf << 12) 108362306a36Sopenharmony_ci#define RT5640_I2S1_RATE_SFT 12 108462306a36Sopenharmony_ci#define RT5640_I2S2_RATE_MASK (0xf << 8) 108562306a36Sopenharmony_ci#define RT5640_I2S2_RATE_SFT 8 108662306a36Sopenharmony_ci 108762306a36Sopenharmony_ci/* ASRC Control 4 (0x89) */ 108862306a36Sopenharmony_ci#define RT5640_I2S1_PD_MASK (0x7 << 12) 108962306a36Sopenharmony_ci#define RT5640_I2S1_PD_SFT 12 109062306a36Sopenharmony_ci#define RT5640_I2S2_PD_MASK (0x7 << 8) 109162306a36Sopenharmony_ci#define RT5640_I2S2_PD_SFT 8 109262306a36Sopenharmony_ci 109362306a36Sopenharmony_ci/* HPOUT Over Current Detection (0x8b) */ 109462306a36Sopenharmony_ci#define RT5640_HP_OVCD_MASK (0x1 << 10) 109562306a36Sopenharmony_ci#define RT5640_HP_OVCD_SFT 10 109662306a36Sopenharmony_ci#define RT5640_HP_OVCD_DIS (0x0 << 10) 109762306a36Sopenharmony_ci#define RT5640_HP_OVCD_EN (0x1 << 10) 109862306a36Sopenharmony_ci#define RT5640_HP_OC_TH_MASK (0x3 << 8) 109962306a36Sopenharmony_ci#define RT5640_HP_OC_TH_SFT 8 110062306a36Sopenharmony_ci#define RT5640_HP_OC_TH_90 (0x0 << 8) 110162306a36Sopenharmony_ci#define RT5640_HP_OC_TH_105 (0x1 << 8) 110262306a36Sopenharmony_ci#define RT5640_HP_OC_TH_120 (0x2 << 8) 110362306a36Sopenharmony_ci#define RT5640_HP_OC_TH_135 (0x3 << 8) 110462306a36Sopenharmony_ci 110562306a36Sopenharmony_ci/* Class D Over Current Control (0x8c) */ 110662306a36Sopenharmony_ci#define RT5640_CLSD_OC_MASK (0x1 << 9) 110762306a36Sopenharmony_ci#define RT5640_CLSD_OC_SFT 9 110862306a36Sopenharmony_ci#define RT5640_CLSD_OC_PU (0x0 << 9) 110962306a36Sopenharmony_ci#define RT5640_CLSD_OC_PD (0x1 << 9) 111062306a36Sopenharmony_ci#define RT5640_AUTO_PD_MASK (0x1 << 8) 111162306a36Sopenharmony_ci#define RT5640_AUTO_PD_SFT 8 111262306a36Sopenharmony_ci#define RT5640_AUTO_PD_DIS (0x0 << 8) 111362306a36Sopenharmony_ci#define RT5640_AUTO_PD_EN (0x1 << 8) 111462306a36Sopenharmony_ci#define RT5640_CLSD_OC_TH_MASK (0x3f) 111562306a36Sopenharmony_ci#define RT5640_CLSD_OC_TH_SFT 0 111662306a36Sopenharmony_ci 111762306a36Sopenharmony_ci/* Class D Output Control (0x8d) */ 111862306a36Sopenharmony_ci#define RT5640_CLSD_RATIO_MASK (0xf << 12) 111962306a36Sopenharmony_ci#define RT5640_CLSD_RATIO_SFT 12 112062306a36Sopenharmony_ci#define RT5640_CLSD_OM_MASK (0x1 << 11) 112162306a36Sopenharmony_ci#define RT5640_CLSD_OM_SFT 11 112262306a36Sopenharmony_ci#define RT5640_CLSD_OM_MONO (0x0 << 11) 112362306a36Sopenharmony_ci#define RT5640_CLSD_OM_STO (0x1 << 11) 112462306a36Sopenharmony_ci#define RT5640_CLSD_SCH_MASK (0x1 << 10) 112562306a36Sopenharmony_ci#define RT5640_CLSD_SCH_SFT 10 112662306a36Sopenharmony_ci#define RT5640_CLSD_SCH_L (0x0 << 10) 112762306a36Sopenharmony_ci#define RT5640_CLSD_SCH_S (0x1 << 10) 112862306a36Sopenharmony_ci 112962306a36Sopenharmony_ci/* Depop Mode Control 1 (0x8e) */ 113062306a36Sopenharmony_ci#define RT5640_SMT_TRIG_MASK (0x1 << 15) 113162306a36Sopenharmony_ci#define RT5640_SMT_TRIG_SFT 15 113262306a36Sopenharmony_ci#define RT5640_SMT_TRIG_DIS (0x0 << 15) 113362306a36Sopenharmony_ci#define RT5640_SMT_TRIG_EN (0x1 << 15) 113462306a36Sopenharmony_ci#define RT5640_HP_L_SMT_MASK (0x1 << 9) 113562306a36Sopenharmony_ci#define RT5640_HP_L_SMT_SFT 9 113662306a36Sopenharmony_ci#define RT5640_HP_L_SMT_DIS (0x0 << 9) 113762306a36Sopenharmony_ci#define RT5640_HP_L_SMT_EN (0x1 << 9) 113862306a36Sopenharmony_ci#define RT5640_HP_R_SMT_MASK (0x1 << 8) 113962306a36Sopenharmony_ci#define RT5640_HP_R_SMT_SFT 8 114062306a36Sopenharmony_ci#define RT5640_HP_R_SMT_DIS (0x0 << 8) 114162306a36Sopenharmony_ci#define RT5640_HP_R_SMT_EN (0x1 << 8) 114262306a36Sopenharmony_ci#define RT5640_HP_CD_PD_MASK (0x1 << 7) 114362306a36Sopenharmony_ci#define RT5640_HP_CD_PD_SFT 7 114462306a36Sopenharmony_ci#define RT5640_HP_CD_PD_DIS (0x0 << 7) 114562306a36Sopenharmony_ci#define RT5640_HP_CD_PD_EN (0x1 << 7) 114662306a36Sopenharmony_ci#define RT5640_RSTN_MASK (0x1 << 6) 114762306a36Sopenharmony_ci#define RT5640_RSTN_SFT 6 114862306a36Sopenharmony_ci#define RT5640_RSTN_DIS (0x0 << 6) 114962306a36Sopenharmony_ci#define RT5640_RSTN_EN (0x1 << 6) 115062306a36Sopenharmony_ci#define RT5640_RSTP_MASK (0x1 << 5) 115162306a36Sopenharmony_ci#define RT5640_RSTP_SFT 5 115262306a36Sopenharmony_ci#define RT5640_RSTP_DIS (0x0 << 5) 115362306a36Sopenharmony_ci#define RT5640_RSTP_EN (0x1 << 5) 115462306a36Sopenharmony_ci#define RT5640_HP_CO_MASK (0x1 << 4) 115562306a36Sopenharmony_ci#define RT5640_HP_CO_SFT 4 115662306a36Sopenharmony_ci#define RT5640_HP_CO_DIS (0x0 << 4) 115762306a36Sopenharmony_ci#define RT5640_HP_CO_EN (0x1 << 4) 115862306a36Sopenharmony_ci#define RT5640_HP_CP_MASK (0x1 << 3) 115962306a36Sopenharmony_ci#define RT5640_HP_CP_SFT 3 116062306a36Sopenharmony_ci#define RT5640_HP_CP_PD (0x0 << 3) 116162306a36Sopenharmony_ci#define RT5640_HP_CP_PU (0x1 << 3) 116262306a36Sopenharmony_ci#define RT5640_HP_SG_MASK (0x1 << 2) 116362306a36Sopenharmony_ci#define RT5640_HP_SG_SFT 2 116462306a36Sopenharmony_ci#define RT5640_HP_SG_DIS (0x0 << 2) 116562306a36Sopenharmony_ci#define RT5640_HP_SG_EN (0x1 << 2) 116662306a36Sopenharmony_ci#define RT5640_HP_DP_MASK (0x1 << 1) 116762306a36Sopenharmony_ci#define RT5640_HP_DP_SFT 1 116862306a36Sopenharmony_ci#define RT5640_HP_DP_PD (0x0 << 1) 116962306a36Sopenharmony_ci#define RT5640_HP_DP_PU (0x1 << 1) 117062306a36Sopenharmony_ci#define RT5640_HP_CB_MASK (0x1) 117162306a36Sopenharmony_ci#define RT5640_HP_CB_SFT 0 117262306a36Sopenharmony_ci#define RT5640_HP_CB_PD (0x0) 117362306a36Sopenharmony_ci#define RT5640_HP_CB_PU (0x1) 117462306a36Sopenharmony_ci 117562306a36Sopenharmony_ci/* Depop Mode Control 2 (0x8f) */ 117662306a36Sopenharmony_ci#define RT5640_DEPOP_MASK (0x1 << 13) 117762306a36Sopenharmony_ci#define RT5640_DEPOP_SFT 13 117862306a36Sopenharmony_ci#define RT5640_DEPOP_AUTO (0x0 << 13) 117962306a36Sopenharmony_ci#define RT5640_DEPOP_MAN (0x1 << 13) 118062306a36Sopenharmony_ci#define RT5640_RAMP_MASK (0x1 << 12) 118162306a36Sopenharmony_ci#define RT5640_RAMP_SFT 12 118262306a36Sopenharmony_ci#define RT5640_RAMP_DIS (0x0 << 12) 118362306a36Sopenharmony_ci#define RT5640_RAMP_EN (0x1 << 12) 118462306a36Sopenharmony_ci#define RT5640_BPS_MASK (0x1 << 11) 118562306a36Sopenharmony_ci#define RT5640_BPS_SFT 11 118662306a36Sopenharmony_ci#define RT5640_BPS_DIS (0x0 << 11) 118762306a36Sopenharmony_ci#define RT5640_BPS_EN (0x1 << 11) 118862306a36Sopenharmony_ci#define RT5640_FAST_UPDN_MASK (0x1 << 10) 118962306a36Sopenharmony_ci#define RT5640_FAST_UPDN_SFT 10 119062306a36Sopenharmony_ci#define RT5640_FAST_UPDN_DIS (0x0 << 10) 119162306a36Sopenharmony_ci#define RT5640_FAST_UPDN_EN (0x1 << 10) 119262306a36Sopenharmony_ci#define RT5640_MRES_MASK (0x3 << 8) 119362306a36Sopenharmony_ci#define RT5640_MRES_SFT 8 119462306a36Sopenharmony_ci#define RT5640_MRES_15MO (0x0 << 8) 119562306a36Sopenharmony_ci#define RT5640_MRES_25MO (0x1 << 8) 119662306a36Sopenharmony_ci#define RT5640_MRES_35MO (0x2 << 8) 119762306a36Sopenharmony_ci#define RT5640_MRES_45MO (0x3 << 8) 119862306a36Sopenharmony_ci#define RT5640_VLO_MASK (0x1 << 7) 119962306a36Sopenharmony_ci#define RT5640_VLO_SFT 7 120062306a36Sopenharmony_ci#define RT5640_VLO_3V (0x0 << 7) 120162306a36Sopenharmony_ci#define RT5640_VLO_32V (0x1 << 7) 120262306a36Sopenharmony_ci#define RT5640_DIG_DP_MASK (0x1 << 6) 120362306a36Sopenharmony_ci#define RT5640_DIG_DP_SFT 6 120462306a36Sopenharmony_ci#define RT5640_DIG_DP_DIS (0x0 << 6) 120562306a36Sopenharmony_ci#define RT5640_DIG_DP_EN (0x1 << 6) 120662306a36Sopenharmony_ci#define RT5640_DP_TH_MASK (0x3 << 4) 120762306a36Sopenharmony_ci#define RT5640_DP_TH_SFT 4 120862306a36Sopenharmony_ci 120962306a36Sopenharmony_ci/* Depop Mode Control 3 (0x90) */ 121062306a36Sopenharmony_ci#define RT5640_CP_SYS_MASK (0x7 << 12) 121162306a36Sopenharmony_ci#define RT5640_CP_SYS_SFT 12 121262306a36Sopenharmony_ci#define RT5640_CP_FQ1_MASK (0x7 << 8) 121362306a36Sopenharmony_ci#define RT5640_CP_FQ1_SFT 8 121462306a36Sopenharmony_ci#define RT5640_CP_FQ2_MASK (0x7 << 4) 121562306a36Sopenharmony_ci#define RT5640_CP_FQ2_SFT 4 121662306a36Sopenharmony_ci#define RT5640_CP_FQ3_MASK (0x7) 121762306a36Sopenharmony_ci#define RT5640_CP_FQ3_SFT 0 121862306a36Sopenharmony_ci#define RT5640_CP_FQ_1_5_KHZ 0 121962306a36Sopenharmony_ci#define RT5640_CP_FQ_3_KHZ 1 122062306a36Sopenharmony_ci#define RT5640_CP_FQ_6_KHZ 2 122162306a36Sopenharmony_ci#define RT5640_CP_FQ_12_KHZ 3 122262306a36Sopenharmony_ci#define RT5640_CP_FQ_24_KHZ 4 122362306a36Sopenharmony_ci#define RT5640_CP_FQ_48_KHZ 5 122462306a36Sopenharmony_ci#define RT5640_CP_FQ_96_KHZ 6 122562306a36Sopenharmony_ci#define RT5640_CP_FQ_192_KHZ 7 122662306a36Sopenharmony_ci 122762306a36Sopenharmony_ci/* HPOUT charge pump (0x91) */ 122862306a36Sopenharmony_ci#define RT5640_OSW_L_MASK (0x1 << 11) 122962306a36Sopenharmony_ci#define RT5640_OSW_L_SFT 11 123062306a36Sopenharmony_ci#define RT5640_OSW_L_DIS (0x0 << 11) 123162306a36Sopenharmony_ci#define RT5640_OSW_L_EN (0x1 << 11) 123262306a36Sopenharmony_ci#define RT5640_OSW_R_MASK (0x1 << 10) 123362306a36Sopenharmony_ci#define RT5640_OSW_R_SFT 10 123462306a36Sopenharmony_ci#define RT5640_OSW_R_DIS (0x0 << 10) 123562306a36Sopenharmony_ci#define RT5640_OSW_R_EN (0x1 << 10) 123662306a36Sopenharmony_ci#define RT5640_PM_HP_MASK (0x3 << 8) 123762306a36Sopenharmony_ci#define RT5640_PM_HP_SFT 8 123862306a36Sopenharmony_ci#define RT5640_PM_HP_LV (0x0 << 8) 123962306a36Sopenharmony_ci#define RT5640_PM_HP_MV (0x1 << 8) 124062306a36Sopenharmony_ci#define RT5640_PM_HP_HV (0x2 << 8) 124162306a36Sopenharmony_ci#define RT5640_IB_HP_MASK (0x3 << 6) 124262306a36Sopenharmony_ci#define RT5640_IB_HP_SFT 6 124362306a36Sopenharmony_ci#define RT5640_IB_HP_125IL (0x0 << 6) 124462306a36Sopenharmony_ci#define RT5640_IB_HP_25IL (0x1 << 6) 124562306a36Sopenharmony_ci#define RT5640_IB_HP_5IL (0x2 << 6) 124662306a36Sopenharmony_ci#define RT5640_IB_HP_1IL (0x3 << 6) 124762306a36Sopenharmony_ci 124862306a36Sopenharmony_ci/* PV detection and SPK gain control (0x92) */ 124962306a36Sopenharmony_ci#define RT5640_PVDD_DET_MASK (0x1 << 15) 125062306a36Sopenharmony_ci#define RT5640_PVDD_DET_SFT 15 125162306a36Sopenharmony_ci#define RT5640_PVDD_DET_DIS (0x0 << 15) 125262306a36Sopenharmony_ci#define RT5640_PVDD_DET_EN (0x1 << 15) 125362306a36Sopenharmony_ci#define RT5640_SPK_AG_MASK (0x1 << 14) 125462306a36Sopenharmony_ci#define RT5640_SPK_AG_SFT 14 125562306a36Sopenharmony_ci#define RT5640_SPK_AG_DIS (0x0 << 14) 125662306a36Sopenharmony_ci#define RT5640_SPK_AG_EN (0x1 << 14) 125762306a36Sopenharmony_ci 125862306a36Sopenharmony_ci/* Micbias Control (0x93) */ 125962306a36Sopenharmony_ci#define RT5640_MIC1_BS_MASK (0x1 << 15) 126062306a36Sopenharmony_ci#define RT5640_MIC1_BS_SFT 15 126162306a36Sopenharmony_ci#define RT5640_MIC1_BS_9AV (0x0 << 15) 126262306a36Sopenharmony_ci#define RT5640_MIC1_BS_75AV (0x1 << 15) 126362306a36Sopenharmony_ci#define RT5640_MIC2_BS_MASK (0x1 << 14) 126462306a36Sopenharmony_ci#define RT5640_MIC2_BS_SFT 14 126562306a36Sopenharmony_ci#define RT5640_MIC2_BS_9AV (0x0 << 14) 126662306a36Sopenharmony_ci#define RT5640_MIC2_BS_75AV (0x1 << 14) 126762306a36Sopenharmony_ci#define RT5640_MIC1_CLK_MASK (0x1 << 13) 126862306a36Sopenharmony_ci#define RT5640_MIC1_CLK_SFT 13 126962306a36Sopenharmony_ci#define RT5640_MIC1_CLK_DIS (0x0 << 13) 127062306a36Sopenharmony_ci#define RT5640_MIC1_CLK_EN (0x1 << 13) 127162306a36Sopenharmony_ci#define RT5640_MIC2_CLK_MASK (0x1 << 12) 127262306a36Sopenharmony_ci#define RT5640_MIC2_CLK_SFT 12 127362306a36Sopenharmony_ci#define RT5640_MIC2_CLK_DIS (0x0 << 12) 127462306a36Sopenharmony_ci#define RT5640_MIC2_CLK_EN (0x1 << 12) 127562306a36Sopenharmony_ci#define RT5640_MIC1_OVCD_MASK (0x1 << 11) 127662306a36Sopenharmony_ci#define RT5640_MIC1_OVCD_SFT 11 127762306a36Sopenharmony_ci#define RT5640_MIC1_OVCD_DIS (0x0 << 11) 127862306a36Sopenharmony_ci#define RT5640_MIC1_OVCD_EN (0x1 << 11) 127962306a36Sopenharmony_ci#define RT5640_MIC1_OVTH_MASK (0x3 << 9) 128062306a36Sopenharmony_ci#define RT5640_MIC1_OVTH_SFT 9 128162306a36Sopenharmony_ci#define RT5640_MIC1_OVTH_600UA (0x0 << 9) 128262306a36Sopenharmony_ci#define RT5640_MIC1_OVTH_1500UA (0x1 << 9) 128362306a36Sopenharmony_ci#define RT5640_MIC1_OVTH_2000UA (0x2 << 9) 128462306a36Sopenharmony_ci#define RT5640_MIC2_OVCD_MASK (0x1 << 8) 128562306a36Sopenharmony_ci#define RT5640_MIC2_OVCD_SFT 8 128662306a36Sopenharmony_ci#define RT5640_MIC2_OVCD_DIS (0x0 << 8) 128762306a36Sopenharmony_ci#define RT5640_MIC2_OVCD_EN (0x1 << 8) 128862306a36Sopenharmony_ci#define RT5640_MIC2_OVTH_MASK (0x3 << 6) 128962306a36Sopenharmony_ci#define RT5640_MIC2_OVTH_SFT 6 129062306a36Sopenharmony_ci#define RT5640_MIC2_OVTH_600UA (0x0 << 6) 129162306a36Sopenharmony_ci#define RT5640_MIC2_OVTH_1500UA (0x1 << 6) 129262306a36Sopenharmony_ci#define RT5640_MIC2_OVTH_2000UA (0x2 << 6) 129362306a36Sopenharmony_ci#define RT5640_PWR_MB_MASK (0x1 << 5) 129462306a36Sopenharmony_ci#define RT5640_PWR_MB_SFT 5 129562306a36Sopenharmony_ci#define RT5640_PWR_MB_PD (0x0 << 5) 129662306a36Sopenharmony_ci#define RT5640_PWR_MB_PU (0x1 << 5) 129762306a36Sopenharmony_ci#define RT5640_PWR_CLK25M_MASK (0x1 << 4) 129862306a36Sopenharmony_ci#define RT5640_PWR_CLK25M_SFT 4 129962306a36Sopenharmony_ci#define RT5640_PWR_CLK25M_PD (0x0 << 4) 130062306a36Sopenharmony_ci#define RT5640_PWR_CLK25M_PU (0x1 << 4) 130162306a36Sopenharmony_ci 130262306a36Sopenharmony_ci/* EQ Control 1 (0xb0) */ 130362306a36Sopenharmony_ci#define RT5640_EQ_SRC_MASK (0x1 << 15) 130462306a36Sopenharmony_ci#define RT5640_EQ_SRC_SFT 15 130562306a36Sopenharmony_ci#define RT5640_EQ_SRC_DAC (0x0 << 15) 130662306a36Sopenharmony_ci#define RT5640_EQ_SRC_ADC (0x1 << 15) 130762306a36Sopenharmony_ci#define RT5640_EQ_UPD (0x1 << 14) 130862306a36Sopenharmony_ci#define RT5640_EQ_UPD_BIT 14 130962306a36Sopenharmony_ci#define RT5640_EQ_CD_MASK (0x1 << 13) 131062306a36Sopenharmony_ci#define RT5640_EQ_CD_SFT 13 131162306a36Sopenharmony_ci#define RT5640_EQ_CD_DIS (0x0 << 13) 131262306a36Sopenharmony_ci#define RT5640_EQ_CD_EN (0x1 << 13) 131362306a36Sopenharmony_ci#define RT5640_EQ_DITH_MASK (0x3 << 8) 131462306a36Sopenharmony_ci#define RT5640_EQ_DITH_SFT 8 131562306a36Sopenharmony_ci#define RT5640_EQ_DITH_NOR (0x0 << 8) 131662306a36Sopenharmony_ci#define RT5640_EQ_DITH_LSB (0x1 << 8) 131762306a36Sopenharmony_ci#define RT5640_EQ_DITH_LSB_1 (0x2 << 8) 131862306a36Sopenharmony_ci#define RT5640_EQ_DITH_LSB_2 (0x3 << 8) 131962306a36Sopenharmony_ci 132062306a36Sopenharmony_ci/* EQ Control 2 (0xb1) */ 132162306a36Sopenharmony_ci#define RT5640_EQ_HPF1_M_MASK (0x1 << 8) 132262306a36Sopenharmony_ci#define RT5640_EQ_HPF1_M_SFT 8 132362306a36Sopenharmony_ci#define RT5640_EQ_HPF1_M_HI (0x0 << 8) 132462306a36Sopenharmony_ci#define RT5640_EQ_HPF1_M_1ST (0x1 << 8) 132562306a36Sopenharmony_ci#define RT5640_EQ_LPF1_M_MASK (0x1 << 7) 132662306a36Sopenharmony_ci#define RT5640_EQ_LPF1_M_SFT 7 132762306a36Sopenharmony_ci#define RT5640_EQ_LPF1_M_LO (0x0 << 7) 132862306a36Sopenharmony_ci#define RT5640_EQ_LPF1_M_1ST (0x1 << 7) 132962306a36Sopenharmony_ci#define RT5640_EQ_HPF2_MASK (0x1 << 6) 133062306a36Sopenharmony_ci#define RT5640_EQ_HPF2_SFT 6 133162306a36Sopenharmony_ci#define RT5640_EQ_HPF2_DIS (0x0 << 6) 133262306a36Sopenharmony_ci#define RT5640_EQ_HPF2_EN (0x1 << 6) 133362306a36Sopenharmony_ci#define RT5640_EQ_HPF1_MASK (0x1 << 5) 133462306a36Sopenharmony_ci#define RT5640_EQ_HPF1_SFT 5 133562306a36Sopenharmony_ci#define RT5640_EQ_HPF1_DIS (0x0 << 5) 133662306a36Sopenharmony_ci#define RT5640_EQ_HPF1_EN (0x1 << 5) 133762306a36Sopenharmony_ci#define RT5640_EQ_BPF4_MASK (0x1 << 4) 133862306a36Sopenharmony_ci#define RT5640_EQ_BPF4_SFT 4 133962306a36Sopenharmony_ci#define RT5640_EQ_BPF4_DIS (0x0 << 4) 134062306a36Sopenharmony_ci#define RT5640_EQ_BPF4_EN (0x1 << 4) 134162306a36Sopenharmony_ci#define RT5640_EQ_BPF3_MASK (0x1 << 3) 134262306a36Sopenharmony_ci#define RT5640_EQ_BPF3_SFT 3 134362306a36Sopenharmony_ci#define RT5640_EQ_BPF3_DIS (0x0 << 3) 134462306a36Sopenharmony_ci#define RT5640_EQ_BPF3_EN (0x1 << 3) 134562306a36Sopenharmony_ci#define RT5640_EQ_BPF2_MASK (0x1 << 2) 134662306a36Sopenharmony_ci#define RT5640_EQ_BPF2_SFT 2 134762306a36Sopenharmony_ci#define RT5640_EQ_BPF2_DIS (0x0 << 2) 134862306a36Sopenharmony_ci#define RT5640_EQ_BPF2_EN (0x1 << 2) 134962306a36Sopenharmony_ci#define RT5640_EQ_BPF1_MASK (0x1 << 1) 135062306a36Sopenharmony_ci#define RT5640_EQ_BPF1_SFT 1 135162306a36Sopenharmony_ci#define RT5640_EQ_BPF1_DIS (0x0 << 1) 135262306a36Sopenharmony_ci#define RT5640_EQ_BPF1_EN (0x1 << 1) 135362306a36Sopenharmony_ci#define RT5640_EQ_LPF_MASK (0x1) 135462306a36Sopenharmony_ci#define RT5640_EQ_LPF_SFT 0 135562306a36Sopenharmony_ci#define RT5640_EQ_LPF_DIS (0x0) 135662306a36Sopenharmony_ci#define RT5640_EQ_LPF_EN (0x1) 135762306a36Sopenharmony_ci 135862306a36Sopenharmony_ci/* Memory Test (0xb2) */ 135962306a36Sopenharmony_ci#define RT5640_MT_MASK (0x1 << 15) 136062306a36Sopenharmony_ci#define RT5640_MT_SFT 15 136162306a36Sopenharmony_ci#define RT5640_MT_DIS (0x0 << 15) 136262306a36Sopenharmony_ci#define RT5640_MT_EN (0x1 << 15) 136362306a36Sopenharmony_ci 136462306a36Sopenharmony_ci/* DRC/AGC Control 1 (0xb4) */ 136562306a36Sopenharmony_ci#define RT5640_DRC_AGC_P_MASK (0x1 << 15) 136662306a36Sopenharmony_ci#define RT5640_DRC_AGC_P_SFT 15 136762306a36Sopenharmony_ci#define RT5640_DRC_AGC_P_DAC (0x0 << 15) 136862306a36Sopenharmony_ci#define RT5640_DRC_AGC_P_ADC (0x1 << 15) 136962306a36Sopenharmony_ci#define RT5640_DRC_AGC_MASK (0x1 << 14) 137062306a36Sopenharmony_ci#define RT5640_DRC_AGC_SFT 14 137162306a36Sopenharmony_ci#define RT5640_DRC_AGC_DIS (0x0 << 14) 137262306a36Sopenharmony_ci#define RT5640_DRC_AGC_EN (0x1 << 14) 137362306a36Sopenharmony_ci#define RT5640_DRC_AGC_UPD (0x1 << 13) 137462306a36Sopenharmony_ci#define RT5640_DRC_AGC_UPD_BIT 13 137562306a36Sopenharmony_ci#define RT5640_DRC_AGC_AR_MASK (0x1f << 8) 137662306a36Sopenharmony_ci#define RT5640_DRC_AGC_AR_SFT 8 137762306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_MASK (0x7 << 5) 137862306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_SFT 5 137962306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_48K (0x1 << 5) 138062306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_96K (0x2 << 5) 138162306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_192K (0x3 << 5) 138262306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_441K (0x5 << 5) 138362306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_882K (0x6 << 5) 138462306a36Sopenharmony_ci#define RT5640_DRC_AGC_R_1764K (0x7 << 5) 138562306a36Sopenharmony_ci#define RT5640_DRC_AGC_RC_MASK (0x1f) 138662306a36Sopenharmony_ci#define RT5640_DRC_AGC_RC_SFT 0 138762306a36Sopenharmony_ci 138862306a36Sopenharmony_ci/* DRC/AGC Control 2 (0xb5) */ 138962306a36Sopenharmony_ci#define RT5640_DRC_AGC_POB_MASK (0x3f << 8) 139062306a36Sopenharmony_ci#define RT5640_DRC_AGC_POB_SFT 8 139162306a36Sopenharmony_ci#define RT5640_DRC_AGC_CP_MASK (0x1 << 7) 139262306a36Sopenharmony_ci#define RT5640_DRC_AGC_CP_SFT 7 139362306a36Sopenharmony_ci#define RT5640_DRC_AGC_CP_DIS (0x0 << 7) 139462306a36Sopenharmony_ci#define RT5640_DRC_AGC_CP_EN (0x1 << 7) 139562306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_MASK (0x3 << 5) 139662306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_SFT 5 139762306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_1_1 (0x0 << 5) 139862306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_1_2 (0x1 << 5) 139962306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_1_3 (0x2 << 5) 140062306a36Sopenharmony_ci#define RT5640_DRC_AGC_CPR_1_4 (0x3 << 5) 140162306a36Sopenharmony_ci#define RT5640_DRC_AGC_PRB_MASK (0x1f) 140262306a36Sopenharmony_ci#define RT5640_DRC_AGC_PRB_SFT 0 140362306a36Sopenharmony_ci 140462306a36Sopenharmony_ci/* DRC/AGC Control 3 (0xb6) */ 140562306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGB_MASK (0xf << 12) 140662306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGB_SFT 12 140762306a36Sopenharmony_ci#define RT5640_DRC_AGC_TAR_MASK (0x1f << 7) 140862306a36Sopenharmony_ci#define RT5640_DRC_AGC_TAR_SFT 7 140962306a36Sopenharmony_ci#define RT5640_DRC_AGC_NG_MASK (0x1 << 6) 141062306a36Sopenharmony_ci#define RT5640_DRC_AGC_NG_SFT 6 141162306a36Sopenharmony_ci#define RT5640_DRC_AGC_NG_DIS (0x0 << 6) 141262306a36Sopenharmony_ci#define RT5640_DRC_AGC_NG_EN (0x1 << 6) 141362306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGH_MASK (0x1 << 5) 141462306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGH_SFT 5 141562306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGH_DIS (0x0 << 5) 141662306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGH_EN (0x1 << 5) 141762306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGT_MASK (0x1f) 141862306a36Sopenharmony_ci#define RT5640_DRC_AGC_NGT_SFT 0 141962306a36Sopenharmony_ci 142062306a36Sopenharmony_ci/* ANC Control 1 (0xb8) */ 142162306a36Sopenharmony_ci#define RT5640_ANC_M_MASK (0x1 << 15) 142262306a36Sopenharmony_ci#define RT5640_ANC_M_SFT 15 142362306a36Sopenharmony_ci#define RT5640_ANC_M_NOR (0x0 << 15) 142462306a36Sopenharmony_ci#define RT5640_ANC_M_REV (0x1 << 15) 142562306a36Sopenharmony_ci#define RT5640_ANC_MASK (0x1 << 14) 142662306a36Sopenharmony_ci#define RT5640_ANC_SFT 14 142762306a36Sopenharmony_ci#define RT5640_ANC_DIS (0x0 << 14) 142862306a36Sopenharmony_ci#define RT5640_ANC_EN (0x1 << 14) 142962306a36Sopenharmony_ci#define RT5640_ANC_MD_MASK (0x3 << 12) 143062306a36Sopenharmony_ci#define RT5640_ANC_MD_SFT 12 143162306a36Sopenharmony_ci#define RT5640_ANC_MD_DIS (0x0 << 12) 143262306a36Sopenharmony_ci#define RT5640_ANC_MD_67MS (0x1 << 12) 143362306a36Sopenharmony_ci#define RT5640_ANC_MD_267MS (0x2 << 12) 143462306a36Sopenharmony_ci#define RT5640_ANC_MD_1067MS (0x3 << 12) 143562306a36Sopenharmony_ci#define RT5640_ANC_SN_MASK (0x1 << 11) 143662306a36Sopenharmony_ci#define RT5640_ANC_SN_SFT 11 143762306a36Sopenharmony_ci#define RT5640_ANC_SN_DIS (0x0 << 11) 143862306a36Sopenharmony_ci#define RT5640_ANC_SN_EN (0x1 << 11) 143962306a36Sopenharmony_ci#define RT5640_ANC_CLK_MASK (0x1 << 10) 144062306a36Sopenharmony_ci#define RT5640_ANC_CLK_SFT 10 144162306a36Sopenharmony_ci#define RT5640_ANC_CLK_ANC (0x0 << 10) 144262306a36Sopenharmony_ci#define RT5640_ANC_CLK_REG (0x1 << 10) 144362306a36Sopenharmony_ci#define RT5640_ANC_ZCD_MASK (0x3 << 8) 144462306a36Sopenharmony_ci#define RT5640_ANC_ZCD_SFT 8 144562306a36Sopenharmony_ci#define RT5640_ANC_ZCD_DIS (0x0 << 8) 144662306a36Sopenharmony_ci#define RT5640_ANC_ZCD_T1 (0x1 << 8) 144762306a36Sopenharmony_ci#define RT5640_ANC_ZCD_T2 (0x2 << 8) 144862306a36Sopenharmony_ci#define RT5640_ANC_ZCD_WT (0x3 << 8) 144962306a36Sopenharmony_ci#define RT5640_ANC_CS_MASK (0x1 << 7) 145062306a36Sopenharmony_ci#define RT5640_ANC_CS_SFT 7 145162306a36Sopenharmony_ci#define RT5640_ANC_CS_DIS (0x0 << 7) 145262306a36Sopenharmony_ci#define RT5640_ANC_CS_EN (0x1 << 7) 145362306a36Sopenharmony_ci#define RT5640_ANC_SW_MASK (0x1 << 6) 145462306a36Sopenharmony_ci#define RT5640_ANC_SW_SFT 6 145562306a36Sopenharmony_ci#define RT5640_ANC_SW_NOR (0x0 << 6) 145662306a36Sopenharmony_ci#define RT5640_ANC_SW_AUTO (0x1 << 6) 145762306a36Sopenharmony_ci#define RT5640_ANC_CO_L_MASK (0x3f) 145862306a36Sopenharmony_ci#define RT5640_ANC_CO_L_SFT 0 145962306a36Sopenharmony_ci 146062306a36Sopenharmony_ci/* ANC Control 2 (0xb6) */ 146162306a36Sopenharmony_ci#define RT5640_ANC_FG_R_MASK (0xf << 12) 146262306a36Sopenharmony_ci#define RT5640_ANC_FG_R_SFT 12 146362306a36Sopenharmony_ci#define RT5640_ANC_FG_L_MASK (0xf << 8) 146462306a36Sopenharmony_ci#define RT5640_ANC_FG_L_SFT 8 146562306a36Sopenharmony_ci#define RT5640_ANC_CG_R_MASK (0xf << 4) 146662306a36Sopenharmony_ci#define RT5640_ANC_CG_R_SFT 4 146762306a36Sopenharmony_ci#define RT5640_ANC_CG_L_MASK (0xf) 146862306a36Sopenharmony_ci#define RT5640_ANC_CG_L_SFT 0 146962306a36Sopenharmony_ci 147062306a36Sopenharmony_ci/* ANC Control 3 (0xb6) */ 147162306a36Sopenharmony_ci#define RT5640_ANC_CD_MASK (0x1 << 6) 147262306a36Sopenharmony_ci#define RT5640_ANC_CD_SFT 6 147362306a36Sopenharmony_ci#define RT5640_ANC_CD_BOTH (0x0 << 6) 147462306a36Sopenharmony_ci#define RT5640_ANC_CD_IND (0x1 << 6) 147562306a36Sopenharmony_ci#define RT5640_ANC_CO_R_MASK (0x3f) 147662306a36Sopenharmony_ci#define RT5640_ANC_CO_R_SFT 0 147762306a36Sopenharmony_ci 147862306a36Sopenharmony_ci/* Jack Detect Control (0xbb) */ 147962306a36Sopenharmony_ci#define RT5640_JD_MASK (0x7 << 13) 148062306a36Sopenharmony_ci#define RT5640_JD_SFT 13 148162306a36Sopenharmony_ci#define RT5640_JD_DIS (0x0 << 13) 148262306a36Sopenharmony_ci#define RT5640_JD_GPIO1 (0x1 << 13) 148362306a36Sopenharmony_ci#define RT5640_JD_JD1_IN4P (0x2 << 13) 148462306a36Sopenharmony_ci#define RT5640_JD_JD2_IN4N (0x3 << 13) 148562306a36Sopenharmony_ci#define RT5640_JD_GPIO2 (0x4 << 13) 148662306a36Sopenharmony_ci#define RT5640_JD_GPIO3 (0x5 << 13) 148762306a36Sopenharmony_ci#define RT5640_JD_GPIO4 (0x6 << 13) 148862306a36Sopenharmony_ci#define RT5640_JD_HP_MASK (0x1 << 11) 148962306a36Sopenharmony_ci#define RT5640_JD_HP_SFT 11 149062306a36Sopenharmony_ci#define RT5640_JD_HP_DIS (0x0 << 11) 149162306a36Sopenharmony_ci#define RT5640_JD_HP_EN (0x1 << 11) 149262306a36Sopenharmony_ci#define RT5640_JD_HP_TRG_MASK (0x1 << 10) 149362306a36Sopenharmony_ci#define RT5640_JD_HP_TRG_SFT 10 149462306a36Sopenharmony_ci#define RT5640_JD_HP_TRG_LO (0x0 << 10) 149562306a36Sopenharmony_ci#define RT5640_JD_HP_TRG_HI (0x1 << 10) 149662306a36Sopenharmony_ci#define RT5640_JD_SPL_MASK (0x1 << 9) 149762306a36Sopenharmony_ci#define RT5640_JD_SPL_SFT 9 149862306a36Sopenharmony_ci#define RT5640_JD_SPL_DIS (0x0 << 9) 149962306a36Sopenharmony_ci#define RT5640_JD_SPL_EN (0x1 << 9) 150062306a36Sopenharmony_ci#define RT5640_JD_SPL_TRG_MASK (0x1 << 8) 150162306a36Sopenharmony_ci#define RT5640_JD_SPL_TRG_SFT 8 150262306a36Sopenharmony_ci#define RT5640_JD_SPL_TRG_LO (0x0 << 8) 150362306a36Sopenharmony_ci#define RT5640_JD_SPL_TRG_HI (0x1 << 8) 150462306a36Sopenharmony_ci#define RT5640_JD_SPR_MASK (0x1 << 7) 150562306a36Sopenharmony_ci#define RT5640_JD_SPR_SFT 7 150662306a36Sopenharmony_ci#define RT5640_JD_SPR_DIS (0x0 << 7) 150762306a36Sopenharmony_ci#define RT5640_JD_SPR_EN (0x1 << 7) 150862306a36Sopenharmony_ci#define RT5640_JD_SPR_TRG_MASK (0x1 << 6) 150962306a36Sopenharmony_ci#define RT5640_JD_SPR_TRG_SFT 6 151062306a36Sopenharmony_ci#define RT5640_JD_SPR_TRG_LO (0x0 << 6) 151162306a36Sopenharmony_ci#define RT5640_JD_SPR_TRG_HI (0x1 << 6) 151262306a36Sopenharmony_ci#define RT5640_JD_MO_MASK (0x1 << 5) 151362306a36Sopenharmony_ci#define RT5640_JD_MO_SFT 5 151462306a36Sopenharmony_ci#define RT5640_JD_MO_DIS (0x0 << 5) 151562306a36Sopenharmony_ci#define RT5640_JD_MO_EN (0x1 << 5) 151662306a36Sopenharmony_ci#define RT5640_JD_MO_TRG_MASK (0x1 << 4) 151762306a36Sopenharmony_ci#define RT5640_JD_MO_TRG_SFT 4 151862306a36Sopenharmony_ci#define RT5640_JD_MO_TRG_LO (0x0 << 4) 151962306a36Sopenharmony_ci#define RT5640_JD_MO_TRG_HI (0x1 << 4) 152062306a36Sopenharmony_ci#define RT5640_JD_LO_MASK (0x1 << 3) 152162306a36Sopenharmony_ci#define RT5640_JD_LO_SFT 3 152262306a36Sopenharmony_ci#define RT5640_JD_LO_DIS (0x0 << 3) 152362306a36Sopenharmony_ci#define RT5640_JD_LO_EN (0x1 << 3) 152462306a36Sopenharmony_ci#define RT5640_JD_LO_TRG_MASK (0x1 << 2) 152562306a36Sopenharmony_ci#define RT5640_JD_LO_TRG_SFT 2 152662306a36Sopenharmony_ci#define RT5640_JD_LO_TRG_LO (0x0 << 2) 152762306a36Sopenharmony_ci#define RT5640_JD_LO_TRG_HI (0x1 << 2) 152862306a36Sopenharmony_ci#define RT5640_JD1_IN4P_MASK (0x1 << 1) 152962306a36Sopenharmony_ci#define RT5640_JD1_IN4P_SFT 1 153062306a36Sopenharmony_ci#define RT5640_JD1_IN4P_DIS (0x0 << 1) 153162306a36Sopenharmony_ci#define RT5640_JD1_IN4P_EN (0x1 << 1) 153262306a36Sopenharmony_ci#define RT5640_JD2_IN4N_MASK (0x1) 153362306a36Sopenharmony_ci#define RT5640_JD2_IN4N_SFT 0 153462306a36Sopenharmony_ci#define RT5640_JD2_IN4N_DIS (0x0) 153562306a36Sopenharmony_ci#define RT5640_JD2_IN4N_EN (0x1) 153662306a36Sopenharmony_ci 153762306a36Sopenharmony_ci/* Jack detect for ANC (0xbc) */ 153862306a36Sopenharmony_ci#define RT5640_ANC_DET_MASK (0x3 << 4) 153962306a36Sopenharmony_ci#define RT5640_ANC_DET_SFT 4 154062306a36Sopenharmony_ci#define RT5640_ANC_DET_DIS (0x0 << 4) 154162306a36Sopenharmony_ci#define RT5640_ANC_DET_MB1 (0x1 << 4) 154262306a36Sopenharmony_ci#define RT5640_ANC_DET_MB2 (0x2 << 4) 154362306a36Sopenharmony_ci#define RT5640_ANC_DET_JD (0x3 << 4) 154462306a36Sopenharmony_ci#define RT5640_AD_TRG_MASK (0x1 << 3) 154562306a36Sopenharmony_ci#define RT5640_AD_TRG_SFT 3 154662306a36Sopenharmony_ci#define RT5640_AD_TRG_LO (0x0 << 3) 154762306a36Sopenharmony_ci#define RT5640_AD_TRG_HI (0x1 << 3) 154862306a36Sopenharmony_ci#define RT5640_ANCM_DET_MASK (0x3 << 4) 154962306a36Sopenharmony_ci#define RT5640_ANCM_DET_SFT 4 155062306a36Sopenharmony_ci#define RT5640_ANCM_DET_DIS (0x0 << 4) 155162306a36Sopenharmony_ci#define RT5640_ANCM_DET_MB1 (0x1 << 4) 155262306a36Sopenharmony_ci#define RT5640_ANCM_DET_MB2 (0x2 << 4) 155362306a36Sopenharmony_ci#define RT5640_ANCM_DET_JD (0x3 << 4) 155462306a36Sopenharmony_ci#define RT5640_AMD_TRG_MASK (0x1 << 3) 155562306a36Sopenharmony_ci#define RT5640_AMD_TRG_SFT 3 155662306a36Sopenharmony_ci#define RT5640_AMD_TRG_LO (0x0 << 3) 155762306a36Sopenharmony_ci#define RT5640_AMD_TRG_HI (0x1 << 3) 155862306a36Sopenharmony_ci 155962306a36Sopenharmony_ci/* IRQ Control 1 (0xbd) */ 156062306a36Sopenharmony_ci#define RT5640_IRQ_JD_MASK (0x1 << 15) 156162306a36Sopenharmony_ci#define RT5640_IRQ_JD_SFT 15 156262306a36Sopenharmony_ci#define RT5640_IRQ_JD_BP (0x0 << 15) 156362306a36Sopenharmony_ci#define RT5640_IRQ_JD_NOR (0x1 << 15) 156462306a36Sopenharmony_ci#define RT5640_IRQ_OT_MASK (0x1 << 14) 156562306a36Sopenharmony_ci#define RT5640_IRQ_OT_SFT 14 156662306a36Sopenharmony_ci#define RT5640_IRQ_OT_BP (0x0 << 14) 156762306a36Sopenharmony_ci#define RT5640_IRQ_OT_NOR (0x1 << 14) 156862306a36Sopenharmony_ci#define RT5640_JD_STKY_MASK (0x1 << 13) 156962306a36Sopenharmony_ci#define RT5640_JD_STKY_SFT 13 157062306a36Sopenharmony_ci#define RT5640_JD_STKY_DIS (0x0 << 13) 157162306a36Sopenharmony_ci#define RT5640_JD_STKY_EN (0x1 << 13) 157262306a36Sopenharmony_ci#define RT5640_OT_STKY_MASK (0x1 << 12) 157362306a36Sopenharmony_ci#define RT5640_OT_STKY_SFT 12 157462306a36Sopenharmony_ci#define RT5640_OT_STKY_DIS (0x0 << 12) 157562306a36Sopenharmony_ci#define RT5640_OT_STKY_EN (0x1 << 12) 157662306a36Sopenharmony_ci#define RT5640_JD_P_MASK (0x1 << 11) 157762306a36Sopenharmony_ci#define RT5640_JD_P_SFT 11 157862306a36Sopenharmony_ci#define RT5640_JD_P_NOR (0x0 << 11) 157962306a36Sopenharmony_ci#define RT5640_JD_P_INV (0x1 << 11) 158062306a36Sopenharmony_ci#define RT5640_OT_P_MASK (0x1 << 10) 158162306a36Sopenharmony_ci#define RT5640_OT_P_SFT 10 158262306a36Sopenharmony_ci#define RT5640_OT_P_NOR (0x0 << 10) 158362306a36Sopenharmony_ci#define RT5640_OT_P_INV (0x1 << 10) 158462306a36Sopenharmony_ci 158562306a36Sopenharmony_ci/* IRQ Control 2 (0xbe) */ 158662306a36Sopenharmony_ci#define RT5640_IRQ_MB1_OC_MASK (0x1 << 15) 158762306a36Sopenharmony_ci#define RT5640_IRQ_MB1_OC_SFT 15 158862306a36Sopenharmony_ci#define RT5640_IRQ_MB1_OC_BP (0x0 << 15) 158962306a36Sopenharmony_ci#define RT5640_IRQ_MB1_OC_NOR (0x1 << 15) 159062306a36Sopenharmony_ci#define RT5640_IRQ_MB2_OC_MASK (0x1 << 14) 159162306a36Sopenharmony_ci#define RT5640_IRQ_MB2_OC_SFT 14 159262306a36Sopenharmony_ci#define RT5640_IRQ_MB2_OC_BP (0x0 << 14) 159362306a36Sopenharmony_ci#define RT5640_IRQ_MB2_OC_NOR (0x1 << 14) 159462306a36Sopenharmony_ci#define RT5640_MB1_OC_STKY_MASK (0x1 << 11) 159562306a36Sopenharmony_ci#define RT5640_MB1_OC_STKY_SFT 11 159662306a36Sopenharmony_ci#define RT5640_MB1_OC_STKY_DIS (0x0 << 11) 159762306a36Sopenharmony_ci#define RT5640_MB1_OC_STKY_EN (0x1 << 11) 159862306a36Sopenharmony_ci#define RT5640_MB2_OC_STKY_MASK (0x1 << 10) 159962306a36Sopenharmony_ci#define RT5640_MB2_OC_STKY_SFT 10 160062306a36Sopenharmony_ci#define RT5640_MB2_OC_STKY_DIS (0x0 << 10) 160162306a36Sopenharmony_ci#define RT5640_MB2_OC_STKY_EN (0x1 << 10) 160262306a36Sopenharmony_ci#define RT5640_MB1_OC_P_MASK (0x1 << 7) 160362306a36Sopenharmony_ci#define RT5640_MB1_OC_P_SFT 7 160462306a36Sopenharmony_ci#define RT5640_MB1_OC_P_NOR (0x0 << 7) 160562306a36Sopenharmony_ci#define RT5640_MB1_OC_P_INV (0x1 << 7) 160662306a36Sopenharmony_ci#define RT5640_MB2_OC_P_MASK (0x1 << 6) 160762306a36Sopenharmony_ci#define RT5640_MB2_OC_P_SFT 6 160862306a36Sopenharmony_ci#define RT5640_MB2_OC_P_NOR (0x0 << 6) 160962306a36Sopenharmony_ci#define RT5640_MB2_OC_P_INV (0x1 << 6) 161062306a36Sopenharmony_ci#define RT5640_MB1_OC_STATUS (0x1 << 3) 161162306a36Sopenharmony_ci#define RT5640_MB1_OC_STATUS_SFT 3 161262306a36Sopenharmony_ci#define RT5640_MB2_OC_STATUS (0x1 << 2) 161362306a36Sopenharmony_ci#define RT5640_MB2_OC_STATUS_SFT 2 161462306a36Sopenharmony_ci 161562306a36Sopenharmony_ci/* GPIO and Internal Status (0xbf) */ 161662306a36Sopenharmony_ci#define RT5640_GPIO1_STATUS (0x1 << 8) 161762306a36Sopenharmony_ci#define RT5640_GPIO2_STATUS (0x1 << 7) 161862306a36Sopenharmony_ci#define RT5640_JD_STATUS (0x1 << 4) 161962306a36Sopenharmony_ci#define RT5640_OVT_STATUS (0x1 << 3) 162062306a36Sopenharmony_ci#define RT5640_CLS_D_OVCD_STATUS (0x1 << 0) 162162306a36Sopenharmony_ci 162262306a36Sopenharmony_ci/* GPIO Control 1 (0xc0) */ 162362306a36Sopenharmony_ci#define RT5640_GP1_PIN_MASK (0x1 << 15) 162462306a36Sopenharmony_ci#define RT5640_GP1_PIN_SFT 15 162562306a36Sopenharmony_ci#define RT5640_GP1_PIN_GPIO1 (0x0 << 15) 162662306a36Sopenharmony_ci#define RT5640_GP1_PIN_IRQ (0x1 << 15) 162762306a36Sopenharmony_ci#define RT5640_GP2_PIN_MASK (0x1 << 14) 162862306a36Sopenharmony_ci#define RT5640_GP2_PIN_SFT 14 162962306a36Sopenharmony_ci#define RT5640_GP2_PIN_GPIO2 (0x0 << 14) 163062306a36Sopenharmony_ci#define RT5640_GP2_PIN_DMIC1_SCL (0x1 << 14) 163162306a36Sopenharmony_ci#define RT5640_GP3_PIN_MASK (0x3 << 12) 163262306a36Sopenharmony_ci#define RT5640_GP3_PIN_SFT 12 163362306a36Sopenharmony_ci#define RT5640_GP3_PIN_GPIO3 (0x0 << 12) 163462306a36Sopenharmony_ci#define RT5640_GP3_PIN_DMIC1_SDA (0x1 << 12) 163562306a36Sopenharmony_ci#define RT5640_GP3_PIN_IRQ (0x2 << 12) 163662306a36Sopenharmony_ci#define RT5640_GP4_PIN_MASK (0x1 << 11) 163762306a36Sopenharmony_ci#define RT5640_GP4_PIN_SFT 11 163862306a36Sopenharmony_ci#define RT5640_GP4_PIN_GPIO4 (0x0 << 11) 163962306a36Sopenharmony_ci#define RT5640_GP4_PIN_DMIC2_SDA (0x1 << 11) 164062306a36Sopenharmony_ci#define RT5640_DP_SIG_MASK (0x1 << 10) 164162306a36Sopenharmony_ci#define RT5640_DP_SIG_SFT 10 164262306a36Sopenharmony_ci#define RT5640_DP_SIG_TEST (0x0 << 10) 164362306a36Sopenharmony_ci#define RT5640_DP_SIG_AP (0x1 << 10) 164462306a36Sopenharmony_ci#define RT5640_GPIO_M_MASK (0x1 << 9) 164562306a36Sopenharmony_ci#define RT5640_GPIO_M_SFT 9 164662306a36Sopenharmony_ci#define RT5640_GPIO_M_FLT (0x0 << 9) 164762306a36Sopenharmony_ci#define RT5640_GPIO_M_PH (0x1 << 9) 164862306a36Sopenharmony_ci 164962306a36Sopenharmony_ci/* GPIO Control 3 (0xc2) */ 165062306a36Sopenharmony_ci#define RT5640_GP4_PF_MASK (0x1 << 11) 165162306a36Sopenharmony_ci#define RT5640_GP4_PF_SFT 11 165262306a36Sopenharmony_ci#define RT5640_GP4_PF_IN (0x0 << 11) 165362306a36Sopenharmony_ci#define RT5640_GP4_PF_OUT (0x1 << 11) 165462306a36Sopenharmony_ci#define RT5640_GP4_OUT_MASK (0x1 << 10) 165562306a36Sopenharmony_ci#define RT5640_GP4_OUT_SFT 10 165662306a36Sopenharmony_ci#define RT5640_GP4_OUT_LO (0x0 << 10) 165762306a36Sopenharmony_ci#define RT5640_GP4_OUT_HI (0x1 << 10) 165862306a36Sopenharmony_ci#define RT5640_GP4_P_MASK (0x1 << 9) 165962306a36Sopenharmony_ci#define RT5640_GP4_P_SFT 9 166062306a36Sopenharmony_ci#define RT5640_GP4_P_NOR (0x0 << 9) 166162306a36Sopenharmony_ci#define RT5640_GP4_P_INV (0x1 << 9) 166262306a36Sopenharmony_ci#define RT5640_GP3_PF_MASK (0x1 << 8) 166362306a36Sopenharmony_ci#define RT5640_GP3_PF_SFT 8 166462306a36Sopenharmony_ci#define RT5640_GP3_PF_IN (0x0 << 8) 166562306a36Sopenharmony_ci#define RT5640_GP3_PF_OUT (0x1 << 8) 166662306a36Sopenharmony_ci#define RT5640_GP3_OUT_MASK (0x1 << 7) 166762306a36Sopenharmony_ci#define RT5640_GP3_OUT_SFT 7 166862306a36Sopenharmony_ci#define RT5640_GP3_OUT_LO (0x0 << 7) 166962306a36Sopenharmony_ci#define RT5640_GP3_OUT_HI (0x1 << 7) 167062306a36Sopenharmony_ci#define RT5640_GP3_P_MASK (0x1 << 6) 167162306a36Sopenharmony_ci#define RT5640_GP3_P_SFT 6 167262306a36Sopenharmony_ci#define RT5640_GP3_P_NOR (0x0 << 6) 167362306a36Sopenharmony_ci#define RT5640_GP3_P_INV (0x1 << 6) 167462306a36Sopenharmony_ci#define RT5640_GP2_PF_MASK (0x1 << 5) 167562306a36Sopenharmony_ci#define RT5640_GP2_PF_SFT 5 167662306a36Sopenharmony_ci#define RT5640_GP2_PF_IN (0x0 << 5) 167762306a36Sopenharmony_ci#define RT5640_GP2_PF_OUT (0x1 << 5) 167862306a36Sopenharmony_ci#define RT5640_GP2_OUT_MASK (0x1 << 4) 167962306a36Sopenharmony_ci#define RT5640_GP2_OUT_SFT 4 168062306a36Sopenharmony_ci#define RT5640_GP2_OUT_LO (0x0 << 4) 168162306a36Sopenharmony_ci#define RT5640_GP2_OUT_HI (0x1 << 4) 168262306a36Sopenharmony_ci#define RT5640_GP2_P_MASK (0x1 << 3) 168362306a36Sopenharmony_ci#define RT5640_GP2_P_SFT 3 168462306a36Sopenharmony_ci#define RT5640_GP2_P_NOR (0x0 << 3) 168562306a36Sopenharmony_ci#define RT5640_GP2_P_INV (0x1 << 3) 168662306a36Sopenharmony_ci#define RT5640_GP1_PF_MASK (0x1 << 2) 168762306a36Sopenharmony_ci#define RT5640_GP1_PF_SFT 2 168862306a36Sopenharmony_ci#define RT5640_GP1_PF_IN (0x0 << 2) 168962306a36Sopenharmony_ci#define RT5640_GP1_PF_OUT (0x1 << 2) 169062306a36Sopenharmony_ci#define RT5640_GP1_OUT_MASK (0x1 << 1) 169162306a36Sopenharmony_ci#define RT5640_GP1_OUT_SFT 1 169262306a36Sopenharmony_ci#define RT5640_GP1_OUT_LO (0x0 << 1) 169362306a36Sopenharmony_ci#define RT5640_GP1_OUT_HI (0x1 << 1) 169462306a36Sopenharmony_ci#define RT5640_GP1_P_MASK (0x1) 169562306a36Sopenharmony_ci#define RT5640_GP1_P_SFT 0 169662306a36Sopenharmony_ci#define RT5640_GP1_P_NOR (0x0) 169762306a36Sopenharmony_ci#define RT5640_GP1_P_INV (0x1) 169862306a36Sopenharmony_ci 169962306a36Sopenharmony_ci/* FM34-500 Register Control 1 (0xc4) */ 170062306a36Sopenharmony_ci#define RT5640_DSP_ADD_SFT 0 170162306a36Sopenharmony_ci 170262306a36Sopenharmony_ci/* FM34-500 Register Control 2 (0xc5) */ 170362306a36Sopenharmony_ci#define RT5640_DSP_DAT_SFT 0 170462306a36Sopenharmony_ci 170562306a36Sopenharmony_ci/* FM34-500 Register Control 3 (0xc6) */ 170662306a36Sopenharmony_ci#define RT5640_DSP_BUSY_MASK (0x1 << 15) 170762306a36Sopenharmony_ci#define RT5640_DSP_BUSY_BIT 15 170862306a36Sopenharmony_ci#define RT5640_DSP_DS_MASK (0x1 << 14) 170962306a36Sopenharmony_ci#define RT5640_DSP_DS_SFT 14 171062306a36Sopenharmony_ci#define RT5640_DSP_DS_FM3010 (0x1 << 14) 171162306a36Sopenharmony_ci#define RT5640_DSP_DS_TEMP (0x1 << 14) 171262306a36Sopenharmony_ci#define RT5640_DSP_CLK_MASK (0x3 << 12) 171362306a36Sopenharmony_ci#define RT5640_DSP_CLK_SFT 12 171462306a36Sopenharmony_ci#define RT5640_DSP_CLK_384K (0x0 << 12) 171562306a36Sopenharmony_ci#define RT5640_DSP_CLK_192K (0x1 << 12) 171662306a36Sopenharmony_ci#define RT5640_DSP_CLK_96K (0x2 << 12) 171762306a36Sopenharmony_ci#define RT5640_DSP_CLK_64K (0x3 << 12) 171862306a36Sopenharmony_ci#define RT5640_DSP_PD_PIN_MASK (0x1 << 11) 171962306a36Sopenharmony_ci#define RT5640_DSP_PD_PIN_SFT 11 172062306a36Sopenharmony_ci#define RT5640_DSP_PD_PIN_LO (0x0 << 11) 172162306a36Sopenharmony_ci#define RT5640_DSP_PD_PIN_HI (0x1 << 11) 172262306a36Sopenharmony_ci#define RT5640_DSP_RST_PIN_MASK (0x1 << 10) 172362306a36Sopenharmony_ci#define RT5640_DSP_RST_PIN_SFT 10 172462306a36Sopenharmony_ci#define RT5640_DSP_RST_PIN_LO (0x0 << 10) 172562306a36Sopenharmony_ci#define RT5640_DSP_RST_PIN_HI (0x1 << 10) 172662306a36Sopenharmony_ci#define RT5640_DSP_R_EN (0x1 << 9) 172762306a36Sopenharmony_ci#define RT5640_DSP_R_EN_BIT 9 172862306a36Sopenharmony_ci#define RT5640_DSP_W_EN (0x1 << 8) 172962306a36Sopenharmony_ci#define RT5640_DSP_W_EN_BIT 8 173062306a36Sopenharmony_ci#define RT5640_DSP_CMD_MASK (0xff) 173162306a36Sopenharmony_ci#define RT5640_DSP_CMD_SFT 0 173262306a36Sopenharmony_ci#define RT5640_DSP_CMD_MW (0x3B) /* Memory Write */ 173362306a36Sopenharmony_ci#define RT5640_DSP_CMD_MR (0x37) /* Memory Read */ 173462306a36Sopenharmony_ci#define RT5640_DSP_CMD_RR (0x60) /* Register Read */ 173562306a36Sopenharmony_ci#define RT5640_DSP_CMD_RW (0x68) /* Register Write */ 173662306a36Sopenharmony_ci 173762306a36Sopenharmony_ci/* Programmable Register Array Control 1 (0xc8) */ 173862306a36Sopenharmony_ci#define RT5640_REG_SEQ_MASK (0xf << 12) 173962306a36Sopenharmony_ci#define RT5640_REG_SEQ_SFT 12 174062306a36Sopenharmony_ci#define RT5640_SEQ1_ST_MASK (0x1 << 11) /*RO*/ 174162306a36Sopenharmony_ci#define RT5640_SEQ1_ST_SFT 11 174262306a36Sopenharmony_ci#define RT5640_SEQ1_ST_RUN (0x0 << 11) 174362306a36Sopenharmony_ci#define RT5640_SEQ1_ST_FIN (0x1 << 11) 174462306a36Sopenharmony_ci#define RT5640_SEQ2_ST_MASK (0x1 << 10) /*RO*/ 174562306a36Sopenharmony_ci#define RT5640_SEQ2_ST_SFT 10 174662306a36Sopenharmony_ci#define RT5640_SEQ2_ST_RUN (0x0 << 10) 174762306a36Sopenharmony_ci#define RT5640_SEQ2_ST_FIN (0x1 << 10) 174862306a36Sopenharmony_ci#define RT5640_REG_LV_MASK (0x1 << 9) 174962306a36Sopenharmony_ci#define RT5640_REG_LV_SFT 9 175062306a36Sopenharmony_ci#define RT5640_REG_LV_MX (0x0 << 9) 175162306a36Sopenharmony_ci#define RT5640_REG_LV_PR (0x1 << 9) 175262306a36Sopenharmony_ci#define RT5640_SEQ_2_PT_MASK (0x1 << 8) 175362306a36Sopenharmony_ci#define RT5640_SEQ_2_PT_BIT 8 175462306a36Sopenharmony_ci#define RT5640_REG_IDX_MASK (0xff) 175562306a36Sopenharmony_ci#define RT5640_REG_IDX_SFT 0 175662306a36Sopenharmony_ci 175762306a36Sopenharmony_ci/* Programmable Register Array Control 2 (0xc9) */ 175862306a36Sopenharmony_ci#define RT5640_REG_DAT_MASK (0xffff) 175962306a36Sopenharmony_ci#define RT5640_REG_DAT_SFT 0 176062306a36Sopenharmony_ci 176162306a36Sopenharmony_ci/* Programmable Register Array Control 3 (0xca) */ 176262306a36Sopenharmony_ci#define RT5640_SEQ_DLY_MASK (0xff << 8) 176362306a36Sopenharmony_ci#define RT5640_SEQ_DLY_SFT 8 176462306a36Sopenharmony_ci#define RT5640_PROG_MASK (0x1 << 7) 176562306a36Sopenharmony_ci#define RT5640_PROG_SFT 7 176662306a36Sopenharmony_ci#define RT5640_PROG_DIS (0x0 << 7) 176762306a36Sopenharmony_ci#define RT5640_PROG_EN (0x1 << 7) 176862306a36Sopenharmony_ci#define RT5640_SEQ1_PT_RUN (0x1 << 6) 176962306a36Sopenharmony_ci#define RT5640_SEQ1_PT_RUN_BIT 6 177062306a36Sopenharmony_ci#define RT5640_SEQ2_PT_RUN (0x1 << 5) 177162306a36Sopenharmony_ci#define RT5640_SEQ2_PT_RUN_BIT 5 177262306a36Sopenharmony_ci 177362306a36Sopenharmony_ci/* Programmable Register Array Control 4 (0xcb) */ 177462306a36Sopenharmony_ci#define RT5640_SEQ1_START_MASK (0xf << 8) 177562306a36Sopenharmony_ci#define RT5640_SEQ1_START_SFT 8 177662306a36Sopenharmony_ci#define RT5640_SEQ1_END_MASK (0xf) 177762306a36Sopenharmony_ci#define RT5640_SEQ1_END_SFT 0 177862306a36Sopenharmony_ci 177962306a36Sopenharmony_ci/* Programmable Register Array Control 5 (0xcc) */ 178062306a36Sopenharmony_ci#define RT5640_SEQ2_START_MASK (0xf << 8) 178162306a36Sopenharmony_ci#define RT5640_SEQ2_START_SFT 8 178262306a36Sopenharmony_ci#define RT5640_SEQ2_END_MASK (0xf) 178362306a36Sopenharmony_ci#define RT5640_SEQ2_END_SFT 0 178462306a36Sopenharmony_ci 178562306a36Sopenharmony_ci/* Scramble Function (0xcd) */ 178662306a36Sopenharmony_ci#define RT5640_SCB_KEY_MASK (0xff) 178762306a36Sopenharmony_ci#define RT5640_SCB_KEY_SFT 0 178862306a36Sopenharmony_ci 178962306a36Sopenharmony_ci/* Scramble Control (0xce) */ 179062306a36Sopenharmony_ci#define RT5640_SCB_SWAP_MASK (0x1 << 15) 179162306a36Sopenharmony_ci#define RT5640_SCB_SWAP_SFT 15 179262306a36Sopenharmony_ci#define RT5640_SCB_SWAP_DIS (0x0 << 15) 179362306a36Sopenharmony_ci#define RT5640_SCB_SWAP_EN (0x1 << 15) 179462306a36Sopenharmony_ci#define RT5640_SCB_MASK (0x1 << 14) 179562306a36Sopenharmony_ci#define RT5640_SCB_SFT 14 179662306a36Sopenharmony_ci#define RT5640_SCB_DIS (0x0 << 14) 179762306a36Sopenharmony_ci#define RT5640_SCB_EN (0x1 << 14) 179862306a36Sopenharmony_ci 179962306a36Sopenharmony_ci/* Baseback Control (0xcf) */ 180062306a36Sopenharmony_ci#define RT5640_BB_MASK (0x1 << 15) 180162306a36Sopenharmony_ci#define RT5640_BB_SFT 15 180262306a36Sopenharmony_ci#define RT5640_BB_DIS (0x0 << 15) 180362306a36Sopenharmony_ci#define RT5640_BB_EN (0x1 << 15) 180462306a36Sopenharmony_ci#define RT5640_BB_CT_MASK (0x7 << 12) 180562306a36Sopenharmony_ci#define RT5640_BB_CT_SFT 12 180662306a36Sopenharmony_ci#define RT5640_BB_CT_A (0x0 << 12) 180762306a36Sopenharmony_ci#define RT5640_BB_CT_B (0x1 << 12) 180862306a36Sopenharmony_ci#define RT5640_BB_CT_C (0x2 << 12) 180962306a36Sopenharmony_ci#define RT5640_BB_CT_D (0x3 << 12) 181062306a36Sopenharmony_ci#define RT5640_M_BB_L_MASK (0x1 << 9) 181162306a36Sopenharmony_ci#define RT5640_M_BB_L_SFT 9 181262306a36Sopenharmony_ci#define RT5640_M_BB_R_MASK (0x1 << 8) 181362306a36Sopenharmony_ci#define RT5640_M_BB_R_SFT 8 181462306a36Sopenharmony_ci#define RT5640_M_BB_HPF_L_MASK (0x1 << 7) 181562306a36Sopenharmony_ci#define RT5640_M_BB_HPF_L_SFT 7 181662306a36Sopenharmony_ci#define RT5640_M_BB_HPF_R_MASK (0x1 << 6) 181762306a36Sopenharmony_ci#define RT5640_M_BB_HPF_R_SFT 6 181862306a36Sopenharmony_ci#define RT5640_G_BB_BST_MASK (0x3f) 181962306a36Sopenharmony_ci#define RT5640_G_BB_BST_SFT 0 182062306a36Sopenharmony_ci 182162306a36Sopenharmony_ci/* MP3 Plus Control 1 (0xd0) */ 182262306a36Sopenharmony_ci#define RT5640_M_MP3_L_MASK (0x1 << 15) 182362306a36Sopenharmony_ci#define RT5640_M_MP3_L_SFT 15 182462306a36Sopenharmony_ci#define RT5640_M_MP3_R_MASK (0x1 << 14) 182562306a36Sopenharmony_ci#define RT5640_M_MP3_R_SFT 14 182662306a36Sopenharmony_ci#define RT5640_M_MP3_MASK (0x1 << 13) 182762306a36Sopenharmony_ci#define RT5640_M_MP3_SFT 13 182862306a36Sopenharmony_ci#define RT5640_M_MP3_DIS (0x0 << 13) 182962306a36Sopenharmony_ci#define RT5640_M_MP3_EN (0x1 << 13) 183062306a36Sopenharmony_ci#define RT5640_EG_MP3_MASK (0x1f << 8) 183162306a36Sopenharmony_ci#define RT5640_EG_MP3_SFT 8 183262306a36Sopenharmony_ci#define RT5640_MP3_HLP_MASK (0x1 << 7) 183362306a36Sopenharmony_ci#define RT5640_MP3_HLP_SFT 7 183462306a36Sopenharmony_ci#define RT5640_MP3_HLP_DIS (0x0 << 7) 183562306a36Sopenharmony_ci#define RT5640_MP3_HLP_EN (0x1 << 7) 183662306a36Sopenharmony_ci#define RT5640_M_MP3_ORG_L_MASK (0x1 << 6) 183762306a36Sopenharmony_ci#define RT5640_M_MP3_ORG_L_SFT 6 183862306a36Sopenharmony_ci#define RT5640_M_MP3_ORG_R_MASK (0x1 << 5) 183962306a36Sopenharmony_ci#define RT5640_M_MP3_ORG_R_SFT 5 184062306a36Sopenharmony_ci 184162306a36Sopenharmony_ci/* MP3 Plus Control 2 (0xd1) */ 184262306a36Sopenharmony_ci#define RT5640_MP3_WT_MASK (0x1 << 13) 184362306a36Sopenharmony_ci#define RT5640_MP3_WT_SFT 13 184462306a36Sopenharmony_ci#define RT5640_MP3_WT_1_4 (0x0 << 13) 184562306a36Sopenharmony_ci#define RT5640_MP3_WT_1_2 (0x1 << 13) 184662306a36Sopenharmony_ci#define RT5640_OG_MP3_MASK (0x1f << 8) 184762306a36Sopenharmony_ci#define RT5640_OG_MP3_SFT 8 184862306a36Sopenharmony_ci#define RT5640_HG_MP3_MASK (0x3f) 184962306a36Sopenharmony_ci#define RT5640_HG_MP3_SFT 0 185062306a36Sopenharmony_ci 185162306a36Sopenharmony_ci/* 3D HP Control 1 (0xd2) */ 185262306a36Sopenharmony_ci#define RT5640_3D_CF_MASK (0x1 << 15) 185362306a36Sopenharmony_ci#define RT5640_3D_CF_SFT 15 185462306a36Sopenharmony_ci#define RT5640_3D_CF_DIS (0x0 << 15) 185562306a36Sopenharmony_ci#define RT5640_3D_CF_EN (0x1 << 15) 185662306a36Sopenharmony_ci#define RT5640_3D_HP_MASK (0x1 << 14) 185762306a36Sopenharmony_ci#define RT5640_3D_HP_SFT 14 185862306a36Sopenharmony_ci#define RT5640_3D_HP_DIS (0x0 << 14) 185962306a36Sopenharmony_ci#define RT5640_3D_HP_EN (0x1 << 14) 186062306a36Sopenharmony_ci#define RT5640_3D_BT_MASK (0x1 << 13) 186162306a36Sopenharmony_ci#define RT5640_3D_BT_SFT 13 186262306a36Sopenharmony_ci#define RT5640_3D_BT_DIS (0x0 << 13) 186362306a36Sopenharmony_ci#define RT5640_3D_BT_EN (0x1 << 13) 186462306a36Sopenharmony_ci#define RT5640_3D_1F_MIX_MASK (0x3 << 11) 186562306a36Sopenharmony_ci#define RT5640_3D_1F_MIX_SFT 11 186662306a36Sopenharmony_ci#define RT5640_3D_HP_M_MASK (0x1 << 10) 186762306a36Sopenharmony_ci#define RT5640_3D_HP_M_SFT 10 186862306a36Sopenharmony_ci#define RT5640_3D_HP_M_SUR (0x0 << 10) 186962306a36Sopenharmony_ci#define RT5640_3D_HP_M_FRO (0x1 << 10) 187062306a36Sopenharmony_ci#define RT5640_M_3D_HRTF_MASK (0x1 << 9) 187162306a36Sopenharmony_ci#define RT5640_M_3D_HRTF_SFT 9 187262306a36Sopenharmony_ci#define RT5640_M_3D_D2H_MASK (0x1 << 8) 187362306a36Sopenharmony_ci#define RT5640_M_3D_D2H_SFT 8 187462306a36Sopenharmony_ci#define RT5640_M_3D_D2R_MASK (0x1 << 7) 187562306a36Sopenharmony_ci#define RT5640_M_3D_D2R_SFT 7 187662306a36Sopenharmony_ci#define RT5640_M_3D_REVB_MASK (0x1 << 6) 187762306a36Sopenharmony_ci#define RT5640_M_3D_REVB_SFT 6 187862306a36Sopenharmony_ci 187962306a36Sopenharmony_ci/* Adjustable high pass filter control 1 (0xd3) */ 188062306a36Sopenharmony_ci#define RT5640_2ND_HPF_MASK (0x1 << 15) 188162306a36Sopenharmony_ci#define RT5640_2ND_HPF_SFT 15 188262306a36Sopenharmony_ci#define RT5640_2ND_HPF_DIS (0x0 << 15) 188362306a36Sopenharmony_ci#define RT5640_2ND_HPF_EN (0x1 << 15) 188462306a36Sopenharmony_ci#define RT5640_HPF_CF_L_MASK (0x7 << 12) 188562306a36Sopenharmony_ci#define RT5640_HPF_CF_L_SFT 12 188662306a36Sopenharmony_ci#define RT5640_1ST_HPF_MASK (0x1 << 11) 188762306a36Sopenharmony_ci#define RT5640_1ST_HPF_SFT 11 188862306a36Sopenharmony_ci#define RT5640_1ST_HPF_DIS (0x0 << 11) 188962306a36Sopenharmony_ci#define RT5640_1ST_HPF_EN (0x1 << 11) 189062306a36Sopenharmony_ci#define RT5640_HPF_CF_R_MASK (0x7 << 8) 189162306a36Sopenharmony_ci#define RT5640_HPF_CF_R_SFT 8 189262306a36Sopenharmony_ci#define RT5640_ZD_T_MASK (0x3 << 6) 189362306a36Sopenharmony_ci#define RT5640_ZD_T_SFT 6 189462306a36Sopenharmony_ci#define RT5640_ZD_F_MASK (0x3 << 4) 189562306a36Sopenharmony_ci#define RT5640_ZD_F_SFT 4 189662306a36Sopenharmony_ci#define RT5640_ZD_F_IM (0x0 << 4) 189762306a36Sopenharmony_ci#define RT5640_ZD_F_ZC_IM (0x1 << 4) 189862306a36Sopenharmony_ci#define RT5640_ZD_F_ZC_IOD (0x2 << 4) 189962306a36Sopenharmony_ci#define RT5640_ZD_F_UN (0x3 << 4) 190062306a36Sopenharmony_ci 190162306a36Sopenharmony_ci/* HP calibration control and Amp detection (0xd6) */ 190262306a36Sopenharmony_ci#define RT5640_SI_DAC_MASK (0x1 << 11) 190362306a36Sopenharmony_ci#define RT5640_SI_DAC_SFT 11 190462306a36Sopenharmony_ci#define RT5640_SI_DAC_AUTO (0x0 << 11) 190562306a36Sopenharmony_ci#define RT5640_SI_DAC_TEST (0x1 << 11) 190662306a36Sopenharmony_ci#define RT5640_DC_CAL_M_MASK (0x1 << 10) 190762306a36Sopenharmony_ci#define RT5640_DC_CAL_M_SFT 10 190862306a36Sopenharmony_ci#define RT5640_DC_CAL_M_CAL (0x0 << 10) 190962306a36Sopenharmony_ci#define RT5640_DC_CAL_M_NOR (0x1 << 10) 191062306a36Sopenharmony_ci#define RT5640_DC_CAL_MASK (0x1 << 9) 191162306a36Sopenharmony_ci#define RT5640_DC_CAL_SFT 9 191262306a36Sopenharmony_ci#define RT5640_DC_CAL_DIS (0x0 << 9) 191362306a36Sopenharmony_ci#define RT5640_DC_CAL_EN (0x1 << 9) 191462306a36Sopenharmony_ci#define RT5640_HPD_RCV_MASK (0x7 << 6) 191562306a36Sopenharmony_ci#define RT5640_HPD_RCV_SFT 6 191662306a36Sopenharmony_ci#define RT5640_HPD_PS_MASK (0x1 << 5) 191762306a36Sopenharmony_ci#define RT5640_HPD_PS_SFT 5 191862306a36Sopenharmony_ci#define RT5640_HPD_PS_DIS (0x0 << 5) 191962306a36Sopenharmony_ci#define RT5640_HPD_PS_EN (0x1 << 5) 192062306a36Sopenharmony_ci#define RT5640_CAL_M_MASK (0x1 << 4) 192162306a36Sopenharmony_ci#define RT5640_CAL_M_SFT 4 192262306a36Sopenharmony_ci#define RT5640_CAL_M_DEP (0x0 << 4) 192362306a36Sopenharmony_ci#define RT5640_CAL_M_CAL (0x1 << 4) 192462306a36Sopenharmony_ci#define RT5640_CAL_MASK (0x1 << 3) 192562306a36Sopenharmony_ci#define RT5640_CAL_SFT 3 192662306a36Sopenharmony_ci#define RT5640_CAL_DIS (0x0 << 3) 192762306a36Sopenharmony_ci#define RT5640_CAL_EN (0x1 << 3) 192862306a36Sopenharmony_ci#define RT5640_CAL_TEST_MASK (0x1 << 2) 192962306a36Sopenharmony_ci#define RT5640_CAL_TEST_SFT 2 193062306a36Sopenharmony_ci#define RT5640_CAL_TEST_DIS (0x0 << 2) 193162306a36Sopenharmony_ci#define RT5640_CAL_TEST_EN (0x1 << 2) 193262306a36Sopenharmony_ci#define RT5640_CAL_P_MASK (0x3) 193362306a36Sopenharmony_ci#define RT5640_CAL_P_SFT 0 193462306a36Sopenharmony_ci#define RT5640_CAL_P_NONE (0x0) 193562306a36Sopenharmony_ci#define RT5640_CAL_P_CAL (0x1) 193662306a36Sopenharmony_ci#define RT5640_CAL_P_DAC_CAL (0x2) 193762306a36Sopenharmony_ci 193862306a36Sopenharmony_ci/* Soft volume and zero cross control 1 (0xd9) */ 193962306a36Sopenharmony_ci#define RT5640_SV_MASK (0x1 << 15) 194062306a36Sopenharmony_ci#define RT5640_SV_SFT 15 194162306a36Sopenharmony_ci#define RT5640_SV_DIS (0x0 << 15) 194262306a36Sopenharmony_ci#define RT5640_SV_EN (0x1 << 15) 194362306a36Sopenharmony_ci#define RT5640_SPO_SV_MASK (0x1 << 14) 194462306a36Sopenharmony_ci#define RT5640_SPO_SV_SFT 14 194562306a36Sopenharmony_ci#define RT5640_SPO_SV_DIS (0x0 << 14) 194662306a36Sopenharmony_ci#define RT5640_SPO_SV_EN (0x1 << 14) 194762306a36Sopenharmony_ci#define RT5640_OUT_SV_MASK (0x1 << 13) 194862306a36Sopenharmony_ci#define RT5640_OUT_SV_SFT 13 194962306a36Sopenharmony_ci#define RT5640_OUT_SV_DIS (0x0 << 13) 195062306a36Sopenharmony_ci#define RT5640_OUT_SV_EN (0x1 << 13) 195162306a36Sopenharmony_ci#define RT5640_HP_SV_MASK (0x1 << 12) 195262306a36Sopenharmony_ci#define RT5640_HP_SV_SFT 12 195362306a36Sopenharmony_ci#define RT5640_HP_SV_DIS (0x0 << 12) 195462306a36Sopenharmony_ci#define RT5640_HP_SV_EN (0x1 << 12) 195562306a36Sopenharmony_ci#define RT5640_ZCD_DIG_MASK (0x1 << 11) 195662306a36Sopenharmony_ci#define RT5640_ZCD_DIG_SFT 11 195762306a36Sopenharmony_ci#define RT5640_ZCD_DIG_DIS (0x0 << 11) 195862306a36Sopenharmony_ci#define RT5640_ZCD_DIG_EN (0x1 << 11) 195962306a36Sopenharmony_ci#define RT5640_ZCD_MASK (0x1 << 10) 196062306a36Sopenharmony_ci#define RT5640_ZCD_SFT 10 196162306a36Sopenharmony_ci#define RT5640_ZCD_PD (0x0 << 10) 196262306a36Sopenharmony_ci#define RT5640_ZCD_PU (0x1 << 10) 196362306a36Sopenharmony_ci#define RT5640_M_ZCD_MASK (0x3f << 4) 196462306a36Sopenharmony_ci#define RT5640_M_ZCD_SFT 4 196562306a36Sopenharmony_ci#define RT5640_M_ZCD_RM_L (0x1 << 9) 196662306a36Sopenharmony_ci#define RT5640_M_ZCD_RM_R (0x1 << 8) 196762306a36Sopenharmony_ci#define RT5640_M_ZCD_SM_L (0x1 << 7) 196862306a36Sopenharmony_ci#define RT5640_M_ZCD_SM_R (0x1 << 6) 196962306a36Sopenharmony_ci#define RT5640_M_ZCD_OM_L (0x1 << 5) 197062306a36Sopenharmony_ci#define RT5640_M_ZCD_OM_R (0x1 << 4) 197162306a36Sopenharmony_ci#define RT5640_SV_DLY_MASK (0xf) 197262306a36Sopenharmony_ci#define RT5640_SV_DLY_SFT 0 197362306a36Sopenharmony_ci 197462306a36Sopenharmony_ci/* Soft volume and zero cross control 2 (0xda) */ 197562306a36Sopenharmony_ci#define RT5640_ZCD_HP_MASK (0x1 << 15) 197662306a36Sopenharmony_ci#define RT5640_ZCD_HP_SFT 15 197762306a36Sopenharmony_ci#define RT5640_ZCD_HP_DIS (0x0 << 15) 197862306a36Sopenharmony_ci#define RT5640_ZCD_HP_EN (0x1 << 15) 197962306a36Sopenharmony_ci 198062306a36Sopenharmony_ci/* General Control 1 (0xfa) */ 198162306a36Sopenharmony_ci#define RT5640_EN_LOUT_DF (0x1 << 14) 198262306a36Sopenharmony_ci#define RT5640_EN_LOUT_DF_SFT 14 198362306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L (0x1 << 13) 198462306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_L_SFT 13 198562306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R (0x1 << 12) 198662306a36Sopenharmony_ci#define RT5640_M_MONO_ADC_R_SFT 12 198762306a36Sopenharmony_ci#define RT5640_MCLK_DET (0x1 << 11) 198862306a36Sopenharmony_ci 198962306a36Sopenharmony_ci/* General Control 1 (0xfb) */ 199062306a36Sopenharmony_ci#define RT5640_IRQ_JD2_MASK (0x1 << 12) 199162306a36Sopenharmony_ci#define RT5640_IRQ_JD2_SFT 12 199262306a36Sopenharmony_ci#define RT5640_IRQ_JD2_BP (0x0 << 12) 199362306a36Sopenharmony_ci#define RT5640_IRQ_JD2_NOR (0x1 << 12) 199462306a36Sopenharmony_ci#define RT5640_JD2_P_MASK (0x1 << 10) 199562306a36Sopenharmony_ci#define RT5640_JD2_P_SFT 10 199662306a36Sopenharmony_ci#define RT5640_JD2_P_NOR (0x0 << 10) 199762306a36Sopenharmony_ci#define RT5640_JD2_P_INV (0x1 << 10) 199862306a36Sopenharmony_ci#define RT5640_JD2_MASK (0x1 << 8) 199962306a36Sopenharmony_ci#define RT5640_JD2_SFT 8 200062306a36Sopenharmony_ci#define RT5640_JD2_DIS (0x0 << 8) 200162306a36Sopenharmony_ci#define RT5640_JD2_EN (0x1 << 8) 200262306a36Sopenharmony_ci 200362306a36Sopenharmony_ci/* Codec Private Register definition */ 200462306a36Sopenharmony_ci 200562306a36Sopenharmony_ci/* MIC Over current threshold scale factor (0x15) */ 200662306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_MASK (0x3 << 8) 200762306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_SFT 8 200862306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_0P5 (0x0 << 8) 200962306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_0P75 (0x1 << 8) 201062306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_1P0 (0x2 << 8) 201162306a36Sopenharmony_ci#define RT5640_MIC_OVCD_SF_1P5 (0x3 << 8) 201262306a36Sopenharmony_ci 201362306a36Sopenharmony_ci/* 3D Speaker Control (0x63) */ 201462306a36Sopenharmony_ci#define RT5640_3D_SPK_MASK (0x1 << 15) 201562306a36Sopenharmony_ci#define RT5640_3D_SPK_SFT 15 201662306a36Sopenharmony_ci#define RT5640_3D_SPK_DIS (0x0 << 15) 201762306a36Sopenharmony_ci#define RT5640_3D_SPK_EN (0x1 << 15) 201862306a36Sopenharmony_ci#define RT5640_3D_SPK_M_MASK (0x3 << 13) 201962306a36Sopenharmony_ci#define RT5640_3D_SPK_M_SFT 13 202062306a36Sopenharmony_ci#define RT5640_3D_SPK_CG_MASK (0x1f << 8) 202162306a36Sopenharmony_ci#define RT5640_3D_SPK_CG_SFT 8 202262306a36Sopenharmony_ci#define RT5640_3D_SPK_SG_MASK (0x1f) 202362306a36Sopenharmony_ci#define RT5640_3D_SPK_SG_SFT 0 202462306a36Sopenharmony_ci 202562306a36Sopenharmony_ci/* Wind Noise Detection Control 1 (0x6c) */ 202662306a36Sopenharmony_ci#define RT5640_WND_MASK (0x1 << 15) 202762306a36Sopenharmony_ci#define RT5640_WND_SFT 15 202862306a36Sopenharmony_ci#define RT5640_WND_DIS (0x0 << 15) 202962306a36Sopenharmony_ci#define RT5640_WND_EN (0x1 << 15) 203062306a36Sopenharmony_ci 203162306a36Sopenharmony_ci/* Wind Noise Detection Control 2 (0x6d) */ 203262306a36Sopenharmony_ci#define RT5640_WND_FC_NW_MASK (0x3f << 10) 203362306a36Sopenharmony_ci#define RT5640_WND_FC_NW_SFT 10 203462306a36Sopenharmony_ci#define RT5640_WND_FC_WK_MASK (0x3f << 4) 203562306a36Sopenharmony_ci#define RT5640_WND_FC_WK_SFT 4 203662306a36Sopenharmony_ci 203762306a36Sopenharmony_ci/* Wind Noise Detection Control 3 (0x6e) */ 203862306a36Sopenharmony_ci#define RT5640_HPF_FC_MASK (0x3f << 6) 203962306a36Sopenharmony_ci#define RT5640_HPF_FC_SFT 6 204062306a36Sopenharmony_ci#define RT5640_WND_FC_ST_MASK (0x3f) 204162306a36Sopenharmony_ci#define RT5640_WND_FC_ST_SFT 0 204262306a36Sopenharmony_ci 204362306a36Sopenharmony_ci/* Wind Noise Detection Control 4 (0x6f) */ 204462306a36Sopenharmony_ci#define RT5640_WND_TH_LO_MASK (0x3ff) 204562306a36Sopenharmony_ci#define RT5640_WND_TH_LO_SFT 0 204662306a36Sopenharmony_ci 204762306a36Sopenharmony_ci/* Wind Noise Detection Control 5 (0x70) */ 204862306a36Sopenharmony_ci#define RT5640_WND_TH_HI_MASK (0x3ff) 204962306a36Sopenharmony_ci#define RT5640_WND_TH_HI_SFT 0 205062306a36Sopenharmony_ci 205162306a36Sopenharmony_ci/* Wind Noise Detection Control 8 (0x73) */ 205262306a36Sopenharmony_ci#define RT5640_WND_WIND_MASK (0x1 << 13) /* Read-Only */ 205362306a36Sopenharmony_ci#define RT5640_WND_WIND_SFT 13 205462306a36Sopenharmony_ci#define RT5640_WND_STRONG_MASK (0x1 << 12) /* Read-Only */ 205562306a36Sopenharmony_ci#define RT5640_WND_STRONG_SFT 12 205662306a36Sopenharmony_cienum { 205762306a36Sopenharmony_ci RT5640_NO_WIND, 205862306a36Sopenharmony_ci RT5640_BREEZE, 205962306a36Sopenharmony_ci RT5640_STORM, 206062306a36Sopenharmony_ci}; 206162306a36Sopenharmony_ci 206262306a36Sopenharmony_ci/* Dipole Speaker Interface (0x75) */ 206362306a36Sopenharmony_ci#define RT5640_DP_ATT_MASK (0x3 << 14) 206462306a36Sopenharmony_ci#define RT5640_DP_ATT_SFT 14 206562306a36Sopenharmony_ci#define RT5640_DP_SPK_MASK (0x1 << 10) 206662306a36Sopenharmony_ci#define RT5640_DP_SPK_SFT 10 206762306a36Sopenharmony_ci#define RT5640_DP_SPK_DIS (0x0 << 10) 206862306a36Sopenharmony_ci#define RT5640_DP_SPK_EN (0x1 << 10) 206962306a36Sopenharmony_ci 207062306a36Sopenharmony_ci/* EQ Pre Volume Control (0xb3) */ 207162306a36Sopenharmony_ci#define RT5640_EQ_PRE_VOL_MASK (0xffff) 207262306a36Sopenharmony_ci#define RT5640_EQ_PRE_VOL_SFT 0 207362306a36Sopenharmony_ci 207462306a36Sopenharmony_ci/* EQ Post Volume Control (0xb4) */ 207562306a36Sopenharmony_ci#define RT5640_EQ_PST_VOL_MASK (0xffff) 207662306a36Sopenharmony_ci#define RT5640_EQ_PST_VOL_SFT 0 207762306a36Sopenharmony_ci 207862306a36Sopenharmony_ci#define RT5640_NO_JACK BIT(0) 207962306a36Sopenharmony_ci#define RT5640_HEADSET_DET BIT(1) 208062306a36Sopenharmony_ci#define RT5640_HEADPHO_DET BIT(2) 208162306a36Sopenharmony_ci 208262306a36Sopenharmony_ci/* System Clock Source */ 208362306a36Sopenharmony_ci#define RT5640_SCLK_S_MCLK 0 208462306a36Sopenharmony_ci#define RT5640_SCLK_S_PLL1 1 208562306a36Sopenharmony_ci#define RT5640_SCLK_S_PLL1_TK 2 208662306a36Sopenharmony_ci#define RT5640_SCLK_S_RCCLK 3 208762306a36Sopenharmony_ci 208862306a36Sopenharmony_ci/* PLL1 Source */ 208962306a36Sopenharmony_ci#define RT5640_PLL1_S_MCLK 0 209062306a36Sopenharmony_ci#define RT5640_PLL1_S_BCLK1 1 209162306a36Sopenharmony_ci#define RT5640_PLL1_S_BCLK2 2 209262306a36Sopenharmony_ci#define RT5640_PLL1_S_BCLK3 3 209362306a36Sopenharmony_ci 209462306a36Sopenharmony_ci 209562306a36Sopenharmony_cienum { 209662306a36Sopenharmony_ci RT5640_AIF1, 209762306a36Sopenharmony_ci RT5640_AIF2, 209862306a36Sopenharmony_ci RT5640_AIF3, 209962306a36Sopenharmony_ci RT5640_AIFS, 210062306a36Sopenharmony_ci}; 210162306a36Sopenharmony_ci 210262306a36Sopenharmony_cienum { 210362306a36Sopenharmony_ci RT5640_U_IF1 = 0x1, 210462306a36Sopenharmony_ci RT5640_U_IF2 = 0x2, 210562306a36Sopenharmony_ci RT5640_U_IF3 = 0x4, 210662306a36Sopenharmony_ci}; 210762306a36Sopenharmony_ci 210862306a36Sopenharmony_cienum { 210962306a36Sopenharmony_ci RT5640_IF_123, 211062306a36Sopenharmony_ci RT5640_IF_132, 211162306a36Sopenharmony_ci RT5640_IF_312, 211262306a36Sopenharmony_ci RT5640_IF_321, 211362306a36Sopenharmony_ci RT5640_IF_231, 211462306a36Sopenharmony_ci RT5640_IF_213, 211562306a36Sopenharmony_ci RT5640_IF_113, 211662306a36Sopenharmony_ci RT5640_IF_223, 211762306a36Sopenharmony_ci RT5640_IF_ALL, 211862306a36Sopenharmony_ci}; 211962306a36Sopenharmony_ci 212062306a36Sopenharmony_cienum { 212162306a36Sopenharmony_ci RT5640_DMIC_DIS, 212262306a36Sopenharmony_ci RT5640_DMIC1, 212362306a36Sopenharmony_ci RT5640_DMIC2, 212462306a36Sopenharmony_ci}; 212562306a36Sopenharmony_ci 212662306a36Sopenharmony_ci/* filter mask */ 212762306a36Sopenharmony_cienum { 212862306a36Sopenharmony_ci RT5640_DA_STEREO_FILTER = 0x1, 212962306a36Sopenharmony_ci RT5640_DA_MONO_L_FILTER = (0x1 << 1), 213062306a36Sopenharmony_ci RT5640_DA_MONO_R_FILTER = (0x1 << 2), 213162306a36Sopenharmony_ci RT5640_AD_STEREO_FILTER = (0x1 << 3), 213262306a36Sopenharmony_ci RT5640_AD_MONO_L_FILTER = (0x1 << 4), 213362306a36Sopenharmony_ci RT5640_AD_MONO_R_FILTER = (0x1 << 5), 213462306a36Sopenharmony_ci}; 213562306a36Sopenharmony_ci 213662306a36Sopenharmony_cistruct rt5640_priv { 213762306a36Sopenharmony_ci struct snd_soc_component *component; 213862306a36Sopenharmony_ci struct regmap *regmap; 213962306a36Sopenharmony_ci struct clk *mclk; 214062306a36Sopenharmony_ci 214162306a36Sopenharmony_ci struct gpio_desc *ldo1_en; /* GPIO for LDO1_EN */ 214262306a36Sopenharmony_ci int irq; 214362306a36Sopenharmony_ci int jd_gpio_irq; 214462306a36Sopenharmony_ci int sysclk; 214562306a36Sopenharmony_ci int sysclk_src; 214662306a36Sopenharmony_ci int lrck[RT5640_AIFS]; 214762306a36Sopenharmony_ci int bclk[RT5640_AIFS]; 214862306a36Sopenharmony_ci int master[RT5640_AIFS]; 214962306a36Sopenharmony_ci 215062306a36Sopenharmony_ci int pll_src; 215162306a36Sopenharmony_ci int pll_in; 215262306a36Sopenharmony_ci int pll_out; 215362306a36Sopenharmony_ci 215462306a36Sopenharmony_ci bool hp_mute; 215562306a36Sopenharmony_ci bool asrc_en; 215662306a36Sopenharmony_ci bool irq_requested; 215762306a36Sopenharmony_ci bool jd_gpio_irq_requested; 215862306a36Sopenharmony_ci 215962306a36Sopenharmony_ci /* Jack and button detect data */ 216062306a36Sopenharmony_ci bool ovcd_irq_enabled; 216162306a36Sopenharmony_ci bool pressed; 216262306a36Sopenharmony_ci bool press_reported; 216362306a36Sopenharmony_ci int press_count; 216462306a36Sopenharmony_ci int release_count; 216562306a36Sopenharmony_ci int poll_count; 216662306a36Sopenharmony_ci struct delayed_work bp_work; 216762306a36Sopenharmony_ci struct delayed_work jack_work; 216862306a36Sopenharmony_ci struct snd_soc_jack *jack; 216962306a36Sopenharmony_ci struct gpio_desc *jd_gpio; 217062306a36Sopenharmony_ci unsigned int jd_src; 217162306a36Sopenharmony_ci bool jd_inverted; 217262306a36Sopenharmony_ci unsigned int ovcd_th; 217362306a36Sopenharmony_ci unsigned int ovcd_sf; 217462306a36Sopenharmony_ci bool use_platform_clock; 217562306a36Sopenharmony_ci}; 217662306a36Sopenharmony_ci 217762306a36Sopenharmony_cistruct rt5640_set_jack_data { 217862306a36Sopenharmony_ci int codec_irq_override; 217962306a36Sopenharmony_ci struct gpio_desc *jd_gpio; 218062306a36Sopenharmony_ci bool use_platform_clock; 218162306a36Sopenharmony_ci}; 218262306a36Sopenharmony_ci 218362306a36Sopenharmony_ciint rt5640_dmic_enable(struct snd_soc_component *component, 218462306a36Sopenharmony_ci bool dmic1_data_pin, bool dmic2_data_pin); 218562306a36Sopenharmony_ciint rt5640_sel_asrc_clk_src(struct snd_soc_component *component, 218662306a36Sopenharmony_ci unsigned int filter_mask, unsigned int clk_src); 218762306a36Sopenharmony_ci 218862306a36Sopenharmony_civoid rt5640_set_ovcd_params(struct snd_soc_component *component); 218962306a36Sopenharmony_civoid rt5640_enable_micbias1_for_ovcd(struct snd_soc_component *component); 219062306a36Sopenharmony_civoid rt5640_disable_micbias1_for_ovcd(struct snd_soc_component *component); 219162306a36Sopenharmony_ciint rt5640_detect_headset(struct snd_soc_component *component, struct gpio_desc *hp_det_gpio); 219262306a36Sopenharmony_ci 219362306a36Sopenharmony_ci#endif 2194