Lines Matching refs:ratio
166 * @ratio: desired overall ratio for the paticipating dividers
170 static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio,
181 if (ratio > 2 * 8 * 256 * maxfp || ratio < 2) {
182 dev_err(dai->dev, "the ratio is out of range (2 ~ %d)\n",
185 } else if (ratio % 2) {
190 ratio /= 2;
192 psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8;
194 /* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */
195 if (ratio <= 256) {
196 pm = ratio;
210 if (prod == ratio)
212 else if (prod / ratio == 1)
213 sub = prod - ratio;
214 else if (ratio / prod == 1)
215 sub = ratio - prod;
220 sub = sub * 1000 / ratio;
271 u32 ratio, ecr = 0;
317 ratio = clk_rate / freq;
318 if (ratio * freq > clk_rate)
319 ret = ratio * freq - clk_rate;
320 else if (ratio * freq < clk_rate)
321 ret = clk_rate - ratio * freq;
333 if (ratio == 1 && clksrc == esai_priv->extalclk) {
337 } else if (ratio < 2) {
338 /* The ratio should be no less than 2 if using other sources */
344 ret = fsl_esai_divisor_cal(dai, tx, ratio, false, 0);
371 u32 sub, ratio = hck_rate / freq;
378 if (ratio * freq > hck_rate)
379 sub = ratio * freq - hck_rate;
380 else if (ratio * freq < hck_rate)
381 sub = hck_rate - ratio * freq;
392 /* The ratio should be contented by FP alone if bypassing PM and PSR */
393 if (!esai_priv->sck_div[tx] && (ratio > 16 || ratio == 0)) {
394 dev_err(dai->dev, "the ratio is out of range (1 ~ 16)\n");
398 ret = fsl_esai_divisor_cal(dai, tx, ratio, true,
399 esai_priv->sck_div[tx] ? 0 : ratio);