Skip to contentSkip to conversation

No pcm device?

DISCUSSION John Kacur 2 participants 8 messages Oct 20, 2008

lore
Share & tools
lore

John Kacur

author
#0 lore raw

I'm not sure if the hardware I have makes this problem simple for me, or difficult, because it seems to differ from other ASoC code. Basically, I have a i2s as transport, connected to max5556 driving the output. (and a few other chips related to amplification and muting) There is however no sound card, thus no PCM device. Now the question is how to proceed? In other words what kind of minimal PCM layer do I need if any?

Thanks

#1 lore raw
Quoted 4 lines · John Kacur

I'm not sure if the hardware I have makes this problem simple for me, or difficult, because it seems to differ from other ASoC code. Basically, I have a i2s as transport, connected to max5556 driving the output. (and a few other chips related to amplification and muting)

This all seems very normal for ASoC - something like a stereo DAC connected to a CPU via I2S is exactly the sort of situation that ASoC is designed to handle. However...

Quoted 3 lines

There is however no sound card, thus no PCM device. Now the question is how to proceed? In other words what kind of minimal PCM layer do I need if any?

...the goal of ASoC is to provide a sound card to user space via the ALSA APIs so if you're trying to do something else then there's a massive mismatch between that and what ASoC is designed to achieve.

Could you please clarify what you're attempting to do here?

author
#2 lore raw
Quoted 14 lines · Mark Brown
Quoted 4 lines · John Kacur

I'm not sure if the hardware I have makes this problem simple for me, or difficult, because it seems to differ from other ASoC code. Basically, I have a i2s as transport, connected to max5556 driving the output. (and a few other chips related to amplification and muting)

This all seems very normal for ASoC - something like a stereo DAC connected to a CPU via I2S is exactly the sort of situation that ASoC is designed to handle. However...

Quoted 3 lines

There is however no sound card, thus no PCM device. Now the question is how to proceed? In other words what kind of minimal PCM layer do I need if any?

Quoted 6 lines

...the goal of ASoC is to provide a sound card to user space via the ALSA APIs so if you're trying to do something else then there's a massive mismatch between that and what ASoC is designed to achieve.

Could you please clarify what you're attempting to do here?

On a simple level, I'm just trying to provide sound, by implementing an alsa driver. I've implemented a low-level library that can manipulate all my hardware's i2s registers, and I've been mirroring other alsa-soc drivers, and I'm at the point where I'm scratching my head over what to do about PCM. The confusion to me, is that the code seems to describe actually hardware - and the only thing I can think of it what my hardware i2s is capable of transmitting, does that sound right?

#3 lore raw
Quoted 8 lines · John Kacur
Quoted 5 lines · Mark Brown
Quoted 3 lines

There is however no sound card, thus no PCM device. Now the question is how to proceed? In other words what kind of minimal PCM layer do I need if any?

Could you please clarify what you're attempting to do here?

Quoted 8 lines

On a simple level, I'm just trying to provide sound, by implementing an alsa driver. I've implemented a low-level library that can manipulate all my hardware's i2s registers, and I've been mirroring other alsa-soc drivers, and I'm at the point where I'm scratching my head over what to do about PCM. The confusion to me, is that the code seems to describe actually hardware - and the only thing I can think of it what my hardware i2s is capable of transmitting, does that sound right?

I think you've misunderstood how this is supposed to work. None of the drivers for I2S or DMA controllers are responsible for creating a sound card by themselves. They provide support for the features of the I2S or DMA controller but then rely on a separate machine driver to describe how they are actually connected into the system.

There's some documentation of the model that's being used here in:

Documentation/sound/alsa/soc

In your case you'll want to implement I2S and DMA drivers for your platform and a codec driver for the MAX5556 (looking at the datasheet it has no control of its own but you'll need to provide a DAI for it) and then provide a machine driver which connects them together.

author
#4 lore raw
Quoted 24 lines · Mark Brown
Quoted 8 lines · John Kacur
Quoted 5 lines · Mark Brown
Quoted 3 lines

There is however no sound card, thus no PCM device. Now the question is how to proceed? In other words what kind of minimal PCM layer do I need if any?

Could you please clarify what you're attempting to do here?

Quoted 8 lines

On a simple level, I'm just trying to provide sound, by implementing an alsa driver. I've implemented a low-level library that can manipulate all my hardware's i2s registers, and I've been mirroring other alsa-soc drivers, and I'm at the point where I'm scratching my head over what to do about PCM. The confusion to me, is that the code seems to describe actually hardware - and the only thing I can think of it what my hardware i2s is capable of transmitting, does that sound right?

I think you've misunderstood how this is supposed to work. None of the drivers for I2S or DMA controllers are responsible for creating a sound card by themselves. They provide support for the features of the I2S or DMA controller but then rely on a separate machine driver to describe how they are actually connected into the system.

Quoted 9 lines

There's some documentation of the model that's being used here in:

Documentation/sound/alsa/soc

In your case you'll want to implement I2S and DMA drivers for your platform and a codec driver for the MAX5556 (looking at the datasheet it has no control of its own but you'll need to provide a DAI for it) and then provide a machine driver which connects them together.

I've surely misunderstood a thing or two without question. :) However, I have read all of the documentation in Documentation/sound/alsa/soc, and more than once. And I've been reading the code for the ASoC drivers as well, and have been trying to emulate it, especially, the code in sound/soc/s3c24xx and sound/soc/pxa (as well as davinci at first until I realized that it was incomplete)

...but I'm still scratching my head when I look at files like sound/soc/s3c24xx/s3c24xx-pcm.c
It appears to be part of the DAI that connects the i2s driver and codec together? So, back to my current source of confusion, do I need to implement some basic kind of pcm driver for my scenario?

Thank again for taking the time to answer all my somewhat confused questions.

#5 lore raw
Quoted 3 lines · John Kacur

...but I'm still scratching my head when I look at files like sound/soc/s3c24xx/s3c24xx-pcm.c
It appears to be part of the DAI that connects the i2s driver and

No, there is no direct connection between any of the platform drivers and the codec drivers - the platform drivers will be configured to produce and understand signals on I2S as configured by a combination of the machine drivers and core. The codec will be configured compatibly but at no point should the codec and platform drivers directly know anything about each other.

Quoted 2 lines

codec together? So, back to my current source of confusion, do I need to implement some basic kind of pcm driver for my scenario?

There should be at least a stub platform driver. The driver is responsible for things that apply over the entire platform - for most platforms this is DMA since the DMA control is the same for all the different audio interfaces the platform has.

This is nothing to do with creating a card, that is initiated by the machine driver.

author
#6 lore raw
Quoted 16 lines · Mark Brown
Quoted 3 lines · John Kacur

...but I'm still scratching my head when I look at files like sound/soc/s3c24xx/s3c24xx-pcm.c
It appears to be part of the DAI that connects the i2s driver and

No, there is no direct connection between any of the platform drivers and the codec drivers - the platform drivers will be configured to produce and understand signals on I2S as configured by a combination of the machine drivers and core. The codec will be configured compatibly but at no point should the codec and platform drivers directly know anything about each other.

Quoted 2 lines

codec together? So, back to my current source of confusion, do I need to implement some basic kind of pcm driver for my scenario?

Quoted 8 lines

There should be at least a stub platform driver. The driver is responsible for things that apply over the entire platform - for most platforms this is DMA since the DMA control is the same for all the different audio interfaces the platform has.

This is nothing to do with creating a card, that is initiated by the machine driver.

Here is the outline of my design. So, if I understand you correctly, my jade-pcm.c file is just for implementing dma. Basically, I have a simple scenario there is no capture, just read a wav file from user space, transport it through i2s to the codec.

Machine Code (Jade)
-------------------
jade-xxsvideo.c
jade-xxsvideo.h

Platform Code
-------------
jade-pcm.c
jade-pcm.h

DAI (Digital Audio Interface)
-----------------------------

	.cpu_dai 	= &jade_i2s_dai
		jade-i2s.c
		jade-i2s.h
	.codec_dai	= &max5556_dai
		max5556.c
		max5556.h

Codec Code (MAX5556ESA_M, TDA7052BT/N1, TDA8551T)
--------------------------------------------------
max5556.c
max5556.h

#7 lore raw
Quoted 11 lines · John Kacur

On Mon, Oct 20, 2008 at 3:24 PM, Mark Brown <[email protected]> wrote:

Here is the outline of my design. So, if I understand you correctly, my jade-pcm.c file is just for implementing dma. Basically, I have a simple scenario there is no capture, just read a wav file from user space, transport it through i2s to the codec.

Machine Code (Jade)
-------------------
jade-xxsvideo.c
jade-xxsvideo.h

I gather that both your machine and your CPU are called jade? That makes things a little less clear than they normally would be.

Quoted 4 lines

Platform Code
-------------
jade-pcm.c
jade-pcm.h

Normally you'd have a separate I2S driver here - from this...

Quoted 8 lines

DAI (Digital Audio Interface)
-----------------------------

	.cpu_dai 	= &jade_i2s_dai
		jade-i2s.c
		jade-i2s.h
	.codec_dai	= &max5556_dai
		max5556.c
		max5556.h

...it looks like that's the case, in which case everything looks sensible.