[alsa-devel] Question about soc-utils

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Dec 5 09:01:07 CET 2017


Hi Mark, ALSA SoC ML

In my understanding, "frame size" means "channel x physical width".
linux/sound/core/pcm_native.c :: snd_pcm_hw_params() is doing so

static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params)
{
	...
=>	bits = snd_pcm_format_physical_width(runtime->format);
	runtime->sample_bits = bits;
=>	bits *= runtime->channels;
	runtime->frame_bits = bits;
	...
}

But, soc-utils::snd_soc_params_to_frame_size()
is using snd_pcm_format_width() instead of snd_pcm_format_physical_width(),
In "2ch x 24bit data with 32bit width" case, above "frame_bits" will be "64",
but, below "frame size" will be "48", I think.
Am I wrong ?

int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
{
	int sample_size;

=>	sample_size = snd_pcm_format_width(params_format(params));
	if (sample_size < 0)
		return sample_size;

=>	return snd_soc_calc_frame_size(sample_size, params_channels(params),
				       1);
}


About "TDM slot", in my understanding it is TDM channel number.
TDM6 = 6ch = 6 slot, TDM8 = 8ch = 8 slot.
Am I wrong ??
I'm asking because soc-utils :: snd_soc_calc_bclk() / snd_soc_calc_frame_size()
have both "channles" and "slot" parameter.
What is this "tdm_slots" means ?

	int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
	int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots)

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list