Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1662110 > unrolled thread
| Started by | Sugar Zhang <sugar.zhang@rock-chips.com> |
|---|---|
| First post | 2017-06-09 11:00 +0200 |
| Last post | 2017-06-13 22:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v1 4/4] ASoC: rockchip: i2s: fixup clk div Sugar Zhang <sugar.zhang@rock-chips.com> - 2017-06-09 11:00 +0200
Re: [PATCH v1 4/4] ASoC: rockchip: i2s: fixup clk div Mark Brown <broonie@kernel.org> - 2017-06-13 22:50 +0200
| From | Sugar Zhang <sugar.zhang@rock-chips.com> |
|---|---|
| Date | 2017-06-09 11:00 +0200 |
| Subject | [PATCH v1 4/4] ASoC: rockchip: i2s: fixup clk div |
| Message-ID | <tQnVU-7KC-15@gated-at.bofh.it> |
we found mclk maybe not precise as required because of PLL,
but it still can be used and no side effect. for example, if we
require mclk 11289600, but get 11289598, it doesn't matter.
so using DIV_ROUND_CLOSEST to fix it.
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
---
sound/soc/rockchip/rockchip_i2s.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 2a15a00..b56e00d 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -282,10 +282,10 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
if (i2s->is_master_mode) {
mclk_rate = clk_get_rate(i2s->mclk);
bclk_rate = i2s->bclk_fs * params_rate(params);
- if (bclk_rate && mclk_rate % bclk_rate)
+ if (!bclk_rate)
return -EINVAL;
- div_bclk = mclk_rate / bclk_rate;
+ div_bclk = DIV_ROUND_CLOSEST(mclk_rate, bclk_rate);
div_lrck = bclk_rate / params_rate(params);
regmap_update_bits(i2s->regmap, I2S_CKR,
I2S_CKR_MDIV_MASK,
--
1.9.1
[toc] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2017-06-13 22:50 +0200 |
| Message-ID | <tS0Vc-4dS-7@gated-at.bofh.it> |
| In reply to | #1662110 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, Jun 09, 2017 at 04:52:49PM +0800, Sugar Zhang wrote: > we found mclk maybe not precise as required because of PLL, > but it still can be used and no side effect. for example, if we > require mclk 11289600, but get 11289598, it doesn't matter. > so using DIV_ROUND_CLOSEST to fix it. This is fine but seems to depend on patch 2.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web