This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] PCMD3180: Is there a Linux Driver for the PCMD3180 devices?

Part Number: PCMD3180

Hello,

Is there a publicly available Linux driver for the PCMD3180 devices?

  • Hello,

    The PCMD3180 Linux driver is shared with the TLV320ADCx140 driver and is upstreamed at the Linux kernel website:

    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/sound/soc/codecs/tlv320adcx140.c?h=v5.9.6

    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/sound/soc/codecs/tlv320adcx140.h?h=v5.9.6

     You can find the documentation for the device tree is at:

    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/sound/tlv320adcx140.yaml

    There were a few patches applied to the upstream, so make sure to download the patches and apply them.

     

    For PCMD3180, you will need to setup some registers to map the PDM inputs and PDM clocks to pin in the DTS:

    ti,mic-bias-source  => If not present, sets 0x75 ADCX140_PWR_CFG to 0x60, MICBIAS_PDZ bitfield

    Sets MicBias source, not used in your application

    ti,pdm-edge-select = <1 1 0 0>;  => 0x20 ADCX140_PDM_CFG Register

    Sets the PDMCLK edge to latch the data. 

    ti,gpi-config = <4 5 0 0 >;           => 0x2B ADCX140_GPIO_CFG0  and 0x2C ADCX140_GPI_CFG1 Registers

    Sets the GPI input for a channel

    ti,gpo-config-1 = <4 1>;              => 0x22 ADCX140_GPO_CFG0 Register 

    Sets the PDM Clock output

    ti,slot-mapping = <0 1 2 3>;              => 0x0B ADCX140_ASI_CH1, 0x0C ADCX140_ASI_CH2, 0x0D ADCX140_ASI_CH3, and 0x0E ADCX140_ASI_CH4

    Maps the TDM bus slot to a channel

    ti,asi-tx-drive = <1>;              => 0x07 ADCX140_ASI_CFG0, TX_FILL

    Setting to one tri-states the TDM bus when PCMD3180 is not driving it.

     

    Some other PCMD3180 setup is performed through alsamixer commands. For example, alsamixer commands set the following registers

    ## CHx_ASI_EN to On

    amixer cset numid=29,iface=MIXER,name='CH1_ASI_EN Switch’ On

    amixer cset numid=30,iface=MIXER,name='CH2_ASI_EN Switch' On

    amixer cset numid=31,iface=MIXER,name='CH3_ASI_EN Switch' On   => 0x74, ADCX140_ASI_OUT_CH_EN, determines which channels are enabled

     

    ## MICxM Input Mux to Digital

    amixer cset numid=25,iface=MIXER,name='MIC1M Input Mux’ 2      => 0x3C, ADCX140_CH1_CFG0, sets the channel 1 to a digital microphone input

    amixer cset numid=26,iface=MIXER,name='MIC2M Input Mux' 2      => 0x41, ADCX140_CH2_CFG0, sets the channel 2 to a digital microphone input

    amixer cset numid=27,iface=MIXER,name='MIC3M Input Mux' 2      => 0x46, ADCX140_CH3_CFG0, sets the channel 3 to a digital microphone input

     

    ## PDM CLk Div Select to 2.8224MHz

    amixer cset numid=46,iface=MIXER,name='PDM Clk Div Select’ 0     => 0x1F, PDMCLK_CFG, sets the clock rate for the PDM clock output