|
| | TLV320AIC3110 () |
| |
| uint8_t | address () |
| | Provides the actual I2C address of the codec.
|
| |
| bool | begin (uint32_t mclk=12000000, uint32_t sample_rate=44100, uint8_t word_size=16, bool bclk_master=false) |
| |
| bool | begin (uint32_t sample_rate, uint8_t bits) |
| | Initialize the codec: soft reset, configure the PLL/clock dividers for the given MCLK and sample rate, configure the I2S interface, select decimation filters and configure the default output (headphone + speaker) and input (microphone) paths.
|
| |
| bool | begin (uint32_t sample_rate, uint8_t bits, codec_mode_t mode, i2s_format_t fmt, bool is_master, uint8_t channels) override |
| | Initializes the codec.
|
| |
| bool | configureClocks (uint32_t mclk, uint32_t sample_rate, uint8_t word_size, bool bclk_master) |
| | Configure the PLL and the NDAC/MDAC/NADC/MADC/(B)OSR clock dividers for the given MCLK and sample rate, using the same divider table as the Zephyr driver. Also configures the BCLK divider if the codec is the I2S bit clock controller.
|
| |
| bool | configureDai (uint8_t word_size, bool bclk_master, bool wclk_master) |
| | Configure the digital audio interface (I2S) word size and clock direction.
|
| |
| bool | configureFilters (uint32_t sample_rate) |
| | Select the DAC/ADC decimation filter (processing block) based on sample rate.
|
| |
| bool | configureInput () |
| | Configure the microphone input path: power up the ADC, set the microphone bias, unmute the input, set the PGA volume and route both microphone inputs to the PGA.
|
| |
| bool | configureOutput () |
| | Configure the headphone and/or speaker output paths (depending on the output device selected via setDevices()): set common mode voltage, enable click/pop removal, route the DAC to the output mixer, set the default analog volume, unmute and power up the corresponding drivers.
|
| |
| virtual int | getInputVolume () |
| |
| virtual int | getVolume () |
| | Provides the output volume in % (0...100) that was set with setVolume()
|
| |
| i2c_bus_handle_t | getWire () |
| | Provides the actual I2C communication object.
|
| |
| virtual bool | isInputVolumeSupported () |
| | Returns true if the driver supports setting the input volume, false otherwise. By default we return false, but some drivers (e.g. WM8962) override this to return true.
|
| |
| virtual bool | setActive (codec_mode_t mode) |
| |
| void | setAddress (uint8_t addr) |
| | Defines the I2C address of the codec.
|
| |
| bool | setDevices (input_device_t input_device, output_device_t output_device) override |
| | Stores the output device selection for use by configureOutput()
|
| |
| virtual bool | setInputVolume (int volume) |
| |
| bool | setMute (bool mute) override |
| | Mutes/unmutes all outputs.
|
| |
| bool | setOutputMute (bool mute, AIC3110Channel channel=AIC3110Channel::All) |
| | Mute / unmute the headphone and/or speaker driver(s)
|
| |
| bool | setOutputVolume (int vol, AIC3110Channel channel=AIC3110Channel::All) |
| | Set the output (headphone / speaker) volume.
|
| |
| bool | setVolume (int volume) override |
| |
| void | setWire (i2c_bus_handle_t w) |
| | Defines the I2C communication object.
|
| |
| bool | softReset () |
| | Soft reset of the codec.
|
| |
| bool | startOutput () |
| | Power up the DAC channels and unmute them.
|
| |
| bool | stopOutput () |
| | Mute the DAC channels and power them down.
|
| |
|
| static constexpr RegAddr | ADC_PROC_BLK_SEL_ADDR {0, 61} |
| |
| static constexpr RegAddr | AOSR_ADDR {0, 20} |
| |
| static constexpr RegAddr | BCLK_DIV_ADDR {0, 30} |
| |
| static constexpr uint8_t | BCLK_DIV_POWER_UP = (1 << 7) |
| |
| static constexpr uint8_t | BEEP_GEN_EN_BEEP = (1 << 7) |
| |
| static constexpr RegAddr | BEEP_LEN_LSB_ADDR {0, 75} |
| |
| static constexpr RegAddr | BEEP_LEN_MIB_ADDR {0, 74} |
| |
| static constexpr RegAddr | BEEP_LEN_MSB_ADDR {0, 73} |
| |
| static constexpr RegAddr | CLOCK_GEN_MUX_ADDR {0, 4} |
| |
| static constexpr uint8_t | CLOCK_GEN_MUX_DEFAULT = 0x3 |
| |
| static constexpr int | CODEC_OUTPUT_VOLUME_MAX = 0 |
| | Output volume range, in 0.5dB steps (-39dB .. 0dB)
|
| |
| static constexpr int | CODEC_OUTPUT_VOLUME_MIN = (-78 * 2) |
| |
| static constexpr uint8_t | DAC_LR_POWERDN_DEFAULT = (1 << 4) | (1 << 2) |
| |
| static constexpr uint8_t | DAC_LR_POWERUP_DEFAULT |
| |
| static constexpr RegAddr | DAC_PROC_BLK_SEL_ADDR {0, 60} |
| |
| static constexpr RegAddr | DATA_PATH_SETUP_ADDR {0, 63} |
| |
| static constexpr RegAddr | DRC_CTRL1_ADDR {0, 68} |
| |
| static constexpr RegAddr | HEADPHONE_DRV_ADDR {1, 31} |
| |
| static constexpr uint8_t | HEADPHONE_DRV_CM_MASK = (0x3 << 3) |
| |
| static constexpr RegAddr | HEADPHONE_DRV_CTRL_ADDR {1, 44} |
| |
| static constexpr uint8_t | HEADPHONE_DRV_LINEOUT = (1 << 1) | (1 << 2) |
| |
| static constexpr uint8_t | HEADPHONE_DRV_POWERUP = (1 << 7) | (1 << 6) |
| |
| static constexpr uint8_t | HEADPHONE_DRV_RESERVED = (1 << 2) |
| |
| static constexpr RegAddr | HP_OUT_POP_RM_ADDR {1, 33} |
| |
| static constexpr uint8_t | HP_OUT_POP_RM_ENABLE = (1 << 7) |
| |
| static constexpr RegAddr | HPL_ANA_VOL_CTRL_ADDR {1, 36} |
| |
| static constexpr RegAddr | HPL_DRV_GAIN_CTRL_ADDR {1, 40} |
| |
| static constexpr RegAddr | HPR_ANA_VOL_CTRL_ADDR {1, 37} |
| |
| static constexpr RegAddr | HPR_DRV_GAIN_CTRL_ADDR {1, 41} |
| |
| static constexpr uint8_t | HPX_ANA_VOL_DEFAULT = 0 |
| |
| static constexpr uint8_t | HPX_ANA_VOL_ENABLE = (1 << 7) |
| |
| static constexpr uint8_t | HPX_ANA_VOL_FLOOR = 144 |
| |
| static constexpr uint8_t | HPX_ANA_VOL_LOW_THRESH = 105 |
| |
| static constexpr uint8_t | HPX_ANA_VOL_MASK = 0x7F |
| |
| static constexpr uint8_t | HPX_ANA_VOL_MAX = 0 |
| |
| static constexpr uint8_t | HPX_ANA_VOL_MIN = 127 |
| |
| static constexpr uint8_t | HPX_DRV_RESERVED = (1 << 1) |
| |
| static constexpr uint8_t | HPX_DRV_UNMUTE = (1 << 2) |
| |
| static constexpr RegAddr | IF_CTRL1_ADDR {0, 27} |
| |
| static constexpr uint8_t | IF_CTRL_BCLK_OUT = (1 << 3) |
| |
| static constexpr uint8_t | IF_CTRL_DOUT_HIGH_Z = (1 << 0) |
| |
| static constexpr uint8_t | IF_CTRL_IFTYPE_DSP = 1 |
| |
| static constexpr uint8_t | IF_CTRL_IFTYPE_I2S = 0 |
| |
| static constexpr uint8_t | IF_CTRL_IFTYPE_LJF = 3 |
| |
| static constexpr uint8_t | IF_CTRL_IFTYPE_RJF = 2 |
| |
| static constexpr uint8_t | IF_CTRL_WCLK_OUT = (1 << 2) |
| |
| static constexpr uint8_t | IF_CTRL_WLEN_16 = 0 |
| |
| static constexpr uint8_t | IF_CTRL_WLEN_20 = 1 |
| |
| static constexpr uint8_t | IF_CTRL_WLEN_24 = 2 |
| |
| static constexpr uint8_t | IF_CTRL_WLEN_32 = 3 |
| |
| static constexpr RegAddr | L_BEEP_GEN_ADDR {0, 71} |
| |
| static constexpr RegAddr | L_DIG_VOL_CTRL_ADDR {0, 65} |
| |
| static constexpr RegAddr | MADC_DIV_ADDR {0, 19} |
| |
| static constexpr uint8_t | MADC_DIV_MASK = 0x7F |
| |
| static constexpr uint8_t | MADC_POWER_UP = (1 << 7) |
| |
| static constexpr RegAddr | MDAC_DIV_ADDR {0, 12} |
| |
| static constexpr uint8_t | MDAC_DIV_MASK = 0x7F |
| |
| static constexpr uint8_t | MDAC_POWER_UP = (1 << 7) |
| |
| static constexpr RegAddr | MIC_ADC_CTRL_ADDR {0, 81} |
| |
| static constexpr RegAddr | MIC_ADC_FLAG_ADDR {0, 36} |
| |
| static constexpr uint8_t | MIC_ADC_POWERUP = (1 << 7) |
| |
| static constexpr RegAddr | MIC_BIAS_ADDR {1, 46} |
| |
| static constexpr RegAddr | MIC_CCTRL_ADDR {0, 83} |
| |
| static constexpr uint8_t | MIC_CCTRL_DEFAULT = 0x0 |
| |
| static constexpr RegAddr | MIC_FCTRL_ADDR {0, 82} |
| |
| static constexpr uint8_t | MIC_FCTRL_DEFAULT = 0x0 |
| |
| static constexpr RegAddr | MIC_ICM_ADDR {1, 50} |
| |
| static constexpr RegAddr | MIC_PGA_ADDR {1, 47} |
| |
| static constexpr uint8_t | MIC_PGA_VOL_DEFAULT = 0x0 |
| |
| static constexpr RegAddr | MIC_PGAMI_ADDR {1, 49} |
| |
| static constexpr RegAddr | MIC_PGAPI_ADDR {1, 48} |
| |
| static constexpr uint8_t | MIC_PGAPI_L_DEFAULT = (1 << 7) | (1 << 6) |
| |
| static constexpr uint8_t | MIC_PGAPI_R_DEFAULT = (1 << 5) | (1 << 4) |
| |
| static constexpr uint8_t | MICBIAS_DEFAULT = (1 << 3) | (1 << 1) |
| |
| static constexpr RegAddr | NADC_DIV_ADDR {0, 18} |
| |
| static constexpr uint8_t | NADC_DIV_MASK = 0x7F |
| |
| static constexpr uint8_t | NADC_POWER_UP = (1 << 7) |
| |
| static constexpr RegAddr | NDAC_DIV_ADDR {0, 11} |
| |
| static constexpr uint8_t | NDAC_DIV_MASK = 0x7F |
| |
| static constexpr uint8_t | NDAC_POWER_UP = (1 << 7) |
| |
| static constexpr RegAddr | OSR_LSB_ADDR {0, 14} |
| |
| static constexpr uint8_t | OSR_LSB_MASK = 0xFF |
| |
| static constexpr RegAddr | OSR_MSB_ADDR {0, 13} |
| |
| static constexpr uint8_t | OSR_MSB_MASK = 0x3 |
| |
| static constexpr RegAddr | OUTPUT_ROUTING_ADDR {1, 35} |
| |
| static constexpr uint8_t | OUTPUT_ROUTING_HPL = (1 << 7) |
| |
| static constexpr uint8_t | OUTPUT_ROUTING_HPR = (1 << 3) |
| |
| static constexpr uint8_t | OUTPUT_ROUTING_MIXER = (1 << 6) | (1 << 2) |
| |
| static constexpr RegAddr | OVF_FLAG_ADDR {0, 39} |
| |
| static constexpr RegAddr | PLL_D_LSB_ADDR {0, 8} |
| |
| static constexpr RegAddr | PLL_D_MSB_ADDR {0, 7} |
| |
| static constexpr RegAddr | PLL_J_ADDR {0, 6} |
| |
| static constexpr uint8_t | PLL_P_MASK = 0x7 |
| |
| static constexpr RegAddr | PLL_P_R_ADDR {0, 5} |
| |
| static constexpr uint8_t | PLL_POWER_UP = (1 << 7) |
| |
| static constexpr uint8_t | PLL_R_MASK = 0xF |
| |
| static constexpr RegAddr | R_BEEP_GEN_ADDR {0, 72} |
| |
| static constexpr RegAddr | SOFT_RESET_ADDR {0, 1} |
| |
| static constexpr uint8_t | SOFT_RESET_ASSERT = 1 |
| |
| static constexpr RegAddr | SPEAKER_DRV_ADDR {1, 32} |
| |
| static constexpr uint8_t | SPEAKER_DRV_POWERUP = (1 << 7) | (1 << 6) |
| |
| static constexpr uint8_t | SPEAKER_DRV_RESERVED = (1 << 2) | (1 << 1) |
| |
| static constexpr RegAddr | SPL_ANA_VOL_CTRL_ADDR {1, 38} |
| |
| static constexpr RegAddr | SPL_DRV_GAIN_CTRL_ADDR {1, 42} |
| |
| static constexpr RegAddr | SPR_ANA_VOL_CTRL_ADDR {1, 39} |
| |
| static constexpr RegAddr | SPR_DRV_GAIN_CTRL_ADDR {1, 43} |
| |
| static constexpr uint8_t | SPX_ANA_VOL_DEFAULT = 0 |
| |
| static constexpr uint8_t | SPX_ANA_VOL_ENABLE = (1 << 7) |
| |
| static constexpr uint8_t | SPX_ANA_VOL_FLOOR = 144 |
| |
| static constexpr uint8_t | SPX_ANA_VOL_LOW_THRESH = 105 |
| |
| static constexpr uint8_t | SPX_ANA_VOL_MASK = 0x7F |
| |
| static constexpr uint8_t | SPX_DRV_RESERVED = (1 << 1) |
| |
| static constexpr uint8_t | SPX_DRV_UNMUTE = (1 << 2) |
| |
| static constexpr RegAddr | TIMER_MCLK_DIV_ADDR {3, 16} |
| |
| static constexpr uint8_t | TIMER_MCLK_DIV_EN_EXT = (1 << 7) |
| |
| static constexpr uint8_t | TIMER_MCLK_DIV_MASK = 0x7F |
| |
| static constexpr RegAddr | VOL_CTRL_ADDR {0, 64} |
| |
| static constexpr uint8_t | VOL_CTRL_MUTE_DEFAULT = (1 << 3) | (1 << 2) |
| |
| static constexpr uint8_t | VOL_CTRL_UNMUTE_DEFAULT = 0 |
| |
|
| bool | readPagedReg (RegAddr reg, uint8_t &value) |
| | Reads a register on the given page.
|
| |
| bool | readReg (uint8_t reg, uint8_t &value) |
| | Reads a single byte from an 8 bit register address.
|
| |
| bool | readReg16 (uint8_t reg, uint16_t &value) |
| | Reads a 16 bit (big endian) value from an 8 bit register address.
|
| |
| bool | selectPage (uint8_t page) |
| | Selects the active register page (writes register 0 of page 0)
|
| |
| bool | updatePagedReg (RegAddr reg, uint8_t mask, uint8_t value) |
| | Read-Modify-Write of a register on the given page.
|
| |
| bool | updateReg (uint8_t reg, uint8_t mask, uint8_t value) |
| | Read-Modify-Write of a single byte register.
|
| |
| bool | updateReg16 (uint8_t reg, uint16_t mask, uint16_t value) |
| | Read-Modify-Write of a 16 bit (big endian) register.
|
| |
| bool | writePagedReg (RegAddr reg, uint8_t value) |
| | Writes a register on the given page.
|
| |
| bool | writeReg (uint8_t reg, uint8_t value) |
| | Writes a single byte to an 8 bit register address.
|
| |
| bool | writeReg16 (uint8_t reg, uint16_t value) |
| | Writes a 16 bit (big endian) value to an 8 bit register address.
|
| |
Header only C++ driver for the TLV320AIC3110 audio codec.
The TLV320AIC3110 uses a paged 8 bit register map (page select register at page 0 / register 0). Provides soft reset, PLL/clock configuration (based on a fixed MCLK/sample-rate divider table), DAI (I2S) format configuration, decimation filter selection and output/input path configuration including volume and mute control.