]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: sun4i-spdif: Support SPDIF output on A523 family
authorChen-Yu Tsai <wens@kernel.org>
Mon, 27 Oct 2025 12:56:45 +0000 (20:56 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 27 Oct 2025 18:04:06 +0000 (18:04 +0000)
The TX side of the SPDIF block on the A523 is almost the same the
previous generations, the only difference being that it has separate
module clock inputs for the TX and RX side.

Since this driver currently only supports TX, add support for a
different clock name so that TX and RX clocks can be separated
if RX support is ever added. Then add support for the A523.

Signed-off-by: Chen-Yu Tsai <wens@kernel.org>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Link: https://patch.msgid.link/20251027125655.793277-5-wens@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sunxi/sun4i-spdif.c

index 34e5bd94e9af66cbc4346f3464e44ce4d8835caf..2e7ac8ab71bb1cc593cca0200a35914582cb5b7f 100644 (file)
@@ -177,6 +177,7 @@ struct sun4i_spdif_quirks {
        bool has_reset;
        unsigned int val_fctl_ftx;
        unsigned int mclk_multiplier;
+       const char *tx_clk_name;
 };
 
 struct sun4i_spdif_dev {
@@ -572,6 +573,14 @@ static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = {
        .mclk_multiplier = 1,
 };
 
+static const struct sun4i_spdif_quirks sun55i_a523_spdif_quirks = {
+       .reg_dac_txdata = SUN8I_SPDIF_TXFIFO,
+       .val_fctl_ftx   = SUN50I_H6_SPDIF_FCTL_FTX,
+       .has_reset      = true,
+       .mclk_multiplier = 1,
+       .tx_clk_name    = "tx",
+};
+
 static const struct of_device_id sun4i_spdif_of_match[] = {
        {
                .compatible = "allwinner,sun4i-a10-spdif",
@@ -594,6 +603,15 @@ static const struct of_device_id sun4i_spdif_of_match[] = {
                /* Essentially the same as the H6, but without RX */
                .data = &sun50i_h6_spdif_quirks,
        },
+       {
+               .compatible = "allwinner,sun55i-a523-spdif",
+               /*
+                * Almost the same as H6, but has split the TX and RX clocks,
+                * has a separate reset bit for the RX side, and has some
+                * expanded features for the RX side.
+                */
+               .data = &sun55i_a523_spdif_quirks,
+       },
        { /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match);
@@ -635,6 +653,7 @@ static int sun4i_spdif_probe(struct platform_device *pdev)
        const struct sun4i_spdif_quirks *quirks;
        int ret;
        void __iomem *base;
+       const char *tx_clk_name = "spdif";
 
        dev_dbg(&pdev->dev, "Entered %s\n", __func__);
 
@@ -671,9 +690,12 @@ static int sun4i_spdif_probe(struct platform_device *pdev)
                return PTR_ERR(host->apb_clk);
        }
 
-       host->spdif_clk = devm_clk_get(&pdev->dev, "spdif");
+       if (quirks->tx_clk_name)
+               tx_clk_name = quirks->tx_clk_name;
+       host->spdif_clk = devm_clk_get(&pdev->dev, tx_clk_name);
        if (IS_ERR(host->spdif_clk)) {
-               dev_err(&pdev->dev, "failed to get a spdif clock.\n");
+               dev_err(&pdev->dev, "failed to get the \"%s\" clock.\n",
+                       tx_clk_name);
                return PTR_ERR(host->spdif_clk);
        }