int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots)
{ return fs * snd_soc_calc_frame_size(sample_size, channels, tdm_slots);
}
EXPORT_SYMBOL_GPL(snd_soc_calc_bclk);
int snd_soc_params_to_bclk(conststruct snd_pcm_hw_params *params)
{ int ret;
ret = snd_soc_params_to_frame_size(params);
if (ret > 0) return ret * params_rate(params); else return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
/** * snd_soc_tdm_params_to_bclk - calculate bclk from params and tdm slot info. * * Calculate the bclk from the params sample rate, the tdm slot count and the * tdm slot width. Optionally round-up the slot count to a given multiple. * Either or both of tdm_width and tdm_slots can be 0. * * If tdm_width == 0: use params_width() as the slot width. * If tdm_slots == 0: use params_channels() as the slot count. * * If slot_multiple > 1 the slot count (or params_channels() if tdm_slots == 0) * will be rounded up to a multiple of slot_multiple. This is mainly useful for * I2S mode, which has a left and right phase so the number of slots is always * a multiple of 2. * * If tdm_width == 0 && tdm_slots == 0 && slot_multiple < 2, this is equivalent * to calling snd_soc_params_to_bclk(). * * @params: Pointer to struct_pcm_hw_params. * @tdm_width: Width in bits of the tdm slots. Must be >= 0. * @tdm_slots: Number of tdm slots per frame. Must be >= 0. * @slot_multiple: If >1 roundup slot count to a multiple of this value. * * Return: bclk frequency in Hz, else a negative error code if params format * is invalid.
*/ int snd_soc_tdm_params_to_bclk(conststruct snd_pcm_hw_params *params, int tdm_width, int tdm_slots, int slot_multiple)
{ if (!tdm_slots)
tdm_slots = params_channels(params);
if (slot_multiple > 1)
tdm_slots = roundup(tdm_slots, slot_multiple);
if (!tdm_width) {
tdm_width = snd_pcm_format_width(params_format(params)); if (tdm_width < 0) return tdm_width;
}
/* * If there are other components associated with rtd, we shouldn't * override their hwparams
*/
for_each_rtd_components(rtd, i, component) { if (component->driver == &dummy_platform) return 0;
}
/* BE's dont need dummy params */ if (!rtd->dai_link->no_pcm)
snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware);
/* * The dummy CODEC is only meant to be used in situations where there is no * actual hardware. * * If there is actual hardware even if it does not have a control bus * the hardware will still have constraints like supported samplerates, etc. * which should be modelled. And the data flow graph also should be modelled * using DAPM.
*/ staticstruct snd_soc_dai_driver dummy_dai = {
.name = "snd-soc-dummy-dai",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 384,
.rates = SNDRV_PCM_RATE_CONTINUOUS,
.rate_min = 5512,
.rate_max = 768000,
.formats = STUB_FORMATS,
},
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 384,
.rates = SNDRV_PCM_RATE_CONTINUOUS,
.rate_min = 5512,
.rate_max = 768000,
.formats = STUB_FORMATS,
},
.ops = &dummy_dai_ops,
};
int snd_soc_dai_is_dummy(conststruct snd_soc_dai *dai)
{ if (dai->driver == &dummy_dai) return 1; return 0;
}
EXPORT_SYMBOL_GPL(snd_soc_dai_is_dummy);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.