<commit_before>/*
 * rt5640.h  --  RT5640 ALSA SoC audio driver
 *
 * Copyright 2011 Realtek Microelectronics
 * Author: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _RT5640_H
#define _RT5640_H

#include <sound/rt5640.h>

/* Info */
#define RT5640_RESET				0x00
#define RT5640_VENDOR_ID			0xfd
#define RT5640_VENDOR_ID1			0xfe
#define RT5640_VENDOR_ID2			0xff
/*  I/O - Output */
#define RT5640_SPK_VOL				0x01
#define RT5640_HP_VOL				0x02
#define RT5640_OUTPUT				0x03
#define RT5640_MONO_OUT				0x04
/* I/O - Input */
#define RT5640_IN1_IN2				0x0d
#define RT5640_IN3_IN4				0x0e
#define RT5640_INL_INR_VOL			0x0f
/* I/O - ADC/DAC/DMIC */
#define RT5640_DAC1_DIG_VOL			0x19
#define RT5640_DAC2_DIG_VOL			0x1a
#define RT5640_DAC2_CTRL			0x1b
#define RT5640_ADC_DIG_VOL			0x1c
#define RT5640_ADC_DATA				0x1d
#define RT5640_ADC_BST_VOL			0x1e
/* Mixer - D-D */
#define RT5640_STO_ADC_MIXER			0x27
#define RT5640_MONO_ADC_MIXER			0x28
#define RT5640_AD_DA_MIXER			0x29
#define RT5640_STO_DAC_MIXER			0x2a
#define RT5640_MONO_DAC_MIXER			0x2b
#define RT5640_DIG_MIXER			0x2c
#define RT5640_DSP_PATH1			0x2d
#define RT5640_DSP_PATH2			0x2e
#define RT5640_DIG_INF_DATA			0x2f
/* Mixer - ADC */
#define RT5640_REC_L1_MIXER			0x3b
#define RT5640_REC_L2_MIXER			0x3c
#define RT5640_REC_R1_MIXER			0x3d
#define RT5640_REC_R2_MIXER			0x3e
/* Mixer - DAC */
#define RT5640_HPO_MIXER			0x45
#define RT5640_SPK_L_MIXER			0x46
#define RT5640_SPK_R_MIXER			0x47
#define RT5640_SPO_L_MIXER			0x48
#define RT5640_SPO_R_MIXER			0x49
#define RT5640_SPO_CLSD_RATIO			0x4a
#define RT5640_MONO_MIXER			0x4c
#define RT5640_OUT_L1_MIXER			0x4d
#define RT5640_OUT_L2_MIXER			0x4e
#define RT5640_OUT_L3_MIXER			0x4f
#define RT5640_OUT_R1_MIXER			0x50
#define RT5640_OUT_R2_MIXER			0x51
#define RT5640_OUT_R3_MIXER			0x52
#define RT5640_LOUT_MIXER			0x53
/* Power */
#define RT5640_PWR_DIG1				0x61
#define RT5640_PWR_DIG2				0x62
#define RT5640_PWR_ANLG1			0x63
#define RT5640_PWR_ANLG2			0x64
#define RT5640_PWR_MIXER			0x65
#define RT5640_PWR_VOL				0x66
/* Private Register Control */
#define RT5640_PRIV_INDEX			0x6a
#define RT5640_PRIV_DATA			0x6c
/* Format - ADC/DAC */
#define RT5640_I2S1_SDP				0x70
#define RT5640_I2S2_SDP				0x71
#define RT5640_ADDA_CLK1			0x73
#define RT5640_ADDA_CLK2			0x74
#define RT5640_DMIC				0x75
/* Function - Analog */
#define RT5640_GLB_CLK				0x80
#define RT5640_PLL_CTRL1			0x81
#define RT5640_PLL_CTRL2			0x82
#define RT5640_ASRC_1				0x83
#define RT5640_ASRC_2				0x84
#define RT5640_ASRC_3				0x85
#define RT5640_ASRC_4				0x89
#define RT5640_ASRC_5				0x8a
#define RT5640_HP_OVCD				0x8b
#define RT5640_CLS_D_OVCD			0x8c
#define RT5640_CLS_D_OUT			0x8d
#define RT5640_DEPOP_M1				0x8e
#define RT5640_DEPOP_M2				0x8f
#define RT5640_DEPOP_M3				0x90
#define RT5640_CHARGE_PUMP			0x91
#define RT5640_PV_DET_SPK_G			0x92
#define RT5640_MICBIAS				0x93
/* Function - Digital */
#define RT5640_EQ_CTRL1				0xb0
#define RT5640_EQ_CTRL2				0xb1
#define RT5640_WIND_FILTER			0xb2
#define RT5640_DRC_AGC_1			0xb4
#define RT5640_DRC_AGC_2			0xb5
#define RT5640_DRC_AGC_3			0xb6
#define RT5640_SVOL_ZC				0xb7
#define RT5640_ANC_CTRL1			0xb8
#define RT5640_ANC_CTRL2			0xb9
#define RT5640_ANC_CTRL3			0xba
#define RT5640_JD_CTRL				0xbb
#define RT5640_ANC_JD				0xbc
#define RT5640_IRQ_CTRL1			0xbd
#define RT5640_IRQ_CTRL2			0xbe
#define RT5640_INT_IRQ_ST			0xbf
#define RT5640_GPIO_CTRL1			0xc0
#define RT5640_GPIO_CTRL2			0xc1
#define RT5640_GPIO_CTRL3			0xc2
#define RT5640_DSP_CTRL1			0xc4
#define RT5640_DSP_CTRL2			0xc5
#define RT5640_DSP_CTRL3			0xc6
#define RT5640_DSP_CTRL4			0xc7
#define RT5640_PGM_REG_ARR1			0xc8
#define RT5640_PGM_REG_ARR2			0xc9
#define RT5640_PGM_REG_ARR3			0xca
#define RT5640_PGM_REG_ARR4			0xcb
#define RT5640_PGM_REG_ARR5			0xcc
#define RT5640_SCB_FUNC				0xcd
#define RT5640_SCB_CTRL				0xce
#define RT5640_BASE_BACK			0xcf
#define RT5640_MP3_PLUS1			0xd0
#define RT5640_MP3_PLUS2			0xd1
#define RT5640_3D_HP				0xd2
#define RT5640_ADJ_HPF				0xd3
#define RT5640_HP_CALIB_AMP_DET			0xd6
#define RT5640_HP_CALIB2			0xd7
#define RT5640_SV_ZCD1				0xd9
#define RT5640_SV_ZCD2				0xda
/* Dummy Register */
#define RT5640_DUMMY1				0xfa
#define RT5640_DUMMY2				0xfb
#define RT5640_DUMMY3				0xfc


/* Index of Codec Private Register definition */
#define RT5640_CHPUMP_INT_REG1			0x24
#define RT5640_MAMP_INT_REG2			0x37
#define RT5640_3D_SPK				0x63
#define RT5640_WND_1				0x6c
#define RT5640_WND_2				0x6d
#define RT5640_WND_3				0x6e
#define RT5640_WND_4				0x6f
#define RT5640_WND_5				0x70
#define RT5640_WND_8				0x73
#define RT5640_DIP_SPK_INF			0x75
#define RT5640_HP_DCC_INT1			0x77
#define RT5640_EQ_BW_LOP			0xa0
#define RT5640_EQ_GN_LOP			0xa1
#define RT5640_EQ_FC_BP1			0xa2
#define RT5640_EQ_BW_BP1			0xa3
#define RT5640_EQ_GN_BP1			0xa4
#define RT5640_EQ_FC_BP2			0xa5
#define RT5640_EQ_BW_BP2			0xa6
#define RT5640_EQ_GN_BP2			0xa7
#define RT5640_EQ_FC_BP3			0xa8
#define RT5640_EQ_BW_BP3			0xa9
#define RT5640_EQ_GN_BP3			0xaa
#define RT5640_EQ_FC_BP4			0xab
#define RT5640_EQ_BW_BP4			0xac
#define RT5640_EQ_GN_BP4			0xad
#define RT5640_EQ_FC_HIP1			0xae
#define RT5640_EQ_GN_HIP1			0xaf
#define RT5640_EQ_FC_HIP2			0xb0
#define RT5640_EQ_BW_HIP2			0xb1
#define RT5640_EQ_GN_HIP2			0xb2
#define RT5640_EQ_PRE_VOL			0xb3
#define RT5640_EQ_PST_VOL			0xb4

/* global definition */
#define RT5640_L_MUTE				(0x1 << 15)
#define RT5640_L_MUTE_SFT			15
#define RT5640_VOL_L_MUTE			(0x1 << 14)
#define RT5640_VOL_L_SFT			14
#define RT5640_R_MUTE				(0x1 << 7)
#define RT5640_R_MUTE_SFT			7
#define RT5640_VOL_R_MUTE			(0x1 << 6)
#define RT5640_VOL_R_SFT			6
#define RT5640_L_VOL_MASK			(0x3f << 8)
#define RT5640_L_VOL_SFT			8
#define RT5640_R_VOL_MASK			(0x3f)
#define RT5640_R_VOL_SFT			0

/* SW Reset & Device ID (0x00) */
#define RT5640_ID_MASK				(0x3 << 1)
#define RT5640_ID_5639				(0x0 << 1)
#define RT5640_ID_5640				(0x1 << 1)
#define RT5640_ID_5642				(0x3 << 1)


/* IN1 and IN2 Control (0x0d) */
/* IN3 and IN4 Control (0x0e) */
#define RT5640_BST_SFT1				12
#define RT5640_BST_SFT2				8
#define RT5640_IN_DF1				(0x1 << 7)
#define RT5640_IN_SFT1				7
#define RT5640_IN_DF2				(0x1 << 6)
#define RT5640_IN_SFT2				6

/* INL and INR Volume Control (0x0f) */
#define RT5640_INL_SEL_MASK			(0x1 << 15)
#define RT5640_INL_SEL_SFT			15
#define RT5640_INL_SEL_IN4P			(0x0 << 15)
#define RT5640_INL_SEL_MONOP			(0x1 << 15)
#define RT5640_INL_VOL_MASK			(0x1f << 8)
#define RT5640_INL_VOL_SFT			8
#define RT5640_INR_SEL_MASK			(0x1 << 7)
#define RT5640_INR_SEL_SFT			7
#define RT5640_INR_SEL_IN4N			(0x0 << 7)<commit_msg>ASoC: rt5640: correct 5640's device ID<commit_after>/*
 * rt5640.h  --  RT5640 ALSA SoC audio driver
 *
 * Copyright 2011 Realtek Microelectronics
 * Author: <NAME> <<EMAIL>>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef _RT5640_H
#define _RT5640_H

#include <sound/rt5640.h>

/* Info */
#define RT5640_RESET				0x00
#define RT5640_VENDOR_ID			0xfd
#define RT5640_VENDOR_ID1			0xfe
#define RT5640_VENDOR_ID2			0xff
/*  I/O - Output */
#define RT5640_SPK_VOL				0x01
#define RT5640_HP_VOL				0x02
#define RT5640_OUTPUT				0x03
#define RT5640_MONO_OUT				0x04
/* I/O - Input */
#define RT5640_IN1_IN2				0x0d
#define RT5640_IN3_IN4				0x0e
#define RT5640_INL_INR_VOL			0x0f
/* I/O - ADC/DAC/DMIC */
#define RT5640_DAC1_DIG_VOL			0x19
#define RT5640_DAC2_DIG_VOL			0x1a
#define RT5640_DAC2_CTRL			0x1b
#define RT5640_ADC_DIG_VOL			0x1c
#define RT5640_ADC_DATA				0x1d
#define RT5640_ADC_BST_VOL			0x1e
/* Mixer - D-D */
#define RT5640_STO_ADC_MIXER			0x27
#define RT5640_MONO_ADC_MIXER			0x28
#define RT5640_AD_DA_MIXER			0x29
#define RT5640_STO_DAC_MIXER			0x2a
#define RT5640_MONO_DAC_MIXER			0x2b
#define RT5640_DIG_MIXER			0x2c
#define RT5640_DSP_PATH1			0x2d
#define RT5640_DSP_PATH2			0x2e
#define RT5640_DIG_INF_DATA			0x2f
/* Mixer - ADC */
#define RT5640_REC_L1_MIXER			0x3b
#define RT5640_REC_L2_MIXER			0x3c
#define RT5640_REC_R1_MIXER			0x3d
#define RT5640_REC_R2_MIXER			0x3e
/* Mixer - DAC */
#define RT5640_HPO_MIXER			0x45
#define RT5640_SPK_L_MIXER			0x46
#define RT5640_SPK_R_MIXER			0x47
#define RT5640_SPO_L_MIXER			0x48
#define RT5640_SPO_R_MIXER			0x49
#define RT5640_SPO_CLSD_RATIO			0x4a
#define RT5640_MONO_MIXER			0x4c
#define RT5640_OUT_L1_MIXER			0x4d
#define RT5640_OUT_L2_MIXER			0x4e
#define RT5640_OUT_L3_MIXER			0x4f
#define RT5640_OUT_R1_MIXER			0x50
#define RT5640_OUT_R2_MIXER			0x51
#define RT5640_OUT_R3_MIXER			0x52
#define RT5640_LOUT_MIXER			0x53
/* Power */
#define RT5640_PWR_DIG1				0x61
#define RT5640_PWR_DIG2				0x62
#define RT5640_PWR_ANLG1			0x63
#define RT5640_PWR_ANLG2			0x64
#define RT5640_PWR_MIXER			0x65
#define RT5640_PWR_VOL				0x66
/* Private Register Control */
#define RT5640_PRIV_INDEX			0x6a
#define RT5640_PRIV_DATA			0x6c
/* Format - ADC/DAC */
#define RT5640_I2S1_SDP				0x70
#define RT5640_I2S2_SDP				0x71
#define RT5640_ADDA_CLK1			0x73
#define RT5640_ADDA_CLK2			0x74
#define RT5640_DMIC				0x75
/* Function - Analog */
#define RT5640_GLB_CLK				0x80
#define RT5640_PLL_CTRL1			0x81
#define RT5640_PLL_CTRL2			0x82
#define RT5640_ASRC_1				0x83
#define RT5640_ASRC_2				0x84
#define RT5640_ASRC_3				0x85
#define RT5640_ASRC_4				0x89
#define RT5640_ASRC_5				0x8a
#define RT5640_HP_OVCD				0x8b
#define RT5640_CLS_D_OVCD			0x8c
#define RT5640_CLS_D_OUT			0x8d
#define RT5640_DEPOP_M1				0x8e
#define RT5640_DEPOP_M2				0x8f
#define RT5640_DEPOP_M3				0x90
#define RT5640_CHARGE_PUMP			0x91
#define RT5640_PV_DET_SPK_G			0x92
#define RT5640_MICBIAS				0x93
/* Function - Digital */
#define RT5640_EQ_CTRL1				0xb0
#define RT5640_EQ_CTRL2				0xb1
#define RT5640_WIND_FILTER			0xb2
#define RT5640_DRC_AGC_1			0xb4
#define RT5640_DRC_AGC_2			0xb5
#define RT5640_DRC_AGC_3			0xb6
#define RT5640_SVOL_ZC				0xb7
#define RT5640_ANC_CTRL1			0xb8
#define RT5640_ANC_CTRL2			0xb9
#define RT5640_ANC_CTRL3			0xba
#define RT5640_JD_CTRL				0xbb
#define RT5640_ANC_JD				0xbc
#define RT5640_IRQ_CTRL1			0xbd
#define RT5640_IRQ_CTRL2			0xbe
#define RT5640_INT_IRQ_ST			0xbf
#define RT5640_GPIO_CTRL1			0xc0
#define RT5640_GPIO_CTRL2			0xc1
#define RT5640_GPIO_CTRL3			0xc2
#define RT5640_DSP_CTRL1			0xc4
#define RT5640_DSP_CTRL2			0xc5
#define RT5640_DSP_CTRL3			0xc6
#define RT5640_DSP_CTRL4			0xc7
#define RT5640_PGM_REG_ARR1			0xc8
#define RT5640_PGM_REG_ARR2			0xc9
#define RT5640_PGM_REG_ARR3			0xca
#define RT5640_PGM_REG_ARR4			0xcb
#define RT5640_PGM_REG_ARR5			0xcc
#define RT5640_SCB_FUNC				0xcd
#define RT5640_SCB_CTRL				0xce
#define RT5640_BASE_BACK			0xcf
#define RT5640_MP3_PLUS1			0xd0
#define RT5640_MP3_PLUS2			0xd1
#define RT5640_3D_HP				0xd2
#define RT5640_ADJ_HPF				0xd3
#define RT5640_HP_CALIB_AMP_DET			0xd6
#define RT5640_HP_CALIB2			0xd7
#define RT5640_SV_ZCD1				0xd9
#define RT5640_SV_ZCD2				0xda
/* Dummy Register */
#define RT5640_DUMMY1				0xfa
#define RT5640_DUMMY2				0xfb
#define RT5640_DUMMY3				0xfc


/* Index of Codec Private Register definition */
#define RT5640_CHPUMP_INT_REG1			0x24
#define RT5640_MAMP_INT_REG2			0x37
#define RT5640_3D_SPK				0x63
#define RT5640_WND_1				0x6c
#define RT5640_WND_2				0x6d
#define RT5640_WND_3				0x6e
#define RT5640_WND_4				0x6f
#define RT5640_WND_5				0x70
#define RT5640_WND_8				0x73
#define RT5640_DIP_SPK_INF			0x75
#define RT5640_HP_DCC_INT1			0x77
#define RT5640_EQ_BW_LOP			0xa0
#define RT5640_EQ_GN_LOP			0xa1
#define RT5640_EQ_FC_BP1			0xa2
#define RT5640_EQ_BW_BP1			0xa3
#define RT5640_EQ_GN_BP1			0xa4
#define RT5640_EQ_FC_BP2			0xa5
#define RT5640_EQ_BW_BP2			0xa6
#define RT5640_EQ_GN_BP2			0xa7
#define RT5640_EQ_FC_BP3			0xa8
#define RT5640_EQ_BW_BP3			0xa9
#define RT5640_EQ_GN_BP3			0xaa
#define RT5640_EQ_FC_BP4			0xab
#define RT5640_EQ_BW_BP4			0xac
#define RT5640_EQ_GN_BP4			0xad
#define RT5640_EQ_FC_HIP1			0xae
#define RT5640_EQ_GN_HIP1			0xaf
#define RT5640_EQ_FC_HIP2			0xb0
#define RT5640_EQ_BW_HIP2			0xb1
#define RT5640_EQ_GN_HIP2			0xb2
#define RT5640_EQ_PRE_VOL			0xb3
#define RT5640_EQ_PST_VOL			0xb4

/* global definition */
#define RT5640_L_MUTE				(0x1 << 15)
#define RT5640_L_MUTE_SFT			15
#define RT5640_VOL_L_MUTE			(0x1 << 14)
#define RT5640_VOL_L_SFT			14
#define RT5640_R_MUTE				(0x1 << 7)
#define RT5640_R_MUTE_SFT			7
#define RT5640_VOL_R_MUTE			(0x1 << 6)
#define RT5640_VOL_R_SFT			6
#define RT5640_L_VOL_MASK			(0x3f << 8)
#define RT5640_L_VOL_SFT			8
#define RT5640_R_VOL_MASK			(0x3f)
#define RT5640_R_VOL_SFT			0

/* SW Reset & Device ID (0x00) */
#define RT5640_ID_MASK				(0x3 << 1)
#define RT5640_ID_5639				(0x0 << 1)
#define RT5640_ID_5640				(0x2 << 1)
#define RT5640_ID_5642				(0x3 << 1)


/* IN1 and IN2 Control (0x0d) */
/* IN3 and IN4 Control (0x0e) */
#define RT5640_BST_SFT1				12
#define RT5640_BST_SFT2				8
#define RT5640_IN_DF1				(0x1 << 7)
#define RT5640_IN_SFT1				7
#define RT5640_IN_DF2				(0x1 << 6)
#define RT5640_IN_SFT2				6

/* INL and INR Volume Control (0x0f) */
#define RT5640_INL_SEL_MASK			(0x1 << 15)
#define RT5640_INL_SEL_SFT			15
#define RT5640_INL_SEL_IN4P			(0x0 << 15)
#define RT5640_INL_SEL_MONOP			(0x1 << 15)
#define RT5640_INL_VOL_MASK			(0x1f << 8)
#define RT5640_INL_VOL_SFT			8
#define RT5640_INR_SEL_MASK			(0x1 << 7)
#define RT5640_INR_SEL_SFT			7
#define RT5640_INR_SEL_IN4N			(0x0 << 7)
{'fraction_non_alphanumeric': 0.056963428149242705, 'fraction_numerical': 0.18707055781307722, 'mean_word_length': 4.497969130787977, 'pattern_counts': {'":': 0, '<': 79, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2941656', 'n_tokens_mistral': 8484, 'n_tokens_neox': 6968, 'n_words': 1314}