if (sample_rate != 48000 && sample_rate != 44100) return -EINVAL;
guard(mutex)(&audio->enable_lock);
if (audio->enabled_streams && audio->current_rate != sample_rate) {
dev_err(dpsub->dev, "Can't change rate while playback enabled\n"); return -EINVAL;
}
if (audio->enabled_streams > 0) { /* Nothing to do */
audio->enabled_streams++; return 0;
}
audio->current_rate = sample_rate;
/* Note: clock rate can only be changed if the clock is disabled */
ret = clk_set_rate(dpsub->aud_clk,
sample_rate * ZYNQMP_DISP_AUD_SMPL_RATE_TO_CLK); if (ret) {
dev_err(dpsub->dev, "can't set aud_clk to %u err:%d\n",
sample_rate * ZYNQMP_DISP_AUD_SMPL_RATE_TO_CLK, ret); return ret;
}
/* Nothing to do */ if (audio->enabled_streams > 1) {
audio->enabled_streams--; return 0;
}
pm_runtime_put(dpsub->dev);
zynqmp_dp_audio_disable(dpsub->dp);
/* * Reset doesn't work. If we assert reset between audio stop and start, * the audio won't start anymore. Probably we are missing writing * some audio related registers. A/B buf?
*/ /* zynqmp_disp_audio_write(audio, ZYNQMP_DISP_AUD_SOFT_RESET, ZYNQMP_DISP_AUD_SOFT_RESET_AUD_SRST);
*/
/* * Note: these read & write functions only support two "registers", 0 and 1, * for volume 0 and 1. In other words, these are not real register read/write * functions. * * This is done to support caching the volume value for the case where the * hardware is not enabled, and also to support locking as volumes 0 and 1 * are in the same register.
*/ staticunsignedint zynqmp_dp_dai_read(struct snd_soc_component *component, unsignedint reg)
{ struct zynqmp_dpsub *dpsub = dev_get_drvdata(component->dev); struct zynqmp_dpsub_audio *audio = dpsub->audio;
ret = devm_snd_soc_register_component(dev, &zynqmp_dp_component_driver,
&audio->dai_driver, 1); if (ret) {
dev_err(dev, "Failed to register CPU DAI\n"); return ret;
}
/* Create PCMs */
for (unsignedint i = 0; i < ZYNQMP_NUM_PCMS; ++i) { struct snd_dmaengine_pcm_config *pcm_config =
&audio->pcm_configs[i];
/* * HACK: devm_snd_soc_register_card() overwrites current drvdata * so we need to hack it back.
*/
dev_data = dev_get_drvdata(dev);
ret = devm_snd_soc_register_card(dev, card);
dev_set_drvdata(dev, dev_data); if (ret) { /* * As older dtbs may not have the audio channel dmas defined, * instead of returning an error here we'll continue and just * mark the audio as disabled.
*/
dev_err(dev, "Failed to register sound card, disabling audio support\n");
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.