Hi DaneLLL and thank you for your response. After some struggling I’ve managed to implement my own codec and driver and it seems to be working. I haven’t test it yet with the real hardware but at least from the kernel side everything seems to be working.
The problem was mainly with the naming and how the codec and the driver are registered in the board-ardbeg.c
Therefore, for the following snd_soc_dai_driver in the codec
static struct snd_soc_dai_driver pcm271_codec_dai[] = {
// This is the Tegra's DAP2 interface (tegra30-i2s.1)
{
.name = "pcm271a-hifi1",
.id = 0,
.playback = {
.stream_name = "I2S1 Playback",
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_96000,
.formats = SNDRV_PCM_FMTBIT_S32_LE,
},
.capture = {
.stream_name = "I2S1 Capture",
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_96000,
.formats = SNDRV_PCM_FMTBIT_S32_LE,
},
},
// This is the Tegra's DAP4 interface (tegra30-i2s.3)
{
.name = "pcm271a-hifi2",
.id = 1,
.playback = {
.stream_name = "I2S3 Playback",
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_96000,
.formats = SNDRV_PCM_FMTBIT_S32_LE,
},
.capture = {
.stream_name = "I2S3 Capture",
.channels_min = 2,
.channels_max = 8,
.rates = SNDRV_PCM_RATE_96000,
.formats = SNDRV_PCM_FMTBIT_S32_LE,
},
},
};
the correct snd_soc_dai_link is the following:
static struct snd_soc_dai_link tegra_pcm271_dai[4] = {
[0] = {
.name = "PCM271A-1-p",
.stream_name = "I2S1 Playback",
.codec_name = "pcm271a",
.platform_name = "tegra30-i2s.1",
.cpu_dai_name = "tegra30-i2s.1",
.codec_dai_name = "pcm271a-hifi1",
.init = tegra_pcm271_init,
.ops = &tegra_pcm271_ops,
},
[1] = {
.name = "PCM271A-1-c",
.stream_name = "I2S1 Capture",
.codec_name = "pcm271a",
.platform_name = "tegra30-i2s.1",
.cpu_dai_name = "tegra30-i2s.1",
.codec_dai_name = "pcm271a-hifi1",
.ops = &tegra_pcm271_ops,
},
[2] = {
.name = "PCM271A-2-p",
.stream_name = "I2S3 Playback",
.codec_name = "pcm271a",
.platform_name = "tegra30-i2s.3",
.cpu_dai_name = "tegra30-i2s.3",
.codec_dai_name = "pcm271a-hifi2",
.ops = &tegra_pcm271_ops,
},
[3] = {
.name = "PCM271A-2-c",
.stream_name = "I2S3 Capture",
.codec_name = "pcm271a",
.platform_name = "tegra30-i2s.3",
.cpu_dai_name = "tegra30-i2s.3",
.codec_dai_name = "pcm271a-hifi2",
.ops = &tegra_pcm271_ops,
},
};
And finally both the dummy codec and the driver need to be registered in the tegra_ardbeg_late_init() in board-ardbeg.c
So the hassle was with the names between the codec and the driver and how the L4T needs the devices to be registered in board-ardbeg.c
So after these changes now I get:
[ 0.120367] pcm271-codec: register pcm271a codec, ret: 0
[ 0.120452] pcm271-driver: register pcm271a driver, ret: 0
[ 5.867578] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: probe
[ 5.874283] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: initializing tools: 0
[ 6.025224] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: snd_soc_card_set_drvdata
[ 6.033316] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: set I2S modes and clocks
[ 6.041409] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: card name: tegra-pcm271
[ 6.049414] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: card dai links: 4
[ 6.056898] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: codec name: pcm271a
[ 6.064556] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: snd_soc_register_card()
[ 6.072560] tegra-snd-pcm271 tegra-snd-pcm271.0: codec name: pcm271a
[ 6.079003] tegra-snd-pcm271 tegra-snd-pcm271.0: codec dai name: pcm271a-hifi1
[ 6.086314] tegra-snd-pcm271 tegra-snd-pcm271.0: platform name: tegra30-i2s.1
[ 6.093541] tegra-snd-pcm271 tegra-snd-pcm271.0: cpu name: (null)
[ 6.099726] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: codec name: pcm271a
[ 6.107383] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: snd_soc_register_card()
[ 6.115388] tegra-snd-pcm271 tegra-snd-pcm271.0: codec name: pcm271a
[ 6.121831] tegra-snd-pcm271 tegra-snd-pcm271.0: codec dai name: pcm271a-hifi1
[ 6.129142] tegra-snd-pcm271 tegra-snd-pcm271.0: platform name: tegra30-i2s.1
[ 6.136365] tegra-snd-pcm271 tegra-snd-pcm271.0: cpu name: (null)
[ 6.142549] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: codec name: pcm271a
[ 6.150206] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: snd_soc_register_card()
[ 6.158217] tegra-snd-pcm271 tegra-snd-pcm271.0: codec name: pcm271a
[ 6.164661] tegra-snd-pcm271 tegra-snd-pcm271.0: codec dai name: pcm271a-hifi2
[ 6.171972] tegra-snd-pcm271 tegra-snd-pcm271.0: platform name: tegra30-i2s.3
[ 6.179196] tegra-snd-pcm271 tegra-snd-pcm271.0: cpu name: (null)
[ 6.185379] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: codec name: pcm271a
[ 6.193037] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: snd_soc_register_card()
[ 6.201040] tegra-snd-pcm271 tegra-snd-pcm271.0: codec name: pcm271a
[ 6.207484] tegra-snd-pcm271 tegra-snd-pcm271.0: codec dai name: pcm271a-hifi2
[ 6.214795] tegra-snd-pcm271 tegra-snd-pcm271.0: platform name: tegra30-i2s.3
[ 6.222018] tegra-snd-pcm271 tegra-snd-pcm271.0: cpu name: (null)
[ 6.228231] tegra-snd-pcm271 tegra-snd-pcm271.0: ASoC: binding PCM271A-1-p at idx 0
[ 6.235891] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-spdif
[ 6.244764] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.4
[ 6.253635] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.3
[ 6.262507] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.1
[ 6.271379] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.0
[ 6.280250] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-compr
[ 6.289644] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-pcm
[ 6.298863] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi2
[ 6.307734] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi1
[ 6.316606] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.325043] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.333481] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.341919] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: snd-soc-dummy-dai
[ 6.351138] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: pcm271a
[ 6.358882] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.2
[ 6.366973] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.1
[ 6.375064] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.0
[ 6.383155] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: snd-soc-dummy
[ 6.391421] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-spdif
[ 6.399945] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.4
[ 6.408469] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.3
[ 6.417001] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.1
[ 6.624504] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.0
[ 6.633038] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra-offload
[ 6.641580] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: snd-soc-dummy
[ 6.650123] tegra-snd-pcm271 tegra-snd-pcm271.0: ASoC: binding PCM271A-1-c at idx 1
[ 6.657784] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-spdif
[ 6.666659] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.4
[ 6.675541] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.3
[ 6.684415] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.1
[ 6.693287] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.0
[ 6.702161] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-compr
[ 6.711556] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-pcm
[ 6.720776] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi2
[ 6.729735] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi1
[ 6.738613] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.747054] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.755495] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.763933] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: snd-soc-dummy-dai
[ 6.773155] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: pcm271a
[ 6.780902] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.2
[ 6.788996] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.1
[ 6.797095] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.0
[ 6.805188] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: snd-soc-dummy
[ 6.813456] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-spdif
[ 6.821982] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.4
[ 6.830509] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.3
[ 6.839035] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.1
[ 6.847561] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.0
[ 6.856094] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra-offload
[ 6.864621] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: snd-soc-dummy
[ 6.873149] tegra-snd-pcm271 tegra-snd-pcm271.0: ASoC: binding PCM271A-2-p at idx 2
[ 6.880810] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-spdif
[ 6.889683] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.4
[ 6.898557] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.3
[ 6.907430] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.1
[ 6.916302] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.0
[ 6.925175] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-compr
[ 6.934574] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-pcm
[ 6.943793] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi2
[ 6.952668] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi1
[ 6.961541] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.969982] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.978422] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 6.986863] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: snd-soc-dummy-dai
[ 6.996091] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: pcm271a
[ 7.003835] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.2
[ 7.011929] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.1
[ 7.020022] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.0
[ 7.028117] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: snd-soc-dummy
[ 7.036384] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-spdif
[ 7.044911] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.4
[ 7.053439] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.3
[ 7.061965] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.1
[ 7.070492] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.0
[ 7.079019] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra-offload
[ 7.087545] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: snd-soc-dummy
[ 7.096072] tegra-snd-pcm271 tegra-snd-pcm271.0: ASoC: binding PCM271A-2-c at idx 3
[ 7.103730] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-spdif
[ 7.112603] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.4
[ 7.121477] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.3
[ 7.130352] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.1
[ 7.139225] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra30-i2s.0
[ 7.148100] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-compr
[ 7.157494] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: tegra-offload-pcm
[ 7.166715] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi2
[ 7.175589] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: pcm271a-hifi1
[ 7.184462] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 7.192908] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 7.201350] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: dit-hifi
[ 7.209791] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: CPU DAI name found: snd-soc-dummy-dai
[ 7.219012] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: pcm271a
[ 7.226759] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.2
[ 7.234852] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.1
[ 7.242945] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: spdif-dit.0
[ 7.251038] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: Codec found: snd-soc-dummy
[ 7.259306] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-spdif
[ 7.267833] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.4
[ 7.276359] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.3
[ 7.284885] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.1
[ 7.293411] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra30-i2s.0
[ 7.301937] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: tegra-offload
[ 7.310464] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: platform found: snd-soc-dummy
[ 7.319612] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271a-hifi1 <-> tegra30-i2s.1 mapping ok
[ 7.328528] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271a-hifi1 <-> tegra30-i2s.1 mapping ok
[ 7.337430] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271a-hifi2 <-> tegra30-i2s.3 mapping ok
[ 7.346327] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271a-hifi2 <-> tegra30-i2s.3 mapping ok
[ 7.356703] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271: snd_soc_register_card: 0
[ 7.364205] sysedp_create_consumer: unable to create speaker, no consumer_data for speaker found
[ 7.372821] tegra-snd-pcm271 tegra-snd-pcm271.0: pcm271-driver: probe finished
[ 7.912470] ALSA device list:
[ 7.915448] #0: HDA NVIDIA Tegra at 0x70038000 irq 113
[ 7.920780] #1: tegra-pcm271
root@test:~# aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: Tegra [HDA NVIDIA Tegra], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrapcm271 [tegra-pcm271], device 0: I2S1 Playback pcm271a-hifi1-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrapcm271 [tegra-pcm271], device 1: I2S1 Capture pcm271a-hifi1-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrapcm271 [tegra-pcm271], device 2: I2S3 Playback pcm271a-hifi2-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrapcm271 [tegra-pcm271], device 3: I2S3 Capture pcm271a-hifi2-3 []
Subdevices: 1/1
Subdevice #0: subdevice #0