ASoC: sun4i-spdif: Support SPDIF output on A523 family

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>
This commit is contained in:
Chen-Yu Tsai
2025-10-27 20:56:45 +08:00
committed by Mark Brown
parent 6ddcd78aa7
commit 4a5ac6cd05

View 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);
}