/* The set of sample rates that can be supported depends on the * MCLK supplied to the CODEC.
*/ if (wm8524->sysclk)
snd_pcm_hw_constraint_list(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_RATE,
&wm8524->rate_constraint);
staticint wm8524_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsignedint freq, int dir)
{ struct snd_soc_component *component = codec_dai->component; struct wm8524_priv *wm8524 = snd_soc_component_get_drvdata(component); unsignedint val; int i, j = 0;
wm8524->rate_constraint.count = 0;
wm8524->sysclk = freq; if (!wm8524->sysclk) return 0;
for (i = 0; i < ARRAY_SIZE(lrclk_ratios); i++) {
val = freq / lrclk_ratios[i].ratio; /* Check that it's a standard rate since core can't * cope with others and having the odd rates confuses * constraint matching.
*/ switch (val) { case 8000: case 11025: case 16000: case 22050: case 32000: case 44100: case 48000: case 64000: case 88200: case 96000: case 176400: case 192000:
dev_dbg(component->dev, "Supported sample rate: %dHz\n",
val);
wm8524->rate_constraint_list[j++] = val;
wm8524->rate_constraint.count++; break; default:
dev_dbg(component->dev, "Skipping sample rate: %dHz\n",
val);
}
}
/* Need at least one supported rate... */ if (wm8524->rate_constraint.count == 0) return -EINVAL;
/* If sysclk is not configured, no need to check the rate */ if (!wm8524->sysclk) return 0;
/* Find a supported LRCLK rate */ for (i = 0; i < wm8524->rate_constraint.count; i++) { if (wm8524->rate_constraint.list[i] == params_rate(params)) break;
}
if (i == wm8524->rate_constraint.count) {
dev_err(component->dev, "LRCLK %d unsupported with MCLK %d\n",
params_rate(params), wm8524->sysclk); return -EINVAL;
}
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.