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