* [PATCH v2 0/2] ASoC: spacemit: add K3 SoC support
@ 2026-05-07 7:33 Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 1/2] ASoC: dt-bindings: add SpacemiT K3 SoC compatible Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 2/2] ASoC: spacemit: add K3 SoC support with additional clocks Troy Mitchell
0 siblings, 2 replies; 3+ messages in thread
From: Troy Mitchell @ 2026-05-07 7:33 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Yixun Lan, Jinmei Wei, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-sound, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell
This series adds K3 SoC support for the SpacemiT I2S controller driver.
Patch 1 adds the dt-bindings for the spacemit,k3-i2s compatible. The K3
SoC uses the same I2S IP as K1 but requires additional clocks
(sysclk_div, c_sysclk, c_bclk) that are shared across multiple I2S
controllers.
Patch 2 adds driver support for K3 SoC with additional clocks.
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
Changes in v2:
- Drop bug fix patches (1-3/7) — patches 2-3 already merged, patch 1
split into a standalone series
- Drop fixed-sample-rate patches (5-6/7) — will address shared BCLK
constraint at the ASoC core level in a separate series
- update commit msg (1/7)
- Add rob's tag
- Link to v1: https://patch.msgid.link/20260429-k3-i2s-v1-0-2fe99db11ecb@linux.spacemit.com
To: Liam Girdwood <lgirdwood@gmail.com>
To: Mark Brown <broonie@kernel.org>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Yixun Lan <dlan@kernel.org>
To: Troy Mitchell <troy.mitchell@linux.spacemit.com>
To: Jaroslav Kysela <perex@perex.cz>
To: Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: spacemit@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
---
Troy Mitchell (2):
ASoC: dt-bindings: add SpacemiT K3 SoC compatible
ASoC: spacemit: add K3 SoC support with additional clocks
.../devicetree/bindings/sound/spacemit,k1-i2s.yaml | 31 +++++++++++++++++--
sound/soc/spacemit/k1_i2s.c | 36 +++++++++++++++++++++-
2 files changed, 64 insertions(+), 3 deletions(-)
---
base-commit: f58f2e0137c2132a08a1ab42720a9540cf0093a8
change-id: 20260427-k3-i2s-52ae21807466
Best regards,
--
Troy Mitchell <troy.mitchell@linux.spacemit.com>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] ASoC: dt-bindings: add SpacemiT K3 SoC compatible
2026-05-07 7:33 [PATCH v2 0/2] ASoC: spacemit: add K3 SoC support Troy Mitchell
@ 2026-05-07 7:33 ` Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 2/2] ASoC: spacemit: add K3 SoC support with additional clocks Troy Mitchell
1 sibling, 0 replies; 3+ messages in thread
From: Troy Mitchell @ 2026-05-07 7:33 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Yixun Lan, Jinmei Wei, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-sound, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell
Add the spacemit,k3-i2s compatible string for the K3 SoC I2S
controller. The K3 I2S IP is the same as K1 but requires additional
clocks: a dedicated sysclk_div clock, along with common_sysclk and
common_bclk which are shared across multiple I2S controllers on K3.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
.../devicetree/bindings/sound/spacemit,k1-i2s.yaml | 31 ++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml b/Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml
index 55bd0b307d22..240d90402e4f 100644
--- a/Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml
+++ b/Documentation/devicetree/bindings/sound/spacemit,k1-i2s.yaml
@@ -4,7 +4,7 @@
$id: http://devicetree.org/schemas/sound/spacemit,k1-i2s.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
-title: K1 I2S controller
+title: SpacemiT K1/K3 I2S controller
description:
The I2S bus (Inter-IC sound bus) is a serial link for digital
@@ -15,27 +15,54 @@ maintainers:
allOf:
- $ref: dai-common.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: spacemit,k3-i2s
+ then:
+ properties:
+ clocks:
+ minItems: 7
+ clock-names:
+ minItems: 7
+ else:
+ properties:
+ clocks:
+ maxItems: 4
+ clock-names:
+ maxItems: 4
properties:
compatible:
- const: spacemit,k1-i2s
+ enum:
+ - spacemit,k1-i2s
+ - spacemit,k3-i2s
reg:
maxItems: 1
clocks:
+ minItems: 4
items:
- description: clock for I2S sysclk
- description: clock for I2S bclk
- description: clock for I2S bus
- description: clock for I2S controller
+ - description: clock for I2S sysclk divider
+ - description: clock for I2S common sysclk
+ - description: clock for I2S common bclk
clock-names:
+ minItems: 4
items:
- const: sysclk
- const: bclk
- const: bus
- const: func
+ - const: sysclk_div
+ - const: c_sysclk
+ - const: c_bclk
dmas:
minItems: 1
--
2.54.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] ASoC: spacemit: add K3 SoC support with additional clocks
2026-05-07 7:33 [PATCH v2 0/2] ASoC: spacemit: add K3 SoC support Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 1/2] ASoC: dt-bindings: add SpacemiT K3 SoC compatible Troy Mitchell
@ 2026-05-07 7:33 ` Troy Mitchell
1 sibling, 0 replies; 3+ messages in thread
From: Troy Mitchell @ 2026-05-07 7:33 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Yixun Lan, Jinmei Wei, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-sound, linux-riscv, spacemit, linux-kernel, devicetree,
Troy Mitchell
Add support for the SpacemiT K3 SoC I2S controller, which shares the
same IP as K1 but requires additional clocks: sysclk_div, c_sysclk,
and c_bclk. These clocks only exist on K3 and are not present on K1.
The sysclk_div clock is present on most K3 I2S controllers except I2S1.
The c_sysclk and c_bclk clocks are shared across multiple I2S
controllers on K3.
Use devm_clk_get_optional_enabled() to acquire these clocks so that
the driver works on both K1 (where they are absent) and K3 without
needing SoC-specific match data. For K3, the sysclk_div rate is set
before sysclk in set_sysclk, and the common clock rates are configured
in hw_params based on the sample rate.
Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
---
sound/soc/spacemit/k1_i2s.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/sound/soc/spacemit/k1_i2s.c b/sound/soc/spacemit/k1_i2s.c
index 1cb99f1abc7c..4e655d714623 100644
--- a/sound/soc/spacemit/k1_i2s.c
+++ b/sound/soc/spacemit/k1_i2s.c
@@ -53,6 +53,9 @@ struct spacemit_i2s_dev {
struct clk *sysclk;
struct clk *bclk;
struct clk *sspa_clk;
+ struct clk *sysclk_div;
+ struct clk *c_sysclk;
+ struct clk *c_bclk;
struct snd_dmaengine_dai_dma_data capture_dma_data;
struct snd_dmaengine_dai_dma_data playback_dma_data;
@@ -189,6 +192,14 @@ static int spacemit_i2s_hw_params(struct snd_pcm_substream *substream,
params_rate(params) *
data_bits;
+ ret = clk_set_rate(i2s->c_sysclk, bclk_rate * 2);
+ if (ret)
+ return ret;
+
+ ret = clk_set_rate(i2s->c_bclk, bclk_rate);
+ if (ret)
+ return ret;
+
ret = clk_set_rate(i2s->bclk, bclk_rate);
if (ret)
return ret;
@@ -200,10 +211,17 @@ static int spacemit_i2s_set_sysclk(struct snd_soc_dai *cpu_dai, int clk_id,
unsigned int freq, int dir)
{
struct spacemit_i2s_dev *i2s = dev_get_drvdata(cpu_dai->dev);
+ int ret;
if (freq == 0)
return 0;
+ if (i2s->sysclk_div) {
+ ret = clk_set_rate(i2s->sysclk_div, freq);
+ if (ret)
+ return ret;
+ }
+
return clk_set_rate(i2s->sysclk, freq);
}
@@ -418,6 +436,21 @@ static int spacemit_i2s_probe(struct platform_device *pdev)
return dev_err_probe(i2s->dev, PTR_ERR(i2s->sspa_clk),
"failed to enable sspa clock\n");
+ i2s->sysclk_div = devm_clk_get_optional_enabled(i2s->dev, "sysclk_div");
+ if (IS_ERR(i2s->sysclk_div))
+ return dev_err_probe(i2s->dev, PTR_ERR(i2s->sysclk_div),
+ "failed to enable sysclk_div clock\n");
+
+ i2s->c_sysclk = devm_clk_get_optional_enabled(i2s->dev, "c_sysclk");
+ if (IS_ERR(i2s->c_sysclk))
+ return dev_err_probe(i2s->dev, PTR_ERR(i2s->c_sysclk),
+ "failed to enable c_sysclk clock\n");
+
+ i2s->c_bclk = devm_clk_get_optional_enabled(i2s->dev, "c_bclk");
+ if (IS_ERR(i2s->c_bclk))
+ return dev_err_probe(i2s->dev, PTR_ERR(i2s->c_bclk),
+ "failed to enable c_bclk clock\n");
+
i2s->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(i2s->base))
return dev_err_probe(i2s->dev, PTR_ERR(i2s->base), "failed to map registers\n");
@@ -444,6 +477,7 @@ static int spacemit_i2s_probe(struct platform_device *pdev)
static const struct of_device_id spacemit_i2s_of_match[] = {
{ .compatible = "spacemit,k1-i2s", },
+ { .compatible = "spacemit,k3-i2s", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, spacemit_i2s_of_match);
@@ -458,4 +492,4 @@ static struct platform_driver spacemit_i2s_driver = {
module_platform_driver(spacemit_i2s_driver);
MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("I2S bus driver for SpacemiT K1 SoC");
+MODULE_DESCRIPTION("I2S bus driver for SpacemiT K1/K3 SoC");
--
2.54.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-07 7:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-07 7:33 [PATCH v2 0/2] ASoC: spacemit: add K3 SoC support Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 1/2] ASoC: dt-bindings: add SpacemiT K3 SoC compatible Troy Mitchell
2026-05-07 7:33 ` [PATCH v2 2/2] ASoC: spacemit: add K3 SoC support with additional clocks Troy Mitchell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox