TLV320AIC3105: TLV320AIC3105 MIC issue

Part Number: TLV320AIC3105

Hi,

We have an tlv320aic3105 audio cape and have BeagleBone Green as host, mcasp0 is configured for i2S. Playback is working, but Capture doesn't save any voice data. I run the command

arecord -vv -f dat /dev/null

and get the error message

arecord: pcm_read:2031: read error: Input/output error

(the screenshot is attached below)

In this test, LINE1L is used fro MIC input.

To support tlv320aic3105 audio codec, I change and build device tree am335x-bonegreen.dtb with ti-processor-sdk-linux-am335x-evm-03.02.00.05, CODEC driver is tlv320aic3x. 

I don't know what is the cause of this error, Below are some questions I can think of:

  1. Does tlv320aic3x fully support tlv320aic3105 or need some changes?
  2. Is audio-routing wrong? Below is audio-routing for MIC:

ti,audio-routing =

                        "Headphone Jack",     "HPLOUT",

                        "Headphone Jack",       "HPROUT",

                        "LINE1L",        "Line In";

3. Any other cause?

Thanks for your help,

Bruce

/////////////////////////////////////////////

root@beaglebone:~# arecord -vv -f dat /dev/null

Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo

Plug PCM: Hardware PCM card 0 'DA830 EVM' device 0 subdevice 0

Its setup is:

  stream       : CAPTURE

  access       : RW_INTERLEAVED

  format       : S16_LE

  subformat    : STD

  channels     : 2

  rate         : 48000

  exact rate   : 48000 (48000/1)

  msbits       : 16

  buffer_size  : 24000

  period_size  : 6000

  period_time  : 125000

  tstamp_mode  : NONE

  period_step  : 1

  avail_min    : 6000

  period_event : 0

  start_threshold  : 1

  stop_threshold   : 24000

  silence_threshold: 0

  silence_size : 0

  boundary     : 1572864000

  appl_ptr     : 0

  hw_ptr       : 0

arecord: pcm_read:2031: read error: Input/output error

//////////////////////////////////////////////////////////////////////

19 Replies

  • Hi, Bruce,

    Unfortunately, we don't support this kind of commands or beaglebone drivers. However, is it possible to provide a register map of the audio codec? This will be really useful to understand the root cause. Any schematic or additional information will be also useful.

    Thank you.

    Best regards,
    Luis Fernando Rodríguez S.
  • In reply to Luis Fernando Rodríguez S.:

    Hi Luis,

    Thanks for your quick response.

    I don’t directly configure the codec registers; instead, I use alsamixer to configure audio device. Here is the register map from the driver file tlv320aic3x.c, I believe that kernel uses this map as default configuration.

    static const struct reg_default aic3x_reg[] = {

            {   0, 0x00 }, {   1, 0x00 }, {   2, 0x00 }, {   3, 0x10 },

            {   4, 0x04 }, {   5, 0x00 }, {   6, 0x00 }, {   7, 0x00 },

            {   8, 0x00 }, {   9, 0x00 }, {  10, 0x00 }, {  11, 0x01 },

            {  12, 0x00 }, {  13, 0x00 }, {  14, 0x00 }, {  15, 0x80 },

            {  16, 0x80 }, {  17, 0xff }, {  18, 0xff }, {  19, 0x78 },

            {  20, 0x78 }, {  21, 0x78 }, {  22, 0x78 }, {  23, 0x78 },

            {  24, 0x78 }, {  25, 0x00 }, {  26, 0x00 }, {  27, 0xfe },

            {  28, 0x00 }, {  29, 0x00 }, {  30, 0xfe }, {  31, 0x00 },

            {  32, 0x18 }, {  33, 0x18 }, {  34, 0x00 }, {  35, 0x00 },

            {  36, 0x00 }, {  37, 0x00 }, {  38, 0x00 }, {  39, 0x00 },

            {  40, 0x00 }, {  41, 0x00 }, {  42, 0x00 }, {  43, 0x80 },

            {  44, 0x80 }, {  45, 0x00 }, {  46, 0x00 }, {  47, 0x00 },

            {  48, 0x00 }, {  49, 0x00 }, {  50, 0x00 }, {  51, 0x04 },

            {  52, 0x00 }, {  53, 0x00 }, {  54, 0x00 }, {  55, 0x00 },

            {  56, 0x00 }, {  57, 0x00 }, {  58, 0x04 }, {  59, 0x00 },

            {  60, 0x00 }, {  61, 0x00 }, {  62, 0x00 }, {  63, 0x00 },

            {  64, 0x00 }, {  65, 0x04 }, {  66, 0x00 }, {  67, 0x00 },

            {  68, 0x00 }, {  69, 0x00 }, {  70, 0x00 }, {  71, 0x00 },

            {  72, 0x04 }, {  73, 0x00 }, {  74, 0x00 }, {  75, 0x00 },

            {  76, 0x00 }, {  77, 0x00 }, {  78, 0x00 }, {  79, 0x00 },

            {  80, 0x00 }, {  81, 0x00 }, {  82, 0x00 }, {  83, 0x00 },

            {  84, 0x00 }, {  85, 0x00 }, {  86, 0x00 }, {  87, 0x00 },

            {  88, 0x00 }, {  89, 0x00 }, {  90, 0x00 }, {  91, 0x00 },

            {  92, 0x00 }, {  93, 0x00 }, {  94, 0x00 }, {  95, 0x00 },

            {  96, 0x00 }, {  97, 0x00 }, {  98, 0x00 }, {  99, 0x00 },

            { 100, 0x00 }, { 101, 0x00 }, { 102, 0x02 }, { 103, 0x00 },

            { 104, 0x00 }, { 105, 0x00 }, { 106, 0x00 }, { 107, 0x00 },

            { 108, 0x00 }, { 109, 0x00 },

    };

    I am not sure if the driver tlv320aic3x.c fully supports tlv320aic3105, for instance, support recording.

     

    Regards,

    Bruce

  • In reply to Bruce Gao:

    Hi, Bruce,

    The registers configuration that you shared is the default state of the TLV320AIC3105. This means that the audio codec is not being configured.

    In order to enable the recording function, you need at least to configure page 0 / registers 15 - 25. Registers 17-24 are configured to select the analog input where the sound will be recorded. Registers 15-16 are used to configure the PGA. Registers 19, 22 are used to enable the ADC. And register 25 is used to configure the MICBIAS (if it is required).

    Please configure all these registers according to your needs and let me know if you require additional assistance.

    Best regards,
    Luis Fernando Rodríguez S.
  • In reply to Luis Fernando Rodríguez S.:

    Hi Luis,

     

    In our application, MIC1L/LINE1L is the input connected to left PGA and left ADC, the register 15 and register 19 of the page 0 need to be configured. When the codec tlv320aic3105 is brought up, these two registers are set from TI driver aic3x_init() as following:

    Register

    value

    Page 0/register 15

    0x20

    Page 0/register 19

    0x0

     

    After the codec is up running, I run alsamixer to configure PGA Capture, below is the copy of ADC config changes:

            control.44 {

                    iface MIXER

                    name 'PGA Capture Volume'

                    value.0 119

                    value.1 119

                    comment {

                            access 'read write'

                            type INTEGER

                            count 2

                            range '0 - 119'

                            dbmin 0

                            dbmax 5950

                            dbvalue.0 5950

                            dbvalue.1 5950

                    }

            }

            control.45 {

                    iface MIXER

                    name 'PGA Capture Switch'

                    value.0 true

                    value.1 true

                    comment {

                            access 'read write'

                            type BOOLEAN

                            count 2

                    }

            }

    However, when I run the capture, I see the error

    arecord: pcm_read:2031: read error: Input/output error

    I don't know what causes this error.

    I also compare tlv320aic3105 register map, the register 73-79 of page 0 in tlv320aic3105 are reserved,  not sure if writing the values to these registers has any impact, which is done in aic3x_init().

    Best regards,

    Bruce

  • In reply to Bruce Gao:

    Hi, Bruce,

    Could you verify if there's any data at DOUT pin when the configuration is completed? Additionally, it seems that the ADC is disabled. Page 0 / Register 19 / Bit D2 needs to be configured as '1' to enable the ADC. So, the correct register value would be 0x04.

    Best regards,
    Luis Fernando Rodríguez S.
  • In reply to Luis Fernando Rodríguez S.:

    Hi Luis,

    We see the data at DOUT pin when we run the capture and get the error. It makes me confused: how does the ADC have output data if the ADC is disabled?

    Best regards,
    Bruce
  • In reply to Bruce Gao:

    Hi, Bruce,

    There are two registers that enable the ADC:

    - Page 0 / Register 19. Bit D2 configures the left ADC.
    - Page 0 / Register 22. Bit D2 configures the right ADC.

    Probably only one of these registers is being configured. So, you would need to configure both registers to fully enable the ADC channels.

    Best regards,
    Luis Fernando Rodríguez S.
  • In reply to Luis Fernando Rodríguez S.:

    Hi Luis,

    Thanks for your help, I will try.

    Best regards,

    Bruce

  • In reply to Bruce Gao:

    Hi Luis,

    Tlv320aic3105 capture is still not working, it hangs when running capturing. We checked that Page 0/ Register 19 and Register 22, Bit D2 is 1 when doing recording, the values of Page 0 /Register 15 and 16 are 0x77.

    We made some changes on da830_evm_dai  and evm_dai_tlv320aic3x  in davinci-evm.c,

    1. change .cpu_dai_name and .platform_name from "davinci-mcasp.1" to  "davinci-mcasp.0" to support both playback and capture;
    2. change .dai_fmt to I2S.

    tlv320aic3105 provides bit clock and frame clock.

    Below are changes:

    static struct snd_soc_dai_link da830_evm_dai = {

            .name = "TLV320AIC3X",

            .stream_name = "AIC3X",

            .cpu_dai_name = "davinci-mcasp.0",

            .codec_dai_name = "tlv320aic3x-hifi",

            .codec_name = "tlv320aic3x-codec.1-0018",

            .platform_name = "davinci-mcasp.0",

            .init = evm_aic3x_init,

            .ops = &evm_ops,

            .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |

                       SND_SOC_DAIFMT_NB_NF,

    };

    ……

    static struct snd_soc_dai_link evm_dai_tlv320aic3x = {

            .name           = "TLV320AIC3X",

            .stream_name    = "AIC3X",

            .codec_dai_name = "tlv320aic3x-hifi",

            .ops            = &evm_ops,

            .init           = evm_aic3x_init,

            .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM |

                       SND_SOC_DAIFMT_NB_NF,

    };

    I am not sure if these changes are correct or I need to make some other changes as well.

     

    Best regards,

    Bruce

  • In reply to Bruce Gao:

    Hi, Bruce,

    Do you have the modified registers configuration? I mean, do the registers change with these changes on your code. I apologize, we don't support this kind of drivers.

    Best regards,
    Luis Fernando Rodríguez S.