Skip to content

Commit 647d04f

Browse files
Sylwester Nawrockibroonie
authored andcommitted
ASoC: samsung: i2s: Ensure the RCLK rate is properly determined
If the RCLK mux clock configuration is specified in DT and no set_sysclk() callback is used in the sound card driver the sclk_srcrate field will remain set to 0, leading to an incorrect PSR divider setting. To fix this the frequency value is retrieved from the CLK_I2S_RCLK_SRC clock, so the actual RCLK mux selection is taken into account. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 4b20f44 commit 647d04f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sound/soc/samsung/i2s.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,12 @@ static int i2s_set_fmt(struct snd_soc_dai *dai,
656656
tmp |= mod_slave;
657657
break;
658658
case SND_SOC_DAIFMT_CBS_CFS:
659-
/* Set default source clock in Master mode */
660-
if (i2s->rclk_srcrate == 0)
659+
/*
660+
* Set default source clock in Master mode, only when the
661+
* CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
662+
* clock configuration assigned in DT is not overwritten.
663+
*/
664+
if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL)
661665
i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
662666
0, SND_SOC_CLOCK_IN);
663667
break;
@@ -881,6 +885,11 @@ static int config_setup(struct i2s_dai *i2s)
881885
return 0;
882886

883887
if (!(i2s->quirks & QUIRK_NO_MUXPSR)) {
888+
struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC];
889+
890+
if (i2s->rclk_srcrate == 0 && rclksrc && !IS_ERR(rclksrc))
891+
i2s->rclk_srcrate = clk_get_rate(rclksrc);
892+
884893
psr = i2s->rclk_srcrate / i2s->frmclk / rfs;
885894
writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR);
886895
dev_dbg(&i2s->pdev->dev,

0 commit comments

Comments
 (0)