yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ES8374.h -- ES8374 ALSA SoC Audio Codec |
| 3 | * |
| 4 | * |
| 5 | * |
| 6 | * Authors: |
| 7 | * |
| 8 | * Based on ES8374.h by David Yang |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | |
| 15 | #ifndef _ES8374_H |
| 16 | #define _ES8374_H |
| 17 | |
| 18 | /* THE REGISTER DEFINITION FORMAT */ |
| 19 | /* |
| 20 | * ES8374_REGISTER NAME_REG_REGISTER ADDRESS |
| 21 | */ |
| 22 | #define ES8374_RESET_REG00 0x00 /* this register is used to reset digital,csm,clock manager etc.*/ |
| 23 | |
| 24 | /* |
| 25 | * Clock Scheme Register definition |
| 26 | */ |
| 27 | #define ES8374_CLK_MANAGEMENT_REG01 0x01 /* The register is used to turn on/off the clock for ADC, DAC, MCLK, BCLK and CLASS D */ |
| 28 | #define ES8374_CLK_MANAGEMENT_REG02 0x02 /* ADC, PLL clock */ |
| 29 | |
| 30 | |
| 31 | #define ES8374_ADC_OSR_REG03 0x03 /* The ADC OSR setting */ |
| 32 | #define ES8374_DAC_FLT_CNT_REG04 0x04 /* The DAC filter counter waiting cycles control */ |
| 33 | #define ES8374_CLK_DIV_REG05 0x05 /* ADC&DAC internal mclk Divider */ |
| 34 | #define ES8374_LRCK_DIV_REG06 0x06 /* The LRCK divider */ |
| 35 | #define ES8374_LRCK_DIV_REG07 0x07 |
| 36 | #define ES8374_CLASS_D_DIV_REG08 0x08 /* Class D clock divider */ |
| 37 | /* |
| 38 | * PLL control register definition |
| 39 | */ |
| 40 | #define ES8374_PLL_CONTROL1_REG09 0x09 /* Register 0x09 for PLL reset, power up/down, dither and divider settting */ |
| 41 | #define ES8374_PLL_CONTROL2_REG0A 0x0A /* Register 0x0A for PLL low power, gain, supply voltage and vco setting */ |
| 42 | #define ES8374_PLL_N_REG0B 0x0B /* Register 0x0B for N and pll calibrate */ |
| 43 | #define ES8374_PLL_K_REG0C 0x0C /* Register 0x0C - 0x0E for PLLK */ |
| 44 | #define ES8374_PLL_K_REG0D 0x0D |
| 45 | #define ES8374_PLL_K_REG0E 0x0E |
| 46 | /* |
| 47 | * The serial digital audio port |
| 48 | */ |
| 49 | #define ES8374_MS_BCKDIV_REG0F 0x0F /* The setting for Master/Slave mode and BCLK divider */ |
| 50 | #define ES8374_ADC_FMT_REG10 0x10 /* ADC Format */ |
| 51 | #define ES8374_DAC_FMT_REG11 0x11 /* DAC Format */ |
| 52 | |
| 53 | /* |
| 54 | * The system Control |
| 55 | */ |
| 56 | #define ES8374_CHP_INI_REG12 0x12 /* The time control for chip initialization */ |
| 57 | #define ES8374_POWERUP_REG13 0x13 /* The time control for power up */ |
| 58 | /* |
| 59 | * The analog control |
| 60 | */ |
| 61 | #define ES8374_ANA_REF_REG14 0x14 /* The analog reference */ |
| 62 | #define ES8374_ANA_PWR_CTL_REG15 0x15 /* The analog power up/down */ |
| 63 | #define ES8374_ANA_LOW_PWR_REG16 0x16 /* Low power setting*/ |
| 64 | #define ES8374_ANA_REF_LP_REG17 0x17 /* Reference and low power setting */ |
| 65 | #define ES8374_ANA_BIAS_REG18 0x18 /* Bias selecting */ |
| 66 | /* |
| 67 | * MONO OUT |
| 68 | */ |
| 69 | #define ES8374_MONO_MIX_REG1A 0x1A /* MonoMixer */ |
| 70 | #define ES8374_MONO_GAIN_REG1B 0x1B /* Mono Out Gain */ |
| 71 | /* |
| 72 | * SPEAKER OUT |
| 73 | */ |
| 74 | #define ES8374_SPK_MIX_REG1C 0x1C /* Speaker Mixer */ |
| 75 | #define ES8374_SPK_MIX_GAIN_REG1D 0x1D /* Speaker Mixer Gain */ |
| 76 | #define ES8374_SPK_OUT_GAIN_REG1E 0x1E /* Speaker Output Gain */ |
| 77 | #define ES8374_SPK_CTL_REG1F 0x1F /* Speaker control */ |
| 78 | #define ES8374_SPK_CTL_REG20 0x20 /* Speaker control */ |
| 79 | /* |
| 80 | * Analog In |
| 81 | */ |
| 82 | #define ES8374_AIN_PWR_SRC_REG21 0x21 /* Power control and source selecting for AIN*/ |
| 83 | #define ES8374_AIN_PGA_REG22 0x22 /* AIN PGA Gain Control */ |
| 84 | /* |
| 85 | * ADC Control |
| 86 | */ |
| 87 | #define ES8374_ADC_CONTROL_REG24 0x24 /* adc and DMIC Setting */ |
| 88 | #define ES8374_ADC_VOLUME_REG25 0x25 /* adc volume */ |
| 89 | /* |
| 90 | * ADC ALC |
| 91 | */ |
| 92 | #define ES8374_ALC_EN_MAX_GAIN_REG26 0x26 /* adc alc enable and max gain setting */ |
| 93 | #define ES8374_ALC_MIN_GAIN_REG27 0x27 /* ADC Alc min gain */ |
| 94 | #define ES8374_ALC_LVL_HLD_REG28 0x28 /* alc level and hold time control */ |
| 95 | #define ES8374_ALC_DCY_ATK_REG29 0x29 /* ALC DCY and ATK time control */ |
| 96 | #define ES8374_ALC_WIN_SIZE_REG2A 0x2A /* ALC WIN Size */ |
| 97 | #define ES8374_ALC_NGTH_REG2B 0x2B /* alc noise gate setting */ |
| 98 | /* |
| 99 | * ADC HPF setting |
| 100 | */ |
| 101 | #define ES8374_ADC_HPF_REG2C 0x2C /* The high pass filter coefficient*/ |
| 102 | /* |
| 103 | * Equalizer SRC setting |
| 104 | */ |
| 105 | #define ES8374_EQ_SRC_REG2D 0x2D /* adc src, dac src and EQ SRC setting */ |
| 106 | |
| 107 | /* |
| 108 | * ADC 1st shelving filter |
| 109 | */ |
| 110 | #define ES8374_ADC_SHV_A_REG2E 0x2E /* adc shelving A*/ |
| 111 | #define ES8374_ADC_SHV_A_REG2F 0x2F |
| 112 | #define ES8374_ADC_SHV_A_REG30 0x30 |
| 113 | #define ES8374_ADC_SHV_A_REG31 0x31 |
| 114 | |
| 115 | #define ES8374_ADC_SHV_B_REG32 0x32 /* ADC Shelving B*/ |
| 116 | #define ES8374_ADC_SHV_B_REG33 0x33 |
| 117 | #define ES8374_ADC_SHV_B_REG34 0x34 |
| 118 | #define ES8374_ADC_SHV_B_REG35 0x35 |
| 119 | |
| 120 | /* |
| 121 | * DAC control |
| 122 | */ |
| 123 | #define ES8374_DAC_CONTROL_REG36 0x36 /* dac control1 */ |
| 124 | #define ES8374_DAC_CONTROL_REG37 0x37 /* dac control2 */ |
| 125 | |
| 126 | #define ES8374_DAC_VOLUME_REG38 0x38 /* dac volume */ |
| 127 | #define ES8374_DAC_OFFSET_REG39 0x39 /* DAC offset */ |
| 128 | |
| 129 | /* |
| 130 | * DAC 2nd shleving filter |
| 131 | */ |
| 132 | /* register 0x3A to 0x44 is for dac shelving filter */ |
| 133 | /* |
| 134 | * Equalizer coeffient |
| 135 | */ |
| 136 | /* register 0x45 to 0x6c is for 2nd equalizer filter, this filter can be shared by DAC and ADC */ |
| 137 | |
| 138 | #define ES8374_GPIO_INSERT_REG6D 0x6D /* GPIO & HP INSERT CONTROL */ |
| 139 | #define ES8374_FLAG_REG6E 0x6E /* Flag register */ |
| 140 | |
| 141 | /* The End Of Register definition */ |
| 142 | |
| 143 | #define ES8374_PLL 1 |
| 144 | #define ES8374_PLL_SRC_FRM_MCLK 1 |
| 145 | |
| 146 | #define ES8374_CLKID_MCLK 0 |
| 147 | #define ES8374_CLKID_PLLO 1 |
| 148 | #define ES8374_CLKID ES8374_CLKID_MCLK |
| 149 | |
| 150 | #define ES8374_MAX_REGISTER 128 |
| 151 | |
| 152 | #endif |