Skip to contentSkip to conversation

ALSA: PCM - Add PCM creation API for internal PCMs.

PATCH In review Liam Girdwood 3 participants 6 messages Feb 8, 2012 – Feb 9, 2012 Sound

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ALSA: PCM - Add PCM creation API for internal PCMs.

The new ASoC dynamic PCM core needs to create PCMs and substreams that are for use by internal ASoC drivers only and not visible to userspace for direct IO. These new PCMs are similar to regular PCMs expect they have no device nodes or procfs entries. The ASoC component drivers use them in exactly the same way as regular PCMs for PCM and DAI operations.

The intention is that a dynamic PCM based driver will register both regular PCMs and internal PCMs. The regular PCMs will be used for all IO with userspace however the internal PCMs will be used by the driver to route digital audio through numerous back end DAI links (with potentially a DSP providing different hw_params, DAI formats based on the regular front end PCM params) to devices like CODECs, MODEMs, Bluetooth, FM, DMICs, etc

This patch adds a new snd_pcm_new_internal() API call to create the internal PCM without device nodes or procfs. It also adds adds a new internal flag to snd_pcm.

---
Changes since V1
- Renamed to Internal PCM instead of Dynamic PCM wrt ALSA.
- Removed similar PCM creation code and use flag for procfs/device creation.

 include/sound/pcm.h |    4 ++
 sound/core/pcm.c    |  100 +++++++++++++++++++++++++++++++++++---------------
 2 files changed, 74 insertions(+), 30 deletions(-)
include/sound/pcm.h +4 -0
index 0cf91b2..b33993f 100644
@@ -454,6 +454,7 @@ struct snd_pcm {
 	void *private_data;
 	void (*private_free) (struct snd_pcm *pcm);
 	struct device *dev; /* actual hw device this belongs to */
+	bool internal; /* pcm is for internal use only */
 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
 	struct snd_pcm_oss oss;
 #endif
@@ -475,6 +476,9 @@ extern const struct file_operations snd_pcm_f_ops[2];
 int snd_pcm_new(struct snd_card *card, const char *id, int device,
 		int playback_count, int capture_count,
 		struct snd_pcm **rpcm);
+int snd_pcm_new_internal(struct snd_card *card, const char *id, int device,
+		int playback_count, int capture_count,
+		struct snd_pcm ** rpcm);
 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
 
 int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
sound/core/pcm.c +70 -30

138 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw

At Wed, 8 Feb 2012 20:33:31 +0000,

Quoted 14 lines · Liam Girdwood

The new ASoC dynamic PCM core needs to create PCMs and substreams that are for use by internal ASoC drivers only and not visible to userspace for direct IO. These new PCMs are similar to regular PCMs expect they have no device nodes or procfs entries. The ASoC component drivers use them in exactly the same way as regular PCMs for PCM and DAI operations.

The intention is that a dynamic PCM based driver will register both regular PCMs and internal PCMs. The regular PCMs will be used for all IO with userspace however the internal PCMs will be used by the driver to route digital audio through numerous back end DAI links (with potentially a DSP providing different hw_params, DAI formats based on the regular front end PCM params) to devices like CODECs, MODEMs, Bluetooth, FM, DMICs, etc

Quoted 8 lines

This patch adds a new snd_pcm_new_internal() API call to create the internal PCM without device nodes or procfs. It also adds adds a new internal flag to snd_pcm.

---
Changes since V1
- Renamed to Internal PCM instead of Dynamic PCM wrt ALSA.
- Removed similar PCM creation code and use flag for procfs/device creation.

The changes look OK to me, but could you fix a few errors/warnings by checkpatch.pl?

thanks,

Takashi

#2 lore raw
Quoted 11 lines · Takashi Iwai

At Wed, 8 Feb 2012 20:33:31 +0000,

Quoted 5 lines · Liam Girdwood

The new ASoC dynamic PCM core needs to create PCMs and substreams that are for use by internal ASoC drivers only and not visible to userspace for direct IO. These new PCMs are similar to regular PCMs expect they have no device nodes or procfs entries. The ASoC component drivers use them in exactly the same way as regular PCMs for PCM and DAI operations.

The changes look OK to me, but could you fix a few errors/warnings by checkpatch.pl?

Since Liam's got a whole raft of ASoC changes depending on this one can you please either apply it to a branch or ack it for merge via ASoC?

#3 lore raw

At Wed, 8 Feb 2012 22:57:34 +0000,

Quoted 12 lines · Mark Brown

[1 <text/plain; us-ascii (7bit)>]

Quoted 8 lines · Takashi Iwai

At Wed, 8 Feb 2012 20:33:31 +0000,

Quoted 5 lines · Liam Girdwood

The new ASoC dynamic PCM core needs to create PCMs and substreams that are for use by internal ASoC drivers only and not visible to userspace for direct IO. These new PCMs are similar to regular PCMs expect they have no device nodes or procfs entries. The ASoC component drivers use them in exactly the same way as regular PCMs for PCM and DAI operations.

Quoted 5 lines
Quoted 2 lines

The changes look OK to me, but could you fix a few errors/warnings by checkpatch.pl?

Since Liam's got a whole raft of ASoC changes depending on this one can you please either apply it to a branch or ack it for merge via ASoC?

OK, now I fixed coding-style issues by myself and applied the patch. It's found in an individual branch, topic/pcm-internal of sound git tree. Feel free to pull this branch to your trees.

Takashi

#4 lore raw
Quoted 17 lines · Takashi Iwai

At Wed, 8 Feb 2012 22:57:34 +0000,

Quoted 15 lines · Mark Brown

[1 <text/plain; us-ascii (7bit)>]

Quoted 11 lines · Takashi Iwai

At Wed, 8 Feb 2012 20:33:31 +0000,

Quoted 5 lines · Liam Girdwood

The new ASoC dynamic PCM core needs to create PCMs and substreams that are for use by internal ASoC drivers only and not visible to userspace for direct IO. These new PCMs are similar to regular PCMs expect they have no device nodes or procfs entries. The ASoC component drivers use them in exactly the same way as regular PCMs for PCM and DAI operations.

The changes look OK to me, but could you fix a few errors/warnings by checkpatch.pl?

Quoted 7 lines
Quoted 2 lines

Since Liam's got a whole raft of ASoC changes depending on this one can you please either apply it to a branch or ack it for merge via ASoC?

OK, now I fixed coding-style issues by myself and applied the patch. It's found in an individual branch, topic/pcm-internal of sound git tree. Feel free to pull this branch to your trees.

Appologies, I didn't catch that after rebasing from V1.

Liam

#5 lore raw
In reply to Takashi Iwai
Quoted 8 lines · Takashi Iwai
Quoted 2 lines · Mark Brown

Since Liam's got a whole raft of ASoC changes depending on this one can you please either apply it to a branch or ack it for merge via ASoC?

OK, now I fixed coding-style issues by myself and applied the patch. It's found in an individual branch, topic/pcm-internal of sound git tree. Feel free to pull this branch to your trees.

Now pulled into 3.4 and I'm waiting with baited breath for the soc-dsp patches :)