[alsa-devel] Exporting playback and capture capability to user space

Rajeev kumar rajeev-dlh.kumar at st.com
Tue Nov 22 05:27:51 CET 2011


Hello Vinod, Mark


On 11/21/2011 11:53 AM, Vinod Koul wrote:
> On Mon, 2011-11-21 at 11:19 +0530, Rajeev kumar wrote:
>> Hello Mark
>>
>> Could you please help me by answering these questions?
>>
>> Best Regards
>> Rajeev
>>
> Pls don't top-post!!
>> On 11/17/2011 7:05 PM, Rajeev kumar wrote:
>>> Hello Mark
>>>
>>> I have a single codec with playback and capture capability. We are using
>>> it for different i2s controller. Below are the details for that.
>>>
>>> case 1: I2S controller-1: with playback and capture capability
>>> case 2: I2S controller-2: with playback capability only
>>> case 3: I2S controller-3: with capture capability only.
>>>
>>> We are registering all the I2S controller with there respective capability.
>>>
>>> In command 'aplay -l' or 'cat /proc/asound/pcm', among playback devices,
>>> capture device is also listed. This is true in case-1 but for case-2 and
>>> case-3 also it is showing the same behavior. According to my
>>> understanding it should not show the list of all devices i.e. in case of
>>> controller having playback capability it should show only playback
>>> devices not capture devices and vice versa. Please correct me if I am
>>> wrong.
>>>
>>> So my questions are
>>> 1. How to separate playback and capture devices in case-2 and case-3.
>>> Are we need to register different codec for different i2s controller?
> How asoc builds this is based on dailinks you have provided. If for the
> device 2 and device 3 the cpu and codec dais support both playback and
> capture devices, it will go ahead and register these device.
> The fact that for device 2 and device 3 capture is also registered
> suggests me that your cpu dais are not correct.
>
> Would help if you post your code, esp the codec, cpu dais and dialinks.
>

Codec dai:

static struct snd_soc_dai_driver sta529_dai = {
	.name = "sta529-audio",
	.playback = {
		.stream_name = "Playback",
		.channels_min = 2,
		.channels_max = 2,
		.rates = SPEAR_PCM_RATES,
		.formats = SPEAR_PCM_FORMAT,
	},
	.capture = {
		.stream_name = "Capture",
		.channels_min = 2,
		.channels_max = 2,
		.rates = SPEAR_PCM_RATES,
		.formats = SPEAR_PCM_FORMAT,
	},
	.ops	= &sta529_dai_ops,
};

cpu dai: In case of cpu dai, we are passing the playback and capture 
capability from the platform code and depending on the capability we are 
filling the cpu dai structure in probe function, like

if (cap & PLAY) {

	/* Fill Playback capability */
}

if (cap & RECORD) {
	/* Fill Capture capability */
}

dai links:

static struct snd_soc_dai_link spear_evb_dai[] = {
	 {
		.name		= "sta529-pcm0",
		.stream_name	= "I2S Playback",
		.cpu_dai_name	= "designware-i2s.0",
		.platform_name	= "spear-pcm-audio",
		.codec_dai_name	= "sta529-audio",
		.codec_name	= "sta529-codec.0-001a",
		.ops		= &sta529_ops,
	}, {
		.name		= "sta529-pcm1",
		.stream_name	= "I2S Capture",
		.cpu_dai_name	= "designware-i2s.1",
		.platform_name	= "spear-pcm-audio",
		.codec_dai_name	= "sta529-audio",
		.codec_name	= "sta529-codec.0-001a",
		.ops		= &sta529_ops,
	},
};

static struct snd_soc_card spear_snd_card = {
	.name		= "spear-evb",
	.dai_link	= spear_evb_dai,
	.num_links	= ARRAY_SIZE(spear_evb_dai),
};

Best Regards
~Rajeev


More information about the Alsa-devel mailing list