Skip to contentSkip to conversation

ALSA: PCM - Add PCM creation API for ASoC dynamic PCMs.

RFC/PATCH Liam Girdwood 2 participants 3 messages Feb 8, 2012 Sound

lore
Share & tools
lore
#0 lore raw

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 dynamic PCMs. The regular PCMs will be used for all IO with userspace however the dynamic 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_dynamic() API call to create the dynamic PCM without device nodes or procfs. It also adds snd_pcm_new_stream_dynamic() and snd_pcm_dev_register_dynamic() which are used to create the dynamic PCM.

---
 include/sound/pcm.h |    3 +
 sound/core/pcm.c    |  145 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+), 0 deletions(-)
include/sound/pcm.h +3 -0
index 0cf91b2..1597f89 100644
@@ -475,6 +475,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_dynamic(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 +145 -0

175 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#1 lore raw

At Wed, 8 Feb 2012 11:55:37 +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 dynamic PCMs. The regular PCMs will be used for all IO with userspace however the dynamic 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 3 lines

This patch adds a new snd_pcm_new_dynamic() API call to create the dynamic PCM without device nodes or procfs. It also adds snd_pcm_new_stream_dynamic() and snd_pcm_dev_register_dynamic() which are used to create the dynamic PCM.

I don't think you need to copy all functions just for stripping some features. Instead, add a new flag in snd_pcm indicating that it's only for internal-use (or non-exposure, whatever), and set it in snd_pcm_new(). Maybe make a static __snd_pcm_new() with an extra bool flag and let snd_pcm_new() and snd_pcm_new_dynamic() call the function with the appropriate flag value.

In snd_pcm_new_stream(), just skip unnecessary init parts when the pcm flag is set. Ditto for snd_pcm_dev_register().

thanks,

Takashi

#2 lore raw
Quoted 27 lines · Takashi Iwai

At Wed, 8 Feb 2012 11:55:37 +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 dynamic PCMs. The regular PCMs will be used for all IO with userspace however the dynamic 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 3 lines

This patch adds a new snd_pcm_new_dynamic() API call to create the dynamic PCM without device nodes or procfs. It also adds snd_pcm_new_stream_dynamic() and snd_pcm_dev_register_dynamic() which are used to create the dynamic PCM.

I don't think you need to copy all functions just for stripping some features. Instead, add a new flag in snd_pcm indicating that it's only for internal-use (or non-exposure, whatever), and set it in snd_pcm_new(). Maybe make a static __snd_pcm_new() with an extra bool flag and let snd_pcm_new() and snd_pcm_new_dynamic() call the function with the appropriate flag value.

Quoted 3 lines

In snd_pcm_new_stream(), just skip unnecessary init parts when the pcm flag is set. Ditto for snd_pcm_dev_register().

Ah, I did originally have something like this but didn't want to add a flag. Back to plan A.

Liam