switch (params_rate(params)) { case 64000:
pll_freq = 196608001U;
rfs = 384; break; case 44100: case 88200:
pll_freq = 180633609U;
rfs = 512; break; case 32000: case 48000: case 96000:
pll_freq = 196608001U;
rfs = 512; break; default: return -EINVAL;
}
ret = clk_set_rate(priv->clk_i2s_bus, pll_freq / 2 + 1); if (ret < 0) return ret;
/* * We add 2 to the rclk_freq value in order to avoid too low clock * frequency values due to the EPLL output frequency not being exact * multiple of the audio sampling rate.
*/
rclk_freq = params_rate(params) * rfs + 2;
ret = clk_set_rate(priv->sclk_i2s, rclk_freq); if (ret < 0) return ret;
ret = snd_soc_of_parse_card_name(card, "model"); if (ret < 0) return ret;
if (of_property_present(dev->of_node, "samsung,audio-widgets")) {
ret = snd_soc_of_parse_audio_simple_widgets(card, "samsung,audio-widgets"); if (ret < 0) return ret;
}
ret = 0; if (of_property_present(dev->of_node, "audio-routing"))
ret = snd_soc_of_parse_audio_routing(card, "audio-routing"); elseif (of_property_present(dev->of_node, "samsung,audio-routing"))
ret = snd_soc_of_parse_audio_routing(card, "samsung,audio-routing"); if (ret < 0) return ret;
cpu = of_get_child_by_name(dev->of_node, "cpu");
codec = of_get_child_by_name(dev->of_node, "codec");
link = card->dai_link;
codec_link = &card->dai_link[1];
/* * For backwards compatibility create the secondary CPU DAI link only * if there are 2 CPU DAI entries in the cpu sound-dai property in DT. * Also add required DAPM routes not available in old DTS.
*/
num_pcms = of_count_phandle_with_args(cpu, "sound-dai", "#sound-dai-cells"); if (num_pcms == 1) {
card->dapm_routes = odroid_dapm_routes;
card->num_dapm_routes = ARRAY_SIZE(odroid_dapm_routes);
card->num_links--;
}
for (i = 0; i < num_pcms; i++, link += 2) {
ret = snd_soc_of_get_dai_name(cpu, &link->cpus->dai_name, i); if (ret < 0) break;
} if (ret == 0) {
cpu_dai = of_parse_phandle(cpu, "sound-dai", 0); if (!cpu_dai)
ret = -EINVAL;
}
of_node_put(cpu); if (ret < 0) goto err_put_node;
ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link); if (ret < 0) goto err_put_cpu_dai;
/* Set capture capability only for boards with the MAX98090 CODEC */ if (codec_link->num_codecs > 1) {
card->dai_link[0].playback_only = 0;
card->dai_link[1].playback_only = 0;
}
priv->sclk_i2s = of_clk_get_by_name(cpu_dai, "i2s_opclk1"); if (IS_ERR(priv->sclk_i2s)) {
ret = PTR_ERR(priv->sclk_i2s); goto err_put_cpu_dai;
}
priv->clk_i2s_bus = of_clk_get_by_name(cpu_dai, "iis"); if (IS_ERR(priv->clk_i2s_bus)) {
ret = PTR_ERR(priv->clk_i2s_bus); goto err_put_sclk;
}
ret = devm_snd_soc_register_card(dev, card); if (ret < 0) {
dev_err_probe(dev, ret, "snd_soc_register_card() failed\n"); goto err_put_clk_i2s;
}
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.