Lines Matching full:ratio
161 * @ratio: desired overall ratio for the paticipating dividers
165 static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, in fsl_esai_divisor_cal() argument
176 if (ratio > 2 * 8 * 256 * maxfp || ratio < 2) { in fsl_esai_divisor_cal()
177 dev_err(dai->dev, "the ratio is out of range (2 ~ %d)\n", in fsl_esai_divisor_cal()
180 } else if (ratio % 2) { in fsl_esai_divisor_cal()
185 ratio /= 2; in fsl_esai_divisor_cal()
187 psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; in fsl_esai_divisor_cal()
189 /* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */ in fsl_esai_divisor_cal()
190 if (ratio <= 256) { in fsl_esai_divisor_cal()
191 pm = ratio; in fsl_esai_divisor_cal()
205 if (prod == ratio) in fsl_esai_divisor_cal()
207 else if (prod / ratio == 1) in fsl_esai_divisor_cal()
208 sub = prod - ratio; in fsl_esai_divisor_cal()
209 else if (ratio / prod == 1) in fsl_esai_divisor_cal()
210 sub = ratio - prod; in fsl_esai_divisor_cal()
215 sub = sub * 1000 / ratio; in fsl_esai_divisor_cal()
266 u32 ratio, ecr = 0; in fsl_esai_set_dai_sysclk() local
312 ratio = clk_rate / freq; in fsl_esai_set_dai_sysclk()
313 if (ratio * freq > clk_rate) in fsl_esai_set_dai_sysclk()
314 ret = ratio * freq - clk_rate; in fsl_esai_set_dai_sysclk()
315 else if (ratio * freq < clk_rate) in fsl_esai_set_dai_sysclk()
316 ret = clk_rate - ratio * freq; in fsl_esai_set_dai_sysclk()
328 if (ratio == 1 && clksrc == esai_priv->extalclk) { in fsl_esai_set_dai_sysclk()
332 } else if (ratio < 2) { in fsl_esai_set_dai_sysclk()
333 /* The ratio should be no less than 2 if using other sources */ in fsl_esai_set_dai_sysclk()
339 ret = fsl_esai_divisor_cal(dai, tx, ratio, false, 0); in fsl_esai_set_dai_sysclk()
366 u32 sub, ratio = hck_rate / freq; in fsl_esai_set_bclk() local
373 if (ratio * freq > hck_rate) in fsl_esai_set_bclk()
374 sub = ratio * freq - hck_rate; in fsl_esai_set_bclk()
375 else if (ratio * freq < hck_rate) in fsl_esai_set_bclk()
376 sub = hck_rate - ratio * freq; in fsl_esai_set_bclk()
387 /* The ratio should be contented by FP alone if bypassing PM and PSR */ in fsl_esai_set_bclk()
388 if (!esai_priv->sck_div[tx] && (ratio > 16 || ratio == 0)) { in fsl_esai_set_bclk()
389 dev_err(dai->dev, "the ratio is out of range (1 ~ 16)\n"); in fsl_esai_set_bclk()
393 ret = fsl_esai_divisor_cal(dai, tx, ratio, true, in fsl_esai_set_bclk()
394 esai_priv->sck_div[tx] ? 0 : ratio); in fsl_esai_set_bclk()