Lines Matching refs:ratio
170 static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, in fsl_esai_divisor_cal() argument
181 if (ratio > 2 * 8 * 256 * maxfp || ratio < 2) { in fsl_esai_divisor_cal()
185 } else if (ratio % 2) { in fsl_esai_divisor_cal()
190 ratio /= 2; in fsl_esai_divisor_cal()
192 psr = ratio <= 256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; in fsl_esai_divisor_cal()
195 if (ratio <= 256) { in fsl_esai_divisor_cal()
196 pm = ratio; in fsl_esai_divisor_cal()
210 if (prod == ratio) in fsl_esai_divisor_cal()
212 else if (prod / ratio == 1) in fsl_esai_divisor_cal()
213 sub = prod - ratio; in fsl_esai_divisor_cal()
214 else if (ratio / prod == 1) in fsl_esai_divisor_cal()
215 sub = ratio - prod; in fsl_esai_divisor_cal()
220 sub = sub * 1000 / ratio; in fsl_esai_divisor_cal()
271 u32 ratio, ecr = 0; in fsl_esai_set_dai_sysclk() local
317 ratio = clk_rate / freq; in fsl_esai_set_dai_sysclk()
318 if (ratio * freq > clk_rate) in fsl_esai_set_dai_sysclk()
319 ret = ratio * freq - clk_rate; in fsl_esai_set_dai_sysclk()
320 else if (ratio * freq < clk_rate) in fsl_esai_set_dai_sysclk()
321 ret = clk_rate - ratio * freq; in fsl_esai_set_dai_sysclk()
333 if (ratio == 1 && clksrc == esai_priv->extalclk) { in fsl_esai_set_dai_sysclk()
337 } else if (ratio < 2) { in fsl_esai_set_dai_sysclk()
344 ret = fsl_esai_divisor_cal(dai, tx, ratio, false, 0); in fsl_esai_set_dai_sysclk()
371 u32 sub, ratio = hck_rate / freq; in fsl_esai_set_bclk() local
378 if (ratio * freq > hck_rate) in fsl_esai_set_bclk()
379 sub = ratio * freq - hck_rate; in fsl_esai_set_bclk()
380 else if (ratio * freq < hck_rate) in fsl_esai_set_bclk()
381 sub = hck_rate - ratio * freq; in fsl_esai_set_bclk()
393 if (!esai_priv->sck_div[tx] && (ratio > 16 || ratio == 0)) { in fsl_esai_set_bclk()
398 ret = fsl_esai_divisor_cal(dai, tx, ratio, true, in fsl_esai_set_bclk()
399 esai_priv->sck_div[tx] ? 0 : ratio); in fsl_esai_set_bclk()