Skip to contentSkip to conversation

Two codecs using the same I2S bus

DISCUSSION Niels Langendorff 2 participants 5 messages Dec 11, 2009 – Dec 14, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

for a samsung based project we have chosen two codecs, one for input, the other for output. The two codecs are using the same I2S bus due to audio requirements (HF audio in combination with EC)

When having two machine implementations at the same time for the two codecs we will run into problems attaching to the I2S bus. A solution is to combine the machine implementation into one file, but then I probaly have to modify generic kernel code.

I there some solution for this and/or example code

Thanks in advance,

Niels Langendorff

#1 lore raw
Quoted 10 lines · Niels Langendorff

for a samsung based project we have chosen two codecs, one for input, the other for output. The two codecs are using the same I2S bus due to audio requirements (HF audio in combination with EC)

When having two machine implementations at the same time for the two codecs we will run into problems attaching to the I2S bus. A solution is to combine the machine implementation into one file, but then I probaly have to modify generic kernel code.

I there some solution for this and/or example code

This should work with the kernel as-is providing the two CODECs don't both need register control, just declare DAI links for each of the links you need from your machine driver. Nothing will stop you adding one DAI to multiple links. You'll need to deal with resource contention issues in your machine driver but it should have enough hooks already to support that, or you can just arrange for your application to never try to do anything unsupported.

If you run into problems doing this please bring them up on the list.

#2 lore raw
Quoted 5 lines · Mark Brown
Quoted 1 line · Niels Langendorff

I there some solution for this and/or example code

This should work with the kernel as-is providing the two CODECs don't

Oh, and the OMAP-based Pandora board is an example of doing this.

#3 lore raw
In reply to Mark Brown

Hi Mark,

thanks for your response. My comments are in between.

Op 12 dec 2009, om 19:05 heeft Mark Brown het volgende geschreven:

Quoted 11 lines · Niels Langendorff
Quoted 9 lines

for a samsung based project we have chosen two codecs, one for input, the other for output. The two codecs are using the same I2S bus due to audio requirements (HF audio in combination with EC)

When having two machine implementations at the same time for the two codecs we will run into problems attaching to the I2S bus. A solution is to combine the machine implementation into one file, but then I probaly have to modify generic kernel code.

Quoted 5 lines
Quoted 1 line

I there some solution for this and/or example code

This should work with the kernel as-is providing the two CODECs don't both need register control, just declare DAI links for each of the links you need from your machine driver.

Both the codecs needs to be reconfigured by writing the registers for every playback/recording, so that is the difficulty. I will have a look at the OMAP implementation as a good example.

Quoted 7 lines

Nothing will stop you adding one DAI
to multiple links. You'll need to deal with resource contention issues in your machine driver but it should have enough hooks already to support that, or you can just arrange for your application to never try to do anything unsupported.

If you run into problems doing this please bring them up on the list.

#4 lore raw
Quoted 9 lines · Niels Langendorff

Op 12 dec 2009, om 19:05 heeft Mark Brown het volgende geschreven:

Quoted 5 lines · Niels Langendorff

This should work with the kernel as-is providing the two CODECs don't both need register control, just declare DAI links for each of the links you need from your machine driver.

Both the codecs needs to be reconfigured by writing the registers for every playback/recording, so that is the difficulty.

I see. The difficulty with more than one register based device is somewhat orthogonal to the DAIs. The current approach to such systems is to have a driver for one of the devices which provides functions which can be called from the machine drivers - the MAX9877 and TPA6130A2 in mainline are examples. This doesn't scale so well, though it is workable for the time being if the devices aren't too complex.