mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: xlnx: spdif: switch to the common clock framework
@ 2026-11-17  8:57 Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks Dhanunjanrao Katta
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Dhanunjanrao Katta @ 2026-11-17  8:57 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, linux-sound
  Cc: Vincenzo Frascino, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Michal Simek,
	devicetree, linux-kernel, linux-arm-kernel, git,
	Dhanunjanrao Katta

The Xilinx SPDIF/AES3 IP is fed by three clocks, but the binding
described only two of them and the driver requested only one. The audio
clock frequency was instead passed as a plain number in the custom
"xlnx,aud_clk_i" property, and the driver relied on the firmware to
leave the audio and AXI4-Stream clocks running.

This series describes the third clock, requests the audio and
AXI4-Stream clocks through the common clock framework, and reads the
audio rate with clk_get_rate() so that the SPDIF divider follows the
rate actually in effect. A tidy-up of the register defines and of the
divider values comes first so that the clock change is easy to read.

Patch 1 describes the AXI4-Stream clock and selects its name from the IP
mode. The minimum clock count stays at two and "xlnx,aud_clk_i" is kept
as deprecated rather than removed, so that device trees written against
the earlier binding keep validating. "xlnx,spdif-mode" becomes required,
because the conditional that picks the clock name keys on it and would
otherwise also match when the property is absent.

Patch 2 names each register-field define after the register it belongs
to, prefixes the remaining driver constants, and replaces the bare
clock-divider values with an enum.

Patch 3 requests the audio clock and the mode-specific AXI4-Stream clock
through the common clock framework. The stream clock is requested as
optional so that existing two-clock device trees still probe, and a zero
audio rate is now rejected with a diagnostic instead of falling through
the divider switch. "xlnx,aud_clk_i" is no longer read.

Dhanunjanrao Katta (3):
  ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks
  ASoC: xlnx: spdif: namespace register macros and use a divider enum
  ASoC: xlnx: spdif: get clocks through the common clock framework

 .../devicetree/bindings/sound/xlnx,spdif.yaml |  54 +++++++--
 sound/soc/xilinx/xlnx_spdif.c                 | 108 +++++++++++-------
 2 files changed, 113 insertions(+), 49 deletions(-)


base-commit: 7cd6b1fd8f9c1fcb1da1b761d502649f50b9800f
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks
  2026-11-17  8:57 [PATCH 0/3] ASoC: xlnx: spdif: switch to the common clock framework Dhanunjanrao Katta
@ 2026-11-17  8:57 ` Dhanunjanrao Katta
  2026-11-17 10:06   ` Krzysztof Kozlowski
  2026-11-17  8:57 ` [PATCH 2/3] ASoC: xlnx: spdif: namespace register macros and use a divider enum Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 3/3] ASoC: xlnx: spdif: get clocks through the common clock framework Dhanunjanrao Katta
  2 siblings, 1 reply; 5+ messages in thread
From: Dhanunjanrao Katta @ 2026-11-17  8:57 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, linux-sound
  Cc: Vincenzo Frascino, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Michal Simek,
	devicetree, linux-kernel, linux-arm-kernel, git,
	Dhanunjanrao Katta

The SPDIF IP is fed by three clocks: the audio clock used at the
SPDIF/AES3 interface, the AXI4-Lite control clock and the AXI4-Stream
data clock. So far the binding described only two of them and carried
the audio clock frequency in the custom "xlnx,aud_clk_i" property.

Describe the AXI4-Stream clock and pick its name from the IP mode,
s_axis_aclk for the transmitter and m_axis_aclk for the receiver. The
minimum clock count stays at two, so that device trees written against
the earlier binding keep validating and the third clock is effectively
optional.

Mark "xlnx,aud_clk_i" deprecated instead of removing it. The frequency
it carries is available from the rate of the audio clock, but the
property is part of the published binding and device trees in the field
still pass it. As the binding sets "additionalProperties: false",
removing the property outright would make those device trees fail
validation.

Make "xlnx,spdif-mode" required. The conditional that selects the
AXI4-Stream clock name keys on that property, and a conditional with no
"required" entry of its own also matches when the property is absent.
A device tree omitting the mode would therefore have been held to the
transmitter clock name by default. Requiring the property turns the
omission into a clear validation failure instead.

Signed-off-by: Dhanunjanrao Katta <katta.dhanunjanrao@amd.com>
---
 .../devicetree/bindings/sound/xlnx,spdif.yaml | 54 +++++++++++++++----
 1 file changed, 44 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml b/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
index a45d8a0755fe..a4abca2027d3 100644
--- a/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
+++ b/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
@@ -14,6 +14,28 @@ maintainers:
 
 allOf:
   - $ref: dai-common.yaml#
+  - if:
+      properties:
+        xlnx,spdif-mode:
+          const: 1
+      required:
+        - xlnx,spdif-mode
+    then:
+      properties:
+        clock-names:
+          minItems: 2
+          items:
+            - const: aud_clk_i
+            - const: s_axi_aclk
+            - const: s_axis_aclk
+    else:
+      properties:
+        clock-names:
+          minItems: 2
+          items:
+            - const: aud_clk_i
+            - const: s_axi_aclk
+            - const: m_axis_aclk
 
 properties:
   compatible:
@@ -28,15 +50,15 @@ properties:
       - description: SPDIF audio interrupt
 
   clock-names:
-    items:
-      - const: aud_clk_i
-      - const: s_axi_aclk
+    minItems: 2
+    maxItems: 3
 
   clocks:
-    minItems: 1
+    minItems: 2
     items:
-      - description: input audio clock
-      - description: clock for the AXI data stream
+      - description: Audio clock input used at the SPDIF/AES3 interface
+      - description: AXI4-Lite clock
+      - description: AXI4-Stream clock
 
   xlnx,spdif-mode:
     $ref: /schemas/types.yaml#/definitions/uint32
@@ -49,8 +71,10 @@ properties:
 
   xlnx,aud_clk_i:
     $ref: /schemas/types.yaml#/definitions/uint32
+    deprecated: true
     description:
-      Input audio clock frequency. It affects the sampling rate.
+      Frequency of the audio clock input. Superseded by the rate of the
+      clock named aud_clk_i.
 
 required:
   - compatible
@@ -58,6 +82,7 @@ required:
   - interrupts
   - clock-names
   - clocks
+  - xlnx,spdif-mode
 
 additionalProperties: false
 
@@ -66,12 +91,21 @@ examples:
     spdif@80010000 {
       compatible = "xlnx,spdif-2.0";
       reg = <0x80010000 0x10000>;
-      clock-names = "aud_clk_i", "s_axi_aclk";
-      clocks = <&misc_clk_0>, <&clk 71>;
+      clock-names = "aud_clk_i", "s_axi_aclk", "s_axis_aclk";
+      clocks = <&misc_clk_0>, <&clk 71>, <&misc_clk_0>;
       interrupt-parent = <&gic>;
       interrupts = <0 91 4>;
       xlnx,spdif-mode = <1>;
-      xlnx,aud_clk_i = <49152913>;
+    };
+  - |
+    spdif@80090000 {
+      compatible = "xlnx,spdif-2.0";
+      reg = <0x80090000 0x10000>;
+      clock-names = "aud_clk_i", "s_axi_aclk", "m_axis_aclk";
+      clocks = <&misc_clk_0>, <&clk 71>, <&clk 71>;
+      interrupt-parent = <&gic>;
+      interrupts = <0 90 4>;
+      xlnx,spdif-mode = <0>;
     };
 
 ...
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ASoC: xlnx: spdif: namespace register macros and use a divider enum
  2026-11-17  8:57 [PATCH 0/3] ASoC: xlnx: spdif: switch to the common clock framework Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks Dhanunjanrao Katta
@ 2026-11-17  8:57 ` Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 3/3] ASoC: xlnx: spdif: get clocks through the common clock framework Dhanunjanrao Katta
  2 siblings, 0 replies; 5+ messages in thread
From: Dhanunjanrao Katta @ 2026-11-17  8:57 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, linux-sound
  Cc: Vincenzo Frascino, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Michal Simek,
	devicetree, linux-kernel, linux-arm-kernel, git,
	Dhanunjanrao Katta

The field defines were not named after the registers they belong to and
were listed apart from them, three driver constants carried no prefix at
all, and the clock-divider configuration values were written as bare
numbers at the assignment sites.

Name each field define after its register and group the field defines
under it, prefix the remaining driver constants with "XSPDIF_", and
replace the bare clock-divider values with the "xspdif_clk_div" enum,
giving clk_cfg that type.

The channel-status interrupt mask is written to both the status and the
enable register, so it is named for the field rather than for one of the
two registers.

Signed-off-by: Dhanunjanrao Katta <katta.dhanunjanrao@amd.com>
---
 sound/soc/xilinx/xlnx_spdif.c | 81 ++++++++++++++++++++---------------
 1 file changed, 46 insertions(+), 35 deletions(-)

diff --git a/sound/soc/xilinx/xlnx_spdif.c b/sound/soc/xilinx/xlnx_spdif.c
index 9fdafd45c381..a9d1fe9cc610 100644
--- a/sound/soc/xilinx/xlnx_spdif.c
+++ b/sound/soc/xilinx/xlnx_spdif.c
@@ -22,25 +22,34 @@
 
 #define XLNX_SPDIF_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
 
+#define XSPDIF_GLOBAL_IRQ_REG		0x1C
+#define XSPDIF_GLOBAL_IRQ_ENABLE_MASK	BIT(31)
 #define XSPDIF_IRQ_STS_REG		0x20
+#define XSPDIF_IRQ_CH_STS_MASK		BIT(5)
 #define XSPDIF_IRQ_ENABLE_REG		0x28
 #define XSPDIF_SOFT_RESET_REG		0x40
+#define XSPDIF_SOFT_RESET_VAL		0xA
 #define XSPDIF_CONTROL_REG		0x44
+#define XSPDIF_CONTROL_ENABLE_MASK	BIT(0)
+#define XSPDIF_CONTROL_FIFO_FLUSH_MASK	BIT(1)
+#define XSPDIF_CONTROL_CLK_CFG_MASK	GENMASK(5, 2)
+#define XSPDIF_CONTROL_CLK_CFG_SHIFT	2
 #define XSPDIF_CHAN_0_STS_REG		0x4C
-#define XSPDIF_GLOBAL_IRQ_ENABLE_REG	0x1C
 #define XSPDIF_CH_A_USER_DATA_REG_0	0x64
 
-#define XSPDIF_CORE_ENABLE_MASK		BIT(0)
-#define XSPDIF_FIFO_FLUSH_MASK		BIT(1)
-#define XSPDIF_CH_STS_MASK		BIT(5)
-#define XSPDIF_GLOBAL_IRQ_ENABLE	BIT(31)
-#define XSPDIF_CLOCK_CONFIG_BITS_MASK	GENMASK(5, 2)
-#define XSPDIF_CLOCK_CONFIG_BITS_SHIFT	2
-#define XSPDIF_SOFT_RESET_VALUE		0xA
-
-#define MAX_CHANNELS			2
-#define AES_SAMPLE_WIDTH		32
-#define CH_STATUS_UPDATE_TIMEOUT	40
+#define XSPDIF_MAX_CHANNELS		2
+#define XSPDIF_AES_SAMPLE_WIDTH		32
+#define XSPDIF_CH_STS_UPDATE_TIMEOUT	40
+
+enum xspdif_clk_div {
+	XSPDIF_CLK_DIV_BY_4,
+	XSPDIF_CLK_DIV_BY_8,
+	XSPDIF_CLK_DIV_BY_16,
+	XSPDIF_CLK_DIV_BY_24,
+	XSPDIF_CLK_DIV_BY_32,
+	XSPDIF_CLK_DIV_BY_48,
+	XSPDIF_CLK_DIV_BY_64,
+};
 
 struct spdif_dev_data {
 	u32 mode;
@@ -57,12 +66,12 @@ static irqreturn_t xlnx_spdifrx_irq_handler(int irq, void *arg)
 	struct spdif_dev_data *ctx = arg;
 
 	val = readl(ctx->base + XSPDIF_IRQ_STS_REG);
-	if (val & XSPDIF_CH_STS_MASK) {
-		writel(val & XSPDIF_CH_STS_MASK,
+	if (val & XSPDIF_IRQ_CH_STS_MASK) {
+		writel(val & XSPDIF_IRQ_CH_STS_MASK,
 		       ctx->base + XSPDIF_IRQ_STS_REG);
 		val = readl(ctx->base +
 			    XSPDIF_IRQ_ENABLE_REG);
-		writel(val & ~XSPDIF_CH_STS_MASK,
+		writel(val & ~XSPDIF_IRQ_CH_STS_MASK,
 		       ctx->base + XSPDIF_IRQ_ENABLE_REG);
 
 		ctx->rx_chsts_updated = true;
@@ -80,14 +89,14 @@ static int xlnx_spdif_startup(struct snd_pcm_substream *substream,
 	struct spdif_dev_data *ctx = dev_get_drvdata(dai->dev);
 
 	val = readl(ctx->base + XSPDIF_CONTROL_REG);
-	val |= XSPDIF_FIFO_FLUSH_MASK;
+	val |= XSPDIF_CONTROL_FIFO_FLUSH_MASK;
 	writel(val, ctx->base + XSPDIF_CONTROL_REG);
 
 	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
-		writel(XSPDIF_CH_STS_MASK,
+		writel(XSPDIF_IRQ_CH_STS_MASK,
 		       ctx->base + XSPDIF_IRQ_ENABLE_REG);
-		writel(XSPDIF_GLOBAL_IRQ_ENABLE,
-		       ctx->base + XSPDIF_GLOBAL_IRQ_ENABLE_REG);
+		writel(XSPDIF_GLOBAL_IRQ_ENABLE_MASK,
+		       ctx->base + XSPDIF_GLOBAL_IRQ_REG);
 	}
 
 	return 0;
@@ -98,48 +107,50 @@ static void xlnx_spdif_shutdown(struct snd_pcm_substream *substream,
 {
 	struct spdif_dev_data *ctx = dev_get_drvdata(dai->dev);
 
-	writel(XSPDIF_SOFT_RESET_VALUE, ctx->base + XSPDIF_SOFT_RESET_REG);
+	writel(XSPDIF_SOFT_RESET_VAL, ctx->base + XSPDIF_SOFT_RESET_REG);
 }
 
 static int xlnx_spdif_hw_params(struct snd_pcm_substream *substream,
 				struct snd_pcm_hw_params *params,
 				struct snd_soc_dai *dai)
 {
-	u32 val, clk_div, clk_cfg;
+	enum xspdif_clk_div clk_cfg;
+	u32 val, clk_div;
 	struct spdif_dev_data *ctx = dev_get_drvdata(dai->dev);
 
-	clk_div = DIV_ROUND_CLOSEST(ctx->aclk, MAX_CHANNELS * AES_SAMPLE_WIDTH *
+	clk_div = DIV_ROUND_CLOSEST(ctx->aclk, XSPDIF_MAX_CHANNELS *
+				    XSPDIF_AES_SAMPLE_WIDTH *
 				    params_rate(params));
 
 	switch (clk_div) {
 	case 4:
-		clk_cfg = 0;
+		clk_cfg = XSPDIF_CLK_DIV_BY_4;
 		break;
 	case 8:
-		clk_cfg = 1;
+		clk_cfg = XSPDIF_CLK_DIV_BY_8;
 		break;
 	case 16:
-		clk_cfg = 2;
+		clk_cfg = XSPDIF_CLK_DIV_BY_16;
 		break;
 	case 24:
-		clk_cfg = 3;
+		clk_cfg = XSPDIF_CLK_DIV_BY_24;
 		break;
 	case 32:
-		clk_cfg = 4;
+		clk_cfg = XSPDIF_CLK_DIV_BY_32;
 		break;
 	case 48:
-		clk_cfg = 5;
+		clk_cfg = XSPDIF_CLK_DIV_BY_48;
 		break;
 	case 64:
-		clk_cfg = 6;
+		clk_cfg = XSPDIF_CLK_DIV_BY_64;
 		break;
 	default:
 		return -EINVAL;
 	}
 
 	val = readl(ctx->base + XSPDIF_CONTROL_REG);
-	val &= ~XSPDIF_CLOCK_CONFIG_BITS_MASK;
-	val |= clk_cfg << XSPDIF_CLOCK_CONFIG_BITS_SHIFT;
+	val &= ~XSPDIF_CONTROL_CLK_CFG_MASK;
+	val |= clk_cfg << XSPDIF_CONTROL_CLK_CFG_SHIFT;
 	writel(val, ctx->base + XSPDIF_CONTROL_REG);
 
 	return 0;
@@ -149,7 +160,7 @@ static int rx_stream_detect(struct snd_soc_dai *dai)
 {
 	int err;
 	struct spdif_dev_data *ctx = dev_get_drvdata(dai->dev);
-	unsigned long jiffies = msecs_to_jiffies(CH_STATUS_UPDATE_TIMEOUT);
+	unsigned long jiffies = msecs_to_jiffies(XSPDIF_CH_STS_UPDATE_TIMEOUT);
 
 	/* start capture only if stream is detected within 40ms timeout */
 	err = wait_event_interruptible_timeout(ctx->chsts_q,
@@ -176,7 +187,7 @@ static int xlnx_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		val |= XSPDIF_CORE_ENABLE_MASK;
+		val |= XSPDIF_CONTROL_ENABLE_MASK;
 		writel(val, ctx->base + XSPDIF_CONTROL_REG);
 		if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
 			ret = rx_stream_detect(dai);
@@ -184,7 +195,7 @@ static int xlnx_spdif_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		val &= ~XSPDIF_CORE_ENABLE_MASK;
+		val &= ~XSPDIF_CONTROL_ENABLE_MASK;
 		writel(val, ctx->base + XSPDIF_CONTROL_REG);
 		break;
 	default:
@@ -287,7 +298,7 @@ static int xlnx_spdif_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	writel(XSPDIF_SOFT_RESET_VALUE, ctx->base + XSPDIF_SOFT_RESET_REG);
+	writel(XSPDIF_SOFT_RESET_VAL, ctx->base + XSPDIF_SOFT_RESET_REG);
 	dev_info(dev, "%s DAI registered\n", dai_drv->name);
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ASoC: xlnx: spdif: get clocks through the common clock framework
  2026-11-17  8:57 [PATCH 0/3] ASoC: xlnx: spdif: switch to the common clock framework Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks Dhanunjanrao Katta
  2026-11-17  8:57 ` [PATCH 2/3] ASoC: xlnx: spdif: namespace register macros and use a divider enum Dhanunjanrao Katta
@ 2026-11-17  8:57 ` Dhanunjanrao Katta
  2 siblings, 0 replies; 5+ messages in thread
From: Dhanunjanrao Katta @ 2026-11-17  8:57 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood, linux-sound
  Cc: Vincenzo Frascino, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Michal Simek,
	devicetree, linux-kernel, linux-arm-kernel, git,
	Dhanunjanrao Katta

The driver requested only the AXI4-Lite clock and relied on the firmware
to leave the AXI4-Stream and audio clocks enabled, and it took the audio
clock rate from the "xlnx,aud_clk_i" device-tree property.

Request and enable the audio clock, and the AXI4-Stream clock matching
the IP mode, through the common clock framework. The AXI4-Stream clock
is requested with devm_clk_get_optional_enabled() because device trees
written against the earlier binding describe only two clocks.

Read the audio rate with clk_get_rate() in hw_params so that the SPDIF
clock divider follows the rate actually in effect, and reject a zero
rate with a diagnostic rather than letting it reach the divider switch
and return a bare -EINVAL.

"xlnx,aud_clk_i" is no longer read and is marked deprecated in the
binding.

Signed-off-by: Dhanunjanrao Katta <katta.dhanunjanrao@amd.com>
---
 sound/soc/xilinx/xlnx_spdif.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/sound/soc/xilinx/xlnx_spdif.c b/sound/soc/xilinx/xlnx_spdif.c
index a9d1fe9cc610..b233ab1a92dc 100644
--- a/sound/soc/xilinx/xlnx_spdif.c
+++ b/sound/soc/xilinx/xlnx_spdif.c
@@ -53,10 +53,11 @@ enum xspdif_clk_div {
 
 struct spdif_dev_data {
 	u32 mode;
-	u32 aclk;
 	bool rx_chsts_updated;
 	void __iomem *base;
 	struct clk *axi_clk;
+	struct clk *axis_clk;
+	struct clk *aud_clk;
 	wait_queue_head_t chsts_q;
 };
 
@@ -117,8 +118,15 @@ static int xlnx_spdif_hw_params(struct snd_pcm_substream *substream,
 	enum xspdif_clk_div clk_cfg;
 	u32 val, clk_div;
 	struct spdif_dev_data *ctx = dev_get_drvdata(dai->dev);
+	unsigned long rate;
 
-	clk_div = DIV_ROUND_CLOSEST(ctx->aclk, XSPDIF_MAX_CHANNELS *
+	rate = clk_get_rate(ctx->aud_clk);
+	if (!rate) {
+		dev_err(dai->dev, "aud_clk_i rate is not available\n");
+		return -EINVAL;
+	}
+
+	clk_div = DIV_ROUND_CLOSEST(rate, XSPDIF_MAX_CHANNELS *
 				    XSPDIF_AES_SAMPLE_WIDTH *
 				    params_rate(params));
 
@@ -271,8 +279,18 @@ static int xlnx_spdif_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, ret, "cannot get SPDIF mode\n");
 
 	if (ctx->mode) {
+		ctx->axis_clk = devm_clk_get_optional_enabled(dev, "s_axis_aclk");
+		if (IS_ERR(ctx->axis_clk))
+			return dev_err_probe(dev, PTR_ERR(ctx->axis_clk),
+					     "failed to get s_axis_aclk\n");
+
 		dai_drv = &xlnx_spdif_tx_dai;
 	} else {
+		ctx->axis_clk = devm_clk_get_optional_enabled(dev, "m_axis_aclk");
+		if (IS_ERR(ctx->axis_clk))
+			return dev_err_probe(dev, PTR_ERR(ctx->axis_clk),
+					     "failed to get m_axis_aclk\n");
+
 		ret = platform_get_irq(pdev, 0);
 		if (ret < 0)
 			return ret;
@@ -287,9 +305,10 @@ static int xlnx_spdif_probe(struct platform_device *pdev)
 		dai_drv = &xlnx_spdif_rx_dai;
 	}
 
-	ret = device_property_read_u32(dev, "xlnx,aud_clk_i", &ctx->aclk);
-	if (ret < 0)
-		return dev_err_probe(dev, ret, "cannot get aud_clk_i value\n");
+	ctx->aud_clk = devm_clk_get_enabled(dev, "aud_clk_i");
+	if (IS_ERR(ctx->aud_clk))
+		return dev_err_probe(dev, PTR_ERR(ctx->aud_clk),
+				     "failed to get aud_clk_i\n");
 
 	dev_set_drvdata(dev, ctx);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks
  2026-11-17  8:57 ` [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks Dhanunjanrao Katta
@ 2026-11-17 10:06   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-17 10:06 UTC (permalink / raw)
  To: Dhanunjanrao Katta, Mark Brown, Liam Girdwood, linux-sound
  Cc: Vincenzo Frascino, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Jaroslav Kysela, Takashi Iwai, Michal Simek,
	devicetree, linux-kernel, linux-arm-kernel, git

On 17/11/2026 09:57, Dhanunjanrao Katta wrote:
> The SPDIF IP is fed by three clocks: the audio clock used at the
> SPDIF/AES3 interface, the AXI4-Lite control clock and the AXI4-Stream
> data clock. So far the binding described only two of them and carried
> the audio clock frequency in the custom "xlnx,aud_clk_i" property.
> 
> Describe the AXI4-Stream clock and pick its name from the IP mode,
> s_axis_aclk for the transmitter and m_axis_aclk for the receiver. The
> minimum clock count stays at two, so that device trees written against
> the earlier binding keep validating and the third clock is effectively
> optional.
> 
> Mark "xlnx,aud_clk_i" deprecated instead of removing it. The frequency
> it carries is available from the rate of the audio clock, but the
> property is part of the published binding and device trees in the field
> still pass it. As the binding sets "additionalProperties: false",
> removing the property outright would make those device trees fail
> validation.
> 
> Make "xlnx,spdif-mode" required. The conditional that selects the

That's ABI break.

> AXI4-Stream clock name keys on that property, and a conditional with no
> "required" entry of its own also matches when the property is absent.
> A device tree omitting the mode would therefore have been held to the
> transmitter clock name by default. Requiring the property turns the
> omission into a clear validation failure instead.

You need to explain why, not what. Entire commit msg looks LLM written,
honestly difficult to parse. LLM is not supposed to be used to write
commit msg, because it means you did not understand what you did here.

> 
> Signed-off-by: Dhanunjanrao Katta <katta.dhanunjanrao@amd.com>
> ---
>  .../devicetree/bindings/sound/xlnx,spdif.yaml | 54 +++++++++++++++----
>  1 file changed, 44 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml b/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
> index a45d8a0755fe..a4abca2027d3 100644
> --- a/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
> +++ b/Documentation/devicetree/bindings/sound/xlnx,spdif.yaml
> @@ -14,6 +14,28 @@ maintainers:
>  
>  allOf:
>    - $ref: dai-common.yaml#
> +  - if:

Move allOf to the bottom, before additional/unevaluatedProps

> +      properties:
> +        xlnx,spdif-mode:
> +          const: 1
> +      required:
> +        - xlnx,spdif-mode
> +    then:
> +      properties:
> +        clock-names:
> +          minItems: 2
> +          items:
> +            - const: aud_clk_i
> +            - const: s_axi_aclk
> +            - const: s_axis_aclk
> +    else:
> +      properties:
> +        clock-names:
> +          minItems: 2
> +          items:
> +            - const: aud_clk_i
> +            - const: s_axi_aclk
> +            - const: m_axis_aclk

That's the same clock. Just call it "axis"


>  
>  properties:
>    compatible:
> @@ -28,15 +50,15 @@ properties:
>        - description: SPDIF audio interrupt
>  
>    clock-names:
> -    items:
> -      - const: aud_clk_i
> -      - const: s_axi_aclk
> +    minItems: 2
> +    maxItems: 3

List stays here with minItems

>  
>    clocks:
> -    minItems: 1
> +    minItems: 2
>      items:
> -      - description: input audio clock
> -      - description: clock for the AXI data stream
> +      - description: Audio clock input used at the SPDIF/AES3 interface
> +      - description: AXI4-Lite clock
> +      - description: AXI4-Stream clock
>  
>    xlnx,spdif-mode:
>      $ref: /schemas/types.yaml#/definitions/uint32
> @@ -49,8 +71,10 @@ properties:
>  
>    xlnx,aud_clk_i:
>      $ref: /schemas/types.yaml#/definitions/uint32
> +    deprecated: true
>      description:
> -      Input audio clock frequency. It affects the sampling rate.
> +      Frequency of the audio clock input. Superseded by the rate of the
> +      clock named aud_clk_i.
>  
>  required:
>    - compatible
> @@ -58,6 +82,7 @@ required:
>    - interrupts
>    - clock-names
>    - clocks
> +  - xlnx,spdif-mode

ABI break


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-17 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17  8:57 [PATCH 0/3] ASoC: xlnx: spdif: switch to the common clock framework Dhanunjanrao Katta
2026-11-17  8:57 ` [PATCH 1/3] ASoC: dt-bindings: xlnx,spdif: describe AXI4-Stream and audio clocks Dhanunjanrao Katta
2026-11-17 10:06   ` Krzysztof Kozlowski
2026-11-17  8:57 ` [PATCH 2/3] ASoC: xlnx: spdif: namespace register macros and use a divider enum Dhanunjanrao Katta
2026-11-17  8:57 ` [PATCH 3/3] ASoC: xlnx: spdif: get clocks through the common clock framework Dhanunjanrao Katta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®