Skip to contentSkip to conversation

ASoC: codec: SPDIF only works with Tx/Rx seperate codec drivers?

DISCUSSION Nicolin Chen 3 participants 6 messages Jul 12, 2013 – Jul 15, 2013

lore
Share & tools
lore
#0 lore raw

Hi Mark,

I've a little question about SPDIF codec drivers.

I found there're spdif_receiver.c and spdif_transmitter.c, two files, in sound/soc/codecs directory. So it looks like SPDIF module would work separately as one IN device and one OUT device, for example:
dts/spear1340.dtsi: spdif-in@d0100000 {
dts/spear1340.dtsi: compatible = "st,spdif-in";
dts/spear1340.dtsi: spdif-out@d0000000 {
dts/spear1340.dtsi: compatible = "st,spdif-out";

But the question is what if a SPDIF module have both Tx and Rx function in one simple CPU DAI. Is that okay to add a new codec driver for this situation?

Actually I'm gonna prepare some patches to add Freescale SPDIF drivers. But this needs to create a brand new dummy SPDIF codec driver, which's some kinda same as spdif_receiver/transmitter.c but quite different in the supports of SAMPLE_RATE/FORMAT and IN/OUT-in-one integration.

So I just want to make sure if this'll be okay.

Thank you. And looking forward to your reply.
Nicolin Chen

#1 lore raw
Quoted 4 lines · Nicolin Chen

Actually I'm gonna prepare some patches to add Freescale SPDIF drivers. But this needs to create a brand new dummy SPDIF codec driver, which's some kinda same as spdif_receiver/transmitter.c but quite different in the supports of SAMPLE_RATE/FORMAT and IN/OUT-in-one integration.

We could just merge them into a single driver easily enough.

#2 lore raw

Thank you for the reply.

Quoted 1 line · Mark Brown

We could just merge them into a single driver easily enough.

Merge spdif_receiver.c and spdif_transmitter.c?
But each of them is being individually used by several drivers:
davinci/davinci-evm.c
samsung/smdk_spdif.c
spear/spdif_in.c
spear/spdif_out.c

If we merge these two files, it would break their functions. Especially for spear's platform, seems they are using SPDIF IN and OUT separately.

#3 lore raw
Quoted 10 lines · Nicolin Chen
Quoted 1 line · Mark Brown

We could just merge them into a single driver easily enough.

Merge spdif_receiver.c and spdif_transmitter.c?
But each of them is being individually used by several drivers:
davinci/davinci-evm.c
samsung/smdk_spdif.c
spear/spdif_in.c
spear/spdif_out.c

Quoted 3 lines

If we merge these two files, it would break their functions. Especially for spear's platform, seems they are using SPDIF IN and OUT separately.

Why would it break them? You can always instantiate two copies.

#4 lore raw
In reply to Nicolin Chen
Quoted 16 lines · Nicolin Chen

Hi Mark,

I've a little question about SPDIF codec drivers.

I found there're spdif_receiver.c and spdif_transmitter.c, two files, in sound/soc/codecs directory. So it looks like SPDIF module would work separately as one IN device and one OUT device, for example:
dts/spear1340.dtsi: spdif-in@d0100000 {
dts/spear1340.dtsi: compatible = "st,spdif-in";
dts/spear1340.dtsi: spdif-out@d0000000 {
dts/spear1340.dtsi: compatible = "st,spdif-out";

But the question is what if a SPDIF module have both Tx and Rx function in one simple CPU DAI. Is that okay to add a new codec driver for this situation?

Quoted 6 lines

Actually I'm gonna prepare some patches to add Freescale SPDIF drivers. But this needs to create a brand new dummy SPDIF codec driver, which's some kinda same as spdif_receiver/transmitter.c but quite different in the supports of SAMPLE_RATE/FORMAT and IN/OUT-in-one integration.

So I just want to make sure if this'll be okay.

The current drivers should work fine with this. You can create a card with two DAI links

static struct snd_soc_dai_link dai_links[] = {
	{
		.name = "S/PDIF TX",
		.stream_name = "S/PDIF PCM Playback",
		.platform_name = "your-platform",
		.cpu_dai_name = "your-cpu-dai",
		.codec_dai_name = "dit-hifi",
		.codec_name = "spdif-dit",
	}, {
		.name = "S/PDIF RX",
		.stream_name = "S/PDIF PCM Playback",
		.platform_name = "your-platform",
		.cpu_dai_name = "your-cpu-dai",
		.codec_dai_name = "dir-hifi",
		.codec_name = "spdif-dir",
	},
};
#5 lore raw

Hi,

Quoted 2 lines · Lars-Peter Clausen

The current drivers should work fine with this. You can create a card with two DAI links

I'll try it. Thank you so much!