[PATCH 2/4] ASoC: xlnx: formatter: get the stream and audio clocks
From: Dhanunjanrao Katta
Date: Wed Nov 25 2026 - 06:49:14 EST
The driver only requests s_axi_lite_aclk. The audio master clock and
the AXI4-Stream clock of each data mover are used but never claimed,
so the formatter works only for as long as something else in the
design keeps them running.
Request them through the common clock framework. The stream clock is
taken in the branch that already checks the core configuration
register for its data mover, so a playback only or capture only design
is not asked for a clock it does not have.
All three are optional. The binding lets a device tree name
s_axi_lite_aclk alone and those device trees have to keep working.
Signed-off-by: Dhanunjanrao Katta <katta.dhanunjanrao@xxxxxxx>
---
sound/soc/xilinx/xlnx_formatter_pcm.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/sound/soc/xilinx/xlnx_formatter_pcm.c b/sound/soc/xilinx/xlnx_formatter_pcm.c
index 2699bef216b1..fa7419439ec7 100644
--- a/sound/soc/xilinx/xlnx_formatter_pcm.c
+++ b/sound/soc/xilinx/xlnx_formatter_pcm.c
@@ -596,12 +596,17 @@ static int xlnx_formatter_pcm_probe(struct platform_device *pdev)
u32 val;
struct xlnx_pcm_drv_data *aud_drv_data;
struct device *dev = &pdev->dev;
- struct clk *axi_clk;
+ struct clk *axi_clk, *aud_mclk, *axis_clk;
axi_clk = devm_clk_get_enabled(dev, "s_axi_lite_aclk");
if (IS_ERR(axi_clk))
return dev_err_probe(dev, PTR_ERR(axi_clk), "failed to get s_axi_lite_aclk");
+ aud_mclk = devm_clk_get_optional_enabled(dev, "aud_mclk");
+ if (IS_ERR(aud_mclk))
+ return dev_err_probe(dev, PTR_ERR(aud_mclk),
+ "failed to get aud_mclk\n");
+
aud_drv_data = devm_kzalloc_obj(dev, *aud_drv_data);
if (!aud_drv_data)
return -ENOMEM;
@@ -612,6 +617,12 @@ static int xlnx_formatter_pcm_probe(struct platform_device *pdev)
val = readl(aud_drv_data->mmio + XLNX_AUD_CORE_CONFIG);
if (val & AUD_CFG_MM2S_MASK) {
+ axis_clk = devm_clk_get_optional_enabled(dev,
+ "m_axis_mm2s_aclk");
+ if (IS_ERR(axis_clk))
+ return dev_err_probe(dev, PTR_ERR(axis_clk),
+ "failed to get m_axis_mm2s_aclk\n");
+
aud_drv_data->mm2s_presence = true;
ret = xlnx_formatter_pcm_reset(aud_drv_data->mmio +
XLNX_MM2S_OFFSET);
@@ -633,6 +644,12 @@ static int xlnx_formatter_pcm_probe(struct platform_device *pdev)
return ret;
}
if (val & AUD_CFG_S2MM_MASK) {
+ axis_clk = devm_clk_get_optional_enabled(dev,
+ "s_axis_s2mm_aclk");
+ if (IS_ERR(axis_clk))
+ return dev_err_probe(dev, PTR_ERR(axis_clk),
+ "failed to get s_axis_s2mm_aclk\n");
+
aud_drv_data->s2mm_presence = true;
ret = xlnx_formatter_pcm_reset(aud_drv_data->mmio +
XLNX_S2MM_OFFSET);
--
2.34.1