#error "Need set correct PLL multiplier for aic3204"
#endif
// Configure ADC clock
// PLL_CLK
// ADC_fs = --------------------
// NADC * MADC * AOSR
#if AUDIO_ADC_FREQ == 48000
// Clock config, default fs=48kHz
// from PLL 86.016MHz/(2*7*128) = 48kHz
0x0b,0x82,// Power up the NDAC divider with value 2
0x0c,0x87,// Power up the MDAC divider with value 7
0x0d,0x00,// DAC OSR Setting Register 1 (MSB) Program the OSR of DAC to 128
0x0e,0x80,// DAC OSR Setting Register 2 (LSB)
0x3c,0x01,// Set the DAC Mode to PRB_P1
0x25,0x00,// DAC power down
0x12,0x82,// Power up the NADC divider with value 2
0x13,0x87,// Power up the MADC divider with value 7
0x14,0x80,// ADC Oversampling (AOSR) Program the OSR of ADC to 128
0x3d,0x01,// Select ADC PRB_R1
0x24,0xee,// ADC power up
0x1b,0x0c,// Set the BCLK,WCLK as output
0x1e,0x80+28,// Enable the BCLKN divider with value 28 (I2S clock = 86.016MHz/(NDAC*28) = 48kHz * (16+16)
#elif AUDIO_ADC_FREQ == 96000
// Clock config, default fs=96kHz
// from PLL 86.016MHz/(2*7*64) = 96kHz
0x0b,0x82,// Power up the NDAC divider with value 2
0x0c,0x87,// Power up the MDAC divider with value 7
0x0d,0x00,// DAC OSR Setting Register 1 (MSB) Program the OSR of DAC to 64
0x0e,0x40,// DAC OSR Setting Register 2 (LSB)
0x3c,0x01,// Set the DAC Mode to PRB_P1
0x25,0x00,// DAC power up
0x12,0x82,// Power up the NADC divider with value 2
0x13,0x87,// Power up the MADC divider with value 7
0x14,0x40,// ADC Oversampling (AOSR) set OSR of ADC to 64
0x3d,0x01,// Select ADC PRB_R1 (AOSR = 64 (Use with PRB_R1 to PRB_R12, ADC Filter Type A or B))
0x24,0xee,// ADC power up
0x1b,0x0c,// Set the BCLK,WCLK as output
0x1e,0x80+14,// Enable the BCLKN divider with value 14 (I2S clock = 86.016MHz/(NDAC*14) = 96kHz * (16+16)
#else
#error "Need set correct ADC clock for aic3204"
#endif
// Clock config, default fs=48kHz
0x0b,0x82,/* Power up the NDAC divider with value 2 */
0x0c,0x87,/* Power up the MDAC divider with value 7 */
0x0d,0x00,/* Program the OSR of DAC to 128 */
0x0e,0x80,
0x3c,0x08,/* Set the DAC Mode to PRB_P8 */
//0x3c, 25, /* Set the DAC Mode to PRB_P25 */
0x1b,0x0c,/* Set the BCLK,WCLK as output */
0x1e,0x80+28,/* Enable the BCLKN divider with value 28 */
0x25,0xee,/* DAC power up */
0x12,0x82,/* Power up the NADC divider with value 2 */
0x13,0x87,/* Power up the MADC divider with value 7 */
0x14,0x80,/* Program the OSR of ADC to 128 */
0x3d,0x01,/* Select ADC PRB_R1 */
// Data routing
0x00,0x01,/* Select Page 1 */
0x01,0x08,/* Disable Internal Crude AVdd in presence of external AVdd supply or before powering up internal AVdd LDO*/
0x02,0x01,/* Enable Master Analog Power Control */
0x7b,0x01,/* Set the REF charging time to 40ms */
0x14,0x25,/* HP soft stepping settings for optimal pop performance at power up Rpop used is 6k with N = 6 and soft step = 20usec. This should work with 47uF coupling capacitor. Can try N=5,6 or 7 time constants as well. Trade-off delay vs “pop” sound. */
0x0a,0x33,/* Set the Input Common Mode to 0.9V and Output Common Mode for Headphone to 1.65V */
0x3d,0x00,/* Select ADC PTM_R4 */
0x47,0x32,/* Set MicPGA startup delay to 6.4ms */
0x7b,0x01,/* Set the REF charging time to 40ms */
0x34,REG_34_IN2L_TO_LEFT_P_10k,/* Route IN2L to LEFT_P with 10K */
0x36,REG_36_IN2R_TO_LEFT_N_10k,/* Route IN2R to LEFT_N with 10K */
//0x37, 0x04, /* Route IN3R to RIGHT_P with 10K */
//0x39, 0x04, /* Route IN3L to RIGHT_N with 10K */
//0x3b, 0x00, /* Unmute Left MICPGA, Gain selection of 32dB to make channel gain 0dB */
//0x3c, 0x00, /* Unmute Right MICPGA, Gain selection of 32dB to make channel gain 0dB */
0x00,0x01,// Select Page 1 */
0x01,0x08,// Disable Internal Crude AVdd in presence of external AVdd supply or before powering up internal AVdd LDO*/
0x02,0x01,// Enable Master Analog Power Control
0x7b,0x01,// Set the REF charging time to 40ms
0x14,0x25,// HP soft stepping settings for optimal pop performance at power up Rpop used is 6k with N = 6 and soft step = 20usec. This should work with 47uF coupling capacitor. Can try N=5,6 or 7 time constants as well. Trade-off delay vs “pop” sound.
0x0a,0x33,// Set the Input Common Mode to 0.9V and Output Common Mode for Headphone to 1.65V
0x3d,0x00,// Select ADC PTM_R4 */
// 0x3d, 0xB6, // Select ADC PTM_R2 */
0x47,0x32,// Set MicPGA startup delay to 6.4ms
0x7b,0x01,// Set the REF charging time to 40ms
0x34,REG_34_IN2L_TO_LEFT_P_10k,// Route IN2L to LEFT_P with 10K
0x36,REG_36_IN2R_TO_LEFT_N_10k,// Route IN2R to LEFT_N with 10K
//0x37, 0x04, // Route IN3R to RIGHT_P with 10K
//0x39, 0x04, // Route IN3L to RIGHT_N with 10K
//0x3b, 0x00, // Unmute Left MICPGA, Gain selection of 32dB to make channel gain 0dB
//0x3c, 0x00, // Unmute Right MICPGA, Gain selection of 32dB to make channel gain 0dB
};
staticconstuint8_tconf_data_unmute[]={
// reg, data,
0x00,0x00,/* Select Page 0 */
0x51,0xc0,/* Power up Left and Right ADC Channels */
0x52,0x00,/* Unmute Left and Right ADC Digital Volume Control */
0x00,0x00,// Select Page 0
0x51,0xc0,// Power up Left and Right ADC Channels
0x52,0x00,// Unmute Left and Right ADC Digital Volume Control
0x00,0x01,// Select Page 1 (should be set as default)
};
staticconstuint8_tconf_data_ch3_select[]={
// reg, data,
0x00,0x01,/* Select Page 1 */
0x37,REG_37_IN3R_TO_RIGHT_P_10k,/* Route IN3R to RIGHT_P with input impedance of 10K */
0x39,REG_39_IN3L_TO_RIGHT_N_10k,/* Route IN3L to RIGHT_N with input impedance of 10K */
//0x00, 0x01, // Select Page 1 (should be set as default)
0x37,REG_37_IN3R_TO_RIGHT_P_10k,// Route IN3R to RIGHT_P with input impedance of 10K
/*0x38,*/0x00,// Reserved
/*0x39,*/REG_39_IN3L_TO_RIGHT_N_10k,// Route IN3L to RIGHT_N with input impedance of 10K
};
staticconstuint8_tconf_data_ch1_select[]={
// reg, data,
0x00,0x01,/* Select Page 1 */
0x37,REG_37_IN1R_TO_RIGHT_P_10k,/* Route IN1R to RIGHT_P with input impedance of 10K */
0x39,REG_39_IN1L_TO_RIGHT_N_10k,/* Route IN1L to RIGHT_N with input impedance of 10K */
//0x00, 0x01, // Select Page 1 (should be set as default)
0x37,REG_37_IN1R_TO_RIGHT_P_10k,// Route IN1R to RIGHT_P with input impedance of 10K
/*0x38,*/0x00,// Reserved
/*0x39,*/REG_39_IN1L_TO_RIGHT_N_10k,// Route IN1L to RIGHT_N with input impedance of 10K