allwinner: a523: Enable I2S and SPDIF TX

Merge series from Chen-Yu Tsai <wens@kernel.org>:

This series enables the SPDIF and I2S hardware found on the Allwinner
A523/A527/T527 family SoCs. These SoCs have one SPDIF interface and
four I2S interfaces. All of them are capable of both playback and
capture, however the SPDIF driver only supports playback.
This commit is contained in:
Mark Brown 2025-10-28 14:27:46 +00:00
commit 250eddd69d
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 65 additions and 9 deletions

View File

@ -33,7 +33,9 @@ properties:
- const: allwinner,sun50i-h6-i2s
- const: allwinner,sun50i-r329-i2s
- items:
- const: allwinner,sun20i-d1-i2s
- enum:
- allwinner,sun20i-d1-i2s
- allwinner,sun55i-a523-i2s
- const: allwinner,sun50i-r329-i2s
reg:

View File

@ -23,6 +23,7 @@ properties:
- const: allwinner,sun8i-h3-spdif
- const: allwinner,sun50i-h6-spdif
- const: allwinner,sun50i-h616-spdif
- const: allwinner,sun55i-a523-spdif
- items:
- const: allwinner,sun8i-a83t-spdif
- const: allwinner,sun8i-h3-spdif
@ -37,14 +38,12 @@ properties:
maxItems: 1
clocks:
items:
- description: Bus Clock
- description: Module Clock
minItems: 2
maxItems: 3
clock-names:
items:
- const: apb
- const: spdif
minItems: 2
maxItems: 3
# Even though it only applies to subschemas under the conditionals,
# not listing them here will trigger a warning because of the
@ -65,6 +64,7 @@ allOf:
- allwinner,sun8i-h3-spdif
- allwinner,sun50i-h6-spdif
- allwinner,sun50i-h616-spdif
- allwinner,sun55i-a523-spdif
then:
required:
@ -98,6 +98,38 @@ allOf:
- const: rx
- const: tx
- if:
properties:
compatible:
contains:
enum:
- allwinner,sun55i-a523-spdif
then:
properties:
clocks:
items:
- description: Bus Clock
- description: TX Clock
- description: RX Clock
clock-names:
items:
- const: apb
- const: tx
- const: rx
else:
properties:
clocks:
items:
- description: Bus Clock
- description: Module Clock
clock-names:
items:
- const: apb
- const: spdif
required:
- "#sound-dai-cells"
- compatible

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