public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: "Jernej Škrabec" <jernej.skrabec@gmail.com>
To: Chen-Yu Tsai <wens@kernel.org>,
	Jernej Skrabec <jernej@kernel.org>,
	Samuel Holland <samuel@sholland.org>,
	Mark Brown <broonie@kernel.org>, Stephen Boyd <sboyd@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Vinod Koul <vkoul@kernel.org>,
	Chen-Yu Tsai <wens@kernel.org>
Cc: linux-sunxi@lists.linux.dev, linux-sound@vger.kernel.org,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, dmaengine@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 04/11] ASoC: sun4i-spdif: Support SPDIF output on A523 family
Date: Mon, 20 Oct 2025 19:49:34 +0200	[thread overview]
Message-ID: <13867454.uLZWGnKmhe@jernej-laptop> (raw)
In-Reply-To: <20251020171059.2786070-5-wens@kernel.org>

Hi,

Dne ponedeljek, 20. oktober 2025 ob 19:10:50 Srednjeevropski poletni čas je Chen-Yu Tsai napisal(a):
> 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>
> ---
>  sound/soc/sunxi/sun4i-spdif.c | 28 +++++++++++++++++++++++++---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c
> index 34e5bd94e9af..6a58dc4311de 100644
> --- a/sound/soc/sunxi/sun4i-spdif.c
> +++ b/sound/soc/sunxi/sun4i-spdif.c
> @@ -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 {
> @@ -323,6 +324,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,
>  	}
>  	mclk *= host->quirks->mclk_multiplier;
>  
> +	dev_info(&pdev->dev, "Setting SPDIF clock rate to %u\n", mclk);
>  	ret = clk_set_rate(host->spdif_clk, mclk);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev,
> @@ -542,7 +544,6 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {
>  		.formats = SUN4I_FORMATS,
>  	},
>  	.ops = &sun4i_spdif_dai_ops,
> -	.name = "spdif",

Why this change?

>  };
>  
>  static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = {
> @@ -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";

Reverse tree?

Otherwise it looks good.

Best regards,
Jernej

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






  reply	other threads:[~2025-10-20 17:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 17:10 [PATCH 00/11] allwinner: a523: Enable I2S and SPDIF TX Chen-Yu Tsai
2025-10-20 17:10 ` [PATCH 01/11] dt-bindings: dma: allwinner,sun50i-a64-dma: Add compatibles for A523 Chen-Yu Tsai
2025-10-20 17:37   ` Conor Dooley
2025-10-20 17:10 ` [PATCH 02/11] ASoC: dt-bindings: allwinner,sun4i-a10-i2s: Add compatible " Chen-Yu Tsai
2025-10-20 17:38   ` Conor Dooley
2025-10-20 17:10 ` [PATCH 03/11] ASoC: dt-bindings: allwinner,sun4i-a10-spdif: " Chen-Yu Tsai
2025-10-20 17:38   ` Conor Dooley
2025-10-20 17:10 ` [PATCH 04/11] ASoC: sun4i-spdif: Support SPDIF output on A523 family Chen-Yu Tsai
2025-10-20 17:49   ` Jernej Škrabec [this message]
2025-10-21  3:50     ` Chen-Yu Tsai
2025-10-21 12:55   ` kernel test robot
2025-10-20 17:10 ` [PATCH 05/11] clk: sunxi-ng: sun55i-a523-r-ccu: Mark bus-r-dma as critical Chen-Yu Tsai
2025-10-20 17:51   ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 06/11] clk: sunxi-ng: sun55i-a523-ccu: Lower audio0 pll minimum rate Chen-Yu Tsai
2025-10-20 17:52   ` Jernej Škrabec
2025-10-20 18:09     ` Chen-Yu Tsai
2025-10-20 18:22       ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 07/11] arm64: dts: allwinner: a523: Add DMA controller device nodes Chen-Yu Tsai
2025-10-20 17:57   ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 08/11] arm64: dts: allwinner: a523: Add device node for SPDIF block Chen-Yu Tsai
2025-10-20 17:58   ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 09/11] arm64: dts: allwinner: a523: Add device nodes for I2S controllers Chen-Yu Tsai
2025-10-20 17:59   ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 10/11] arm64: dts: allwinner: a523: Add I2S2 pins on PI pin group Chen-Yu Tsai
2025-10-20 18:00   ` Jernej Škrabec
2025-10-20 17:10 ` [PATCH 11/11] [EXAMPLE] arm64: dts: allwinner: a527-cubie-a5e: Enable I2S and SPDIF output Chen-Yu Tsai
2025-10-21 21:14   ` kernel test robot
2025-10-22 19:07 ` (subset) [PATCH 00/11] allwinner: a523: Enable I2S and SPDIF TX Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=13867454.uLZWGnKmhe@jernej-laptop \
    --to=jernej.skrabec@gmail.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=jernej@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox