How to write a custom driver for iMx6q for developing a PCM controller with Audio System IC?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to write a custom driver for iMx6q for developing a PCM controller with Audio System IC?

1,515 次查看
abhijeet_ghodga
Contributor III

Hi,

I am writing a custom driver for iMx6q for developing a PCM protocol with Audio System IC Si3228x. Till now the approaches that we are following is to get a low-level driver from ALSA codebase or refer to soc-pcm.c file written by Texas Instruments.

For writing the ALSA driver we are referring to: Linux Sound Subsystem Documentation — The Linux Kernel documentation and Chapter 5. PCM Interface 

The driver should be able to do basic operations like read and writing on the PCM bus or throwing any garbage value that can be captured. The PCM mode is Network Mode from the iMX side and mulaw 8-bit from the IC's side.

Thanks

purvi.billore‌ bhupeshpatil

标签 (1)
2 回复数

1,338 次查看
abhijeet_ghodga
Contributor III

Hi Chan,

I have referred to the porting guide document. I also got I2S whitepaper from the VoIP vendor instructing on the parameters needed to interface.

In these 3 months, I have been able to send data from processor (sine signal, ramp, wav file), and it is successfully received at the telephone end of the VoIP DSP after uLaw companding, and going through ALSA software filter, VoIP audio block filter and has no problem of data collision or synchronisation.

The problem is in sending the data back to the processor, when the VoIP chip makes a 8-bit mu law signal at DTX pin and sends it to the processor, the same alsa_minimal_driver which was able to write on the PCM bus (using snd_pcm_writei()), is unable to read off the PCM bus giving the error:

Read from audio interface failed (Invalid argument/ broken pipe)

The driver is initialized using fsl-ssi-dai and the registers (20C8078, 20C8070, 20C8080, 20C8090, 20C401C, 2024028, 20C407C, 20C4060, 2028010, 2028020, 2028024 and 202801C) are set to give proper I2S settings, (I2S_CLK=512kHz, I2S_WS=8kHz) and SSI settings.

The 32-bit word from the PCM channel should be masked out as a 8-bit data and then loopbacked to the same VoIP, and later sent to some other interface.

Best,

Abhijeet

0 项奖励
回复

1,338 次查看
jimmychan
NXP TechSupport
NXP TechSupport

1. You can download the Yocto BSP documentation from here:

i.MX Software and Development Tools | NXP 

e.g. Linux 4.14.98_2.2.0 Documentation

In this documentation, there are two documents are useful for your driver development. one is i.MX_Porting_Guide.pdf, and other one is i.MX_Reference_Manual.pdf (Chapter 7 is ALSA)

2. Then you can find the drivers source code as example/reference for the codec from here:

codecs\soc\sound - linux-imx - i.MX Linux kernel 

And the machine driver from here:

fsl\soc\sound - linux-imx - i.MX Linux kernel