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.

how to set McAsp properly for I2S and dummy hdmi codec driver

Greetings,

We are having a hard time to make McAsp working properly to capture the audio from a ITE HDMI receiver.
We first create a dummy hdmi-driver, which we believe has hooked with mcasp correctly, cuz when inserting it I will get
"asoc: HDMI-DAI-CODEC <-> davinci-mcasp.2 mapping ok" message.
here is the dummy driver:

static struct snd_soc_codec_driver soc_codec_hdmi;

/* Dummy dai driver for HDMI */
static struct snd_soc_dai_driver ti81xx_dai = {
    .name = "HDMI-DAI-CODEC",
    .playback = {
        .stream_name = "Playback",
        .channels_min = 2,
        .channels_max = 2,
        .rates = SNDRV_PCM_RATE_48000,
        .formats =SNDRV_PCM_FMTBIT_S32_LE ,
    },
    .capture = {
        .stream_name = "Capture",
        .channels_min = 2,
        .channels_max = 2,
        .rates = SNDRV_PCM_RATE_48000,
        .formats =SNDRV_PCM_FMTBIT_S32_LE,
    },
    .symmetric_rates = 1,
    
};



static int hdmi_codec_probe(struct platform_device *pdev)
{
    int ret;

    ret = snd_soc_register_codec(&pdev->dev, &soc_codec_hdmi,
                    &ti81xx_dai, 1);
    if (ret < 0)
        printk(KERN_INFO " HDMI Codec Register Failed\n");

    return ret;
}

static int hdmi_codec_remove(struct platform_device *pdev)
{
    snd_soc_unregister_codec(&pdev->dev);
    return 0;
}

static struct platform_driver hdmi_codec_driver = {
    .probe        = hdmi_codec_probe,
    .remove        = hdmi_codec_remove,
    .driver        = {
        .name    = "hdmi-dummy-codec",
        .owner    = THIS_MODULE,
    },
};

static int __init hdmi_modinit(void)
{
    int ret=0;
    ret=platform_driver_probe(&hdmi_codec_driver,hdmi_codec_probe);
    printk("return ret=================%d\n",ret);
    return ret;
    //platform_driver_register(&hdmi_codec_driver);
}

static void __exit hdmi_exit(void)
{
    platform_driver_unregister(&hdmi_codec_driver);
}

module_init(hdmi_modinit);
module_exit(hdmi_exit);




Audio will be encoded as stanadard stereo I2S by HDMI RX and by default McAsp working at DSP_B mode, so we changed the audio format inside davinci-evm.c to I2S mode.
 
//#define AUDIO_FORMAT (SND_SOC_DAIFMT_DSP_B | \
//        SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_IB_NF)
#define AUDIO_FORMAT (SND_SOC_DAIFMT_I2S | \
        SND_SOC_DAIFMT_CBM_CFM | SND_SOC_DAIFMT_NB_IF)    



And we set the Receive bit delay of RFMT register RDATDLY=01 //mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,FSRDLY(0x01), FSRDLY(0x11)).

After all the changes, we still get one channel full of noise and the other channel is better but not clean sound.

Now we stuck here, could anyone point out us what we are missing here.



Regards,

Jun

  • Hi Jun,

    I am also trying audio capture using ITE HDMI receiver. Can you please share the codec file? I tried your code but I am getting

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

    when doing arecord. I would really appreciate if you can help me with this.

    Regards,

    Ajay Bhargav

  • I am working on a DM365 chip with the ipnc kernel 2.6.37. The chip interfaces with an AIC3254 codec chip. I have been able to successfully play music using aplay and started testing recording as below, but seem to be stuck with a problem that does not seem to have an answer anywhere around. Any help guys?

    root@192:/opt/sand# arecord -c  2   -f    S16_LE   -r  8000   -d  10  sample.wav   -v   &
    root@192:/opt/sand# Recording WAVE 'sample.wav' : Signed 16 bit Little Endian, R
    ate 8000 Hz, Stereo
    Plug PCM: Hardware PCM card 0 'DaVinci DM365 EVM' device 0 subdevice 0
    Its setup is:
    stream : CAPTURE
    access : RW_INTERLEAVED
    format : S16_LE
    subformat : STD
    channels : 2
    rate : 8000
    exact rate : 8000 (8000/1)
    msbits : 16
    buffer_size : 16000
    period_size : 1000
    period_time : 125000
    tstamp_mode : NONE
    period_step : 1
    avail_min : 1000
    period_event : 0
    start_threshold : 1
    stop_threshold : 16000
    silence_threshold: 0
    silence_size : 0
    boundary : 2097152000
    appl_ptr : 0
    hw_ptr : 0
    arecord: pcm_read:1773: read error: Input/output error