]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
clk: spacemit: fix i2s clock
authorTroy Mitchell <troy.mitchell@linux.spacemit.com>
Thu, 11 Sep 2025 03:34:05 +0000 (11:34 +0800)
committerStephen Boyd <sboyd@kernel.org>
Sat, 20 Sep 2025 05:54:46 +0000 (22:54 -0700)
commit519cff1d85694cbdf33b27591740e7e37348e6b4
tree114cdeff7da85933e44e401b40927757d0b97881
parent74246a820c817f195f6191e370c3df98d2df5d91
clk: spacemit: fix i2s clock

Defining i2s_bclk and i2s_sysclk as fixed-rate clocks is insufficient
for real I2S use cases.

Moreover, the current I2S clock configuration does not work as expected
due to missing parent clocks.

This patch adds the missing parent clocks, defines i2s_sysclk as
a DDN clock, and i2s_bclk as a DIV clock.

A special note for i2s_bclk:

From the register definition, the i2s_bclk divider always implies
an additional 1/2 factor.

The following table shows the correspondence between index
and frequency division coefficients:

| index |  div  |
|-------|-------|
|   0   |   2   |
|   1   |   4   |
|   2   |   6   |
|   3   |   8   |

From a software perspective, introducing i2s_bclk_factor as the
parent of i2s_bclk is sufficient to address the issue.

The I2S-related clock registers can be found here [1].

Link:
https://developer.spacemit.com/documentation?token=LCrKwWDasiJuROkVNusc2pWTnEb
[1]

Fixes: 1b72c59db0add ("clk: spacemit: Add clock support for SpacemiT K1 SoC")
Co-developer: Jinmei Wei <weijinmei@linux.spacemit.com>
Suggested-by: Haylen Chu <heylenay@4d2.org>
Signed-off-by: Jinmei Wei <weijinmei@linux.spacemit.com>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/spacemit/ccu-k1.c
include/soc/spacemit/k1-syscon.h