Setting up host side Digital Audio Interface (DAI) in a machine driver

,

Hi. I am working on a project where I am supposed to send audio data from an Nvidia Xavier NX that runs L4T v4.9 to a Cirrus Logic CS47L35 chip. I have to send control signals over SPI and audio data over I2S. After talking to the Cirrus Logic support team I am made to believe that I would have to change the machine driver DAI links to connect the host I2S DAI to the cs47l35 DAI. To find the host DAI name, I will need the I2S driver for the platform. This (GitHub - OE4T/linux-tegra-4.9: Linux kernel source for NVIDIA Tegra (Jetson TX1, TX2, AGX Xavier, Xavier NX, Nano) in single-repo form, derived from the L4T BSP) is the source that I
am using for Nvidia platform. So my questions are:

  • Am I using the right source?
  • Where will I find the driver files for I2S? Is it possible to list out all the files?

Hoping to hear back. Some help would be great as I am very new to this porting.

Thanks,
Abhigyan

Check below doc to get the right source.

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/kernel_custom.html#

Check below for the audio driver.
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/asoc_driver.19.1.html#

https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/asoc_driver.19.1.html# talks about making changes to the sound node in the device tree. But I am not able to locate the device tree in my Nvidia Xavier NX.

Since I am using a Cirrus Logic’s cs47l35 codec, so can I add my own <.compatible> property in the machine driver and put the same in the Device Tree, or should I use “For Jetson Xavier NX, Jetson AGX Xavier series, or Jetson TX2 series: nvidia,tegra-audio-t186ref-mobile-rt565x” in my machine driver?

Hi user93455,

sound node located in “Linux_for_Tegra/source/public/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-audio-p3668.dtsi” can be used for your dai link specific modification ( Link points the file to be edited platform wise )

Thanks

Do I have to make changes to the Device Tree?

Since you mentioned that you are unable to locate device tree for Nvidia Xavier NX, I have pointed the same.
Refer sample codec porting guide based on I2S for data and I2C for control signal communication here. This link could give you some idea.

If there is anything else that you need help with, please post a specific question with more details

Thanks

Hi, this is what I have been trying to achieve:
“I am working on a project where I am supposed to send audio data from an Nvidia Xavier NX that runs L4T v4.9 to a Cirrus Logic CS47L35 chip. I have to send control signals over SPI and audio data over I2S.”

The information provided on your website is a little confusing. Since I am new to this, can you please write down the steps that I will need to follow to achieve the goal? Bulletin points would be appreciated.

Thanks,
Abhigyan

Hi Abhigyan,

I see I2C bus available for control signal communication on your codec. Is there any specific reason for you to choose SPI for control signal communication over I2C or is I2C fine to be used? Ensure that cirrus logic provides necessary i2c codec driver code if I2C is used.

Also, note that documentation details way to use i2c for control data communication and i2s signal for data communication. Strongly suggest you to read through it and see if that helps. If it is confusing, let us know which part of it is not understandeable.

Link has sample step by step procedure for another card. You could form your patches based on this reference and let us know issues faced in trying to use interfaces

If you wish to try SPI for communication, I might need to check/redirect to SPI expert

Thanks

Hi Atalambedu,

The requirement of my project is such that I have to use SPI. So please do the needful.

Infineon-Project2021-22/tegra-cirrus.c at master · AbhigyanBorah33/Infineon-Project2021-22 · GitHub is the link to the machine driver that I have been building with help from Cirrus Logic. They are unable to help for the host side. So please have a look at it and suggest what else I need to do.

Thanks,
Abhigyan

Hi Abhigyan,

I hope you are getting help on probing codec at link

Once codec registration is succesful, you can track card registration here

Thanks

Hi atalambedu,

Here it talks about a machine driver kernel/nvidia/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c. And here it talks about making certain changes to the machine driver.

So my question is, do I have to modify that particular machine driver file? If yes, are the three steps mentioned here enough?

Thanks,
Abhigyan

Hi abhigyan,

The guide suits for audio codec that uses I2S for audio and I2C for control data communication. Since you are using SPI for control data communication, so need to list the codec under relevant SPI node and ensure that the codec probe is called and the codec is registred under “cat /sys/kernel/debug/asoc/codecs” as a first step.

I see that you have placed the codec under SPI on the other post. Were you able to register the codec?

Thanks

Hi atalambedu,

Once I flash the new Device Tree, am I supposed to see my codec under “cat /sys/kernel/debug/asoc/codecs”?

Thanks,
Abhigyan

Yes provided “spi probe function is called which triggers the codec registration and it went through succesfully”. dmesg logs point to issues if any. spi probe function will be part of codec driver provided by codec vendor

Thanks

Under spi@3210000, I have made the following changes:

spi@0 {
			compatible = "cirrus,cs47l35";
			spi-max-frequency = <0x5b8d80>;
			reg = <0x00>;
			phandle = <0x179>;
		};

Is this enough for the SPI node? And I am not able to figure out what phandle is referring to here.

You don’t need phandle property in the spi@0 please remove it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.