Skip to contentSkip to conversation

RK3588 Audio Support

PATCH In review Nicolas Frattaroli 3 participants 9 messages Oct 25, 2022 – Nov 25, 2022

Subsystems (5)
lore
Share & tools
lore

Nicolas Frattaroli

author maintainer
#0 lore raw

cover RK3588 Audio Support

This patchset refactors the Rockchip I2S/TDM driver in order to support the RK3588 SoC, and then adds the necessary compatible string to load the driver for it.

Patch 1 rectifies a problem with the bindings where we were too strict about requiring the rockchip,grf property. Most features of this audio device don't need access to the GRF to function.

Patch 2 modifies the driver to adjust its behaviour to what the changed bindings now allow, namely using most things without the GRF.

Patch 3 and 4 are boring compatible string stuff that enables RK3588 support. No special data is needed to initialise the driver for this instance of the I2S/TDM IP.

Nicolas Frattaroli (4):
ASoC: dt-bindings: rockchip: i2s-tdm: Make grf property optional
ASoC: rockchip: i2s_tdm: Make the grf property optional
ASoC: dt-bindings: rockchip: i2s-tdm: Add RK3588 compatible
ASoC: rockchip: i2s_tdm: Add support for RK3588

 .../bindings/sound/rockchip,i2s-tdm.yaml      |  2 +-
 sound/soc/rockchip/rockchip_i2s_tdm.c         | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)
Signature · 1 line
2.38.1
author maintainer
#1 lore raw

PATCH 1/4 ASoC: dt-bindings: rockchip: i2s-tdm: Make grf property optional

Turns out most things don't require the GRF, so making the property optional is the obvious move.

---
 Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml | 1 -
 1 file changed, 1 deletion(-)
Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml +0 -1
index 6a7c004bef17..8646cdc692d7 100644
@@ -135,7 +135,6 @@ required:
   - clock-names
   - resets
   - reset-names
-  - rockchip,grf
   - "#sound-dai-cells"
 
 additionalProperties: false
Signature · 1 line
2.38.1
author maintainer
#3 lore raw

PATCH 2/4 ASoC: rockchip: i2s_tdm: Make the grf property optional

In reply to Nicolas Frattaroli

Only IO Multiplex and two TRCM modes need access to the GRF, so making it a hard requirement is not a wise idea, as it complicates support for newer SoCs which do not do these things.

---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +12 -4
index 2550bd2a5e78..917f17107891 100644
@@ -756,6 +756,12 @@ static int rockchip_i2s_io_multiplex(struct snd_pcm_substream *substream,
 	if (!i2s_tdm->io_multiplex)
 		return 0;
 
+	if (IS_ERR_OR_NULL(i2s_tdm->grf)) {
+		dev_err(i2s_tdm->dev,
+			"io multiplex not supported for this device\n");
+		return -EINVAL;
+	}
+
 	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
 		struct snd_pcm_str *playback_str =
 			&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
@@ -1222,6 +1228,12 @@ static int common_soc_init(struct device *dev, u32 addr)
 	if (trcm == TRCM_TXRX)
 		return 0;
 
+	if (IS_ERR_OR_NULL(i2s_tdm->grf)) {
+		dev_err(i2s_tdm->dev,
+			"no grf present but non-txrx TRCM specified\n");
+		return -EINVAL;
+	}
+
 	for (i = 0; i < i2s_tdm->soc_data->config_count; i++) {
 		if (addr != configs[i].addr)
 			continue;
@@ -1568,10 +1580,6 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
 		return ret;
 
 	i2s_tdm->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
-	if (IS_ERR(i2s_tdm->grf))
-		return dev_err_probe(i2s_tdm->dev, PTR_ERR(i2s_tdm->grf),
-				     "Error in rockchip,grf\n");
-
 	i2s_tdm->tx_reset = devm_reset_control_get_optional_exclusive(&pdev->dev,
 								      "tx-m");
 	if (IS_ERR(i2s_tdm->tx_reset)) {
Signature · 1 line
2.38.1
author maintainer
#4 lore raw

PATCH 3/4 ASoC: dt-bindings: rockchip: i2s-tdm: Add RK3588 compatible

In reply to Nicolas Frattaroli

This adds the compatible string for the RK3588 SoC.

---
 Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml +1 -0
index 8646cdc692d7..0503f4f3fb1a 100644
@@ -21,6 +21,7 @@ properties:
       - rockchip,rk1808-i2s-tdm
       - rockchip,rk3308-i2s-tdm
       - rockchip,rk3568-i2s-tdm
+      - rockchip,rk3588-i2s-tdm
       - rockchip,rv1126-i2s-tdm
 
   reg:
Signature · 1 line
2.38.1
author maintainer
#6 lore raw

PATCH 4/4 ASoC: rockchip: i2s_tdm: Add support for RK3588

In reply to Nicolas Frattaroli

This adds support for the RK3588 SoC to the I2S/TDM driver.

---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +2 -1
index 917f17107891..08b90ec5cc80 100644
@@ -1318,6 +1318,7 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = {
 	{ .compatible = "rockchip,rk1808-i2s-tdm", .data = &rk1808_i2s_soc_data },
 	{ .compatible = "rockchip,rk3308-i2s-tdm", .data = &rk3308_i2s_soc_data },
 	{ .compatible = "rockchip,rk3568-i2s-tdm", .data = &rk3568_i2s_soc_data },
+	{ .compatible = "rockchip,rk3588-i2s-tdm" },
 	{ .compatible = "rockchip,rv1126-i2s-tdm", .data = &rv1126_i2s_soc_data },
 	{},
 };
@@ -1556,7 +1557,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
 	i2s_tdm->dev = &pdev->dev;
 
 	of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev);
-	if (!of_id || !of_id->data)
+	if (!of_id)
 		return -EINVAL;
 
 	spin_lock_init(&i2s_tdm->lock);
Signature · 1 line
2.38.1
author maintainer
#7 lore raw

Re: [PATCH 4/4] ASoC: rockchip: i2s_tdm: Add support for RK3588

Quoted 19 lines · On Dienstag, 25. Oktober 2022 14:41:32 CEST Nicolas Frattaroli wrote:

This adds support for the RK3588 SoC to the I2S/TDM driver.

---
 sound/soc/rockchip/rockchip_i2s_tdm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/rockchip/rockchip_i2s_tdm.c +1 -0
index 917f17107891..08b90ec5cc80 100644
@@ -1318,6 +1318,7 @@ static const struct of_device_id rockchip_i2s_tdm_match[] = {
 	{ .compatible = "rockchip,rk1808-i2s-tdm", .data = &rk1808_i2s_soc_data },
 	{ .compatible = "rockchip,rk3308-i2s-tdm", .data = &rk3308_i2s_soc_data },
 	{ .compatible = "rockchip,rk3568-i2s-tdm", .data = &rk3568_i2s_soc_data },
+	{ .compatible = "rockchip,rk3588-i2s-tdm" },
 	{ .compatible = "rockchip,rv1126-i2s-tdm", .data = &rv1126_i2s_soc_data },
 	{},
 };

sound/soc/rockchip/rockchip_i2s_tdm.c static int rockchip_i2s_tdm_probe(struct platform_device *pdev) · line 1563

Quoted 8 lines
sound/soc/rockchip/rockchip_i2s_tdm.c +1 -1
@@ -1556,7 +1557,7 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
 	i2s_tdm->dev = &pdev->dev;
 
 	of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev);
-	if (!of_id || !of_id->data)
+	if (!of_id)
 		return -EINVAL;
 
 	spin_lock_init(&i2s_tdm->lock);

Oops, forgot the signoff on this one.
For this purpose:

My apologies.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

maintainer
#8 lore raw
In reply to Nicolas Frattaroli
Quoted 9 lines · Nicolas Frattaroli

This patchset refactors the Rockchip I2S/TDM driver in order to support the RK3588 SoC, and then adds the necessary compatible string to load the driver for it.

Patch 1 rectifies a problem with the bindings where we were too strict about requiring the rockchip,grf property. Most features of this audio device don't need access to the GRF to function.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: dt-bindings: rockchip: i2s-tdm: Make grf property optional

      commit: 1024a5b29e90a18530588b3f161e81cf3fae7dcf
[2/4] ASoC: rockchip: i2s_tdm: Make the grf property optional
      commit: d980004e349049a3fcbffc6096d14896f6a122ed
[3/4] ASoC: dt-bindings: rockchip: i2s-tdm: Add RK3588 compatible
      commit: 0643fd3669f5c33bab5b05a813459a2d00a83465
[4/4] ASoC: rockchip: i2s_tdm: Add support for RK3588
      commit: c619bd4268ff9895760dab303b4eb15ed3d0f7e9

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark