ASoC: Extended SPDIF support to Allwinner A31 SoCs
Subsystems (4)
cover ASoC: Extended SPDIF support to Allwinner A31 SoCs
From: Marcus Cooper <[email protected]>
This patch set extends the current support of the Allwinner SPDIF transceiver to include the A31 SoC.
For now just the SPDIF transmitter has been tested on the Mele I7.
In order for this patch set to be functional then we require changes to the clocks and the device tree. For those that are interested I've pushed all the required patches here
https://github.com/codekipper/linux-sunxi/commits/a31-spdif
Thanks in advance,
CK
Marcus Cooper (2):
ASoC: sunxi: Add bindings for sun6i to SPDIF
ASoC: sunxi: compatibility for sun6i to SPDIF
.../devicetree/bindings/sound/sunxi,sun4i-spdif.txt | 3 +++ sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.2
PATCH 1/2 ASoC: sunxi: Add bindings for sun6i to SPDIF
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
--- Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +3 -0
@@ -9,6 +9,7 @@ Required properties: - compatible : should be one of the following: - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC + - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC - reg : Offset and length of the register set for the device.
@@ -25,6 +26,8 @@ Required properties: "apb" clock for the spdif bus. "spdif" clock for spdif controller. + - reset : reset specifier for the ahb reset (A31 and newer only) + Example: spdif: spdif@01c21000 {
Signature · 1 line
2.9.2
PATCH 2/2 ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to [email protected]From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
--- sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/sunxi/sun4i-spdif.c +16 -1
@@ -29,6 +29,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
@@ -162,6 +163,7 @@ struct sun4i_spdif_dev {struct platform_device *pdev;struct clk *spdif_clk;struct clk *apb_clk; +struct reset_control *rst;struct snd_soc_dai_driver cpu_dai_drv;struct regmap *regmap;struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -411,6 +413,7 @@ static const struct snd_soc_dapm_route dit_routes[] = {static const struct of_device_id sun4i_spdif_of_match[] = { { .compatible ="allwinner,sun4i-a10-spdif" , }, + { .compatible ="allwinner,sun6i-a31-spdif" , }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, sun4i_spdif_of_match);
@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) } host->dma_params_tx.addr = res->start +SUN4I_SPDIF_TXFIFO ; - host->dma_params_tx.maxburst =4 ; + host->dma_params_tx.maxburst =8 ; host->dma_params_tx.addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ;platform_set_drvdata (pdev, host); +if (of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun6i-a31-spdif" )) { + host->rst =devm_reset_control_get_optional (&pdev->dev,NULL ); +if (IS_ERR (host->rst) &&PTR_ERR (host->rst) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; +dev_err (&pdev->dev,"Failed to get reset: %d\n" , ret); + goto err_disable_apb_clk; + } +if (!IS_ERR (host->rst)) +reset_control_deassert (host->rst); + } + ret =devm_snd_soc_register_component (&pdev->dev, &sun4i_spdif_component, &sun4i_spdif_dai,1 );if (ret)
Signature · 1 line
2.9.2
Re: [linux-sunxi] [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
Hi Marcus,
Quoted 19 lines · On Sun, Jul 31, 2016 at 12:27 AM, <[email protected]…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
Signed-off-by Marcus Cooper <[email protected]>--- sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)sound/soc/sunxi/sun4i-spdif.c +0
-0@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) }
sound/soc/sunxi/sun4i-spdif.c static int sun4i_spdif_probe(struct platform_device *pdev) · line 494
Quoted 10 lines
sound/soc/sunxi/sun4i-spdif.c +3
-1host->dma_params_tx.addr = res->start +SUN4I_SPDIF_TXFIFO ; - host->dma_params_tx.maxburst =4 ; + host->dma_params_tx.maxburst =8 ; host->dma_params_tx.addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ;platform_set_drvdata (pdev, host); +if (of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun6i-a31-spdif" )) {
Given how much Allwinner likes to shuffle stuff around with each SoC generation, would it make sense to add a flag for this in some compatible specific config structure instead of checking against the compatible?
Thanks,
Signature · 4 lines
Julian Calaby Email: [email protected] Profile: http://www.google.com/profiles/julian.calaby/
Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to a message not in the archive30.07.2016, 22:45, "[email protected]" <[email protected]>:
Quoted 53 lines
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
Signed-off-by Marcus Cooper <[email protected]>---
sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++-1 file changed, 16 insertions(+), 1 deletion(-)sound/soc/sunxi/sun4i-spdif.c +6
-1@@ -29,6 +29,7 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>@@ -162,6 +163,7 @@ struct sun4i_spdif_dev { struct platform_device *pdev; struct clk *spdif_clk; struct clk *apb_clk; +struct reset_control *rst; struct snd_soc_dai_driver cpu_dai_drv; struct regmap *regmap; struct snd_dmaengine_dai_dma_data dma_params_tx;@@ -411,6 +413,7 @@ static const struct snd_soc_dapm_route dit_routes[] = { static const struct of_device_id sun4i_spdif_of_match[] = { { .compatible = "allwinner,sun4i-a10-spdif", }, + { .compatible ="allwinner,sun6i-a31-spdif" , }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun4i_spdif_of_match);@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) } host->dma_params_tx.addr = res->start + SUN4I_SPDIF_TXFIFO; - host->dma_params_tx.maxburst =4 ; + host->dma_params_tx.maxburst =8 ; host->dma_params_tx.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; platform_set_drvdata(pdev, host); +if (of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun6i-a31-spdif" )) {
sound/soc/sunxi/sun4i-spdif.c static int sun4i_spdif_probe(struct platform_device *pdev) · line 504
Quoted 10 lines
sound/soc/sunxi/sun4i-spdif.c +10
-0+ host->rst =devm_reset_control_get_optional (&pdev->dev,NULL ); +if (IS_ERR (host->rst) &&PTR_ERR (host->rst) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; +dev_err (&pdev->dev,"Failed to get reset: %d\n" , ret); + goto err_disable_apb_clk; + } +if (!IS_ERR (host->rst)) +reset_control_deassert (host->rst); + } +
I think you do not need the compatible.
You can just detect whether the reset is present.
Quoted 10 lines
sound/soc/sunxi/sun4i-spdif.c +0
-1ret = devm_snd_soc_register_component(&pdev->dev, &sun4i_spdif_component, &sun4i_spdif_dai, 1); if (ret) --2.9.2
_______________________________________________
linux-arm-kernel mailing list linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.
Re: [PATCH 1/2] ASoC: sunxi: Add bindings for sun6i to SPDIF
In reply to [email protected]Quoted 23 lines · On Sat, Jul 30, 2016 at 04:27:15PM +0200…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
Signed-off-by Marcus Cooper <[email protected]>--- Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0@@ -9,6 +9,7 @@ Required properties: - compatible : should be one of the following: - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC + - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC - reg : Offset and length of the register set for the device.
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt Required properties: · line 29
Quoted 4 lines
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0@@ -25,6 +26,8 @@ Required properties: "apb" clock for the spdif bus. "spdif" clock for spdif controller. + - reset : reset specifier for the ahb reset (A31 and newer only)
Isn't it resets ? (plural)
Thanks,
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to [email protected]Quoted 9 lines · On Sat, Jul 30, 2016 at 04:27:16PM +0200…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
Signed-off-by Marcus Cooper <[email protected]>
Thanks,
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to Icenowy ZhengQuoted 12 lines · Icenowy Zheng
Quoted 4 lines
+ if (of_device_is_compatible(pdev->dev.of_node,
+ "allwinner,sun6i-a31-spdif")) {
+host->rst=devm_reset_control_get_optional(&pdev->dev, NULL);
+ if (IS_ERR(host->rst)&&PTR_ERR(host->rst)== -EPROBE_DEFER) {Quoted 8 lines
+ ret = -EPROBE_DEFER;
+dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
+ gotoerr_disable_apb_clk;
+ }
+ if (!IS_ERR(host->rst))
+reset_control_deassert(host->rst);
+ }
+
Quoted 2 lines
I think you do not need the compatible.
You can just detect whether the reset is present.
That would weaken the error check. If we're running on the A31 and are missing our reset property, it would go unnoticed.
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [linux-sunxi] [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to Julian CalabyQuoted 30 lines · Julian Calaby
Hi Marcus,
Quoted 27 lines · On Sun, Jul 31, 2016 at 12:27 AM, <[email protected]…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
Signed-off-by Marcus Cooper <[email protected]>--- sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)sound/soc/sunxi/sun4i-spdif.c +1
-1@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) } host->dma_params_tx.addr = res->start +SUN4I_SPDIF_TXFIFO ; - host->dma_params_tx.maxburst =4 ; + host->dma_params_tx.maxburst =8 ; host->dma_params_tx.addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ;platform_set_drvdata (pdev, host);
Quoted 7 lines
sound/soc/sunxi/sun4i-spdif.c static int sun4i_spdif_probe(struct platform_device *pdev) · line 494
Quoted 2 lines
sound/soc/sunxi/sun4i-spdif.c +2
-0+if (of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun6i-a31-spdif" )) {Given how much Allwinner likes to shuffle stuff around with each SoC generation, would it make sense to add a flag for this in some compatible specific config structure instead of checking against the compatible?
It really depends on the size of the quirks you have to maintain. If it's just a single one like here, I'd say it's less of a hassle (and actually easier and conciser to implement).
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to [email protected]30.07.2016, 23:20, "maxime.ripard-wi1+55ScJUtKEb57/[email protected]" <[email protected]>:
Quoted 16 lines · Icenowy Zheng
Quoted 6 lines
> + if (of_device_is_compatible(pdev->dev.of_node,
> + "allwinner,sun6i-a31-spdif")) {
> +host->rst=devm_reset_control_get_optional(&pdev->dev, NULL); > + if (IS_ERR(host->rst)&&PTR_ERR(host->rst)== -EPROBE_DEFER) { > + ret = -EPROBE_DEFER;
> +dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);Quoted 8 lines
> + goto
err_disable_apb_clk;
> + }
> + if (!IS_ERR(host->rst))
> +reset_control_deassert(host->rst);
> + }
> +
I think you do not need the compatible. You can just detect whether the reset is present.
Quoted 2 lines
That would weaken the error check. If we're running on the A31 and are missing our reset property, it would go unnoticed.
The reset property is in the SoC's dtsi file, so it won't be easily missing...
Quoted 7 lines
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.
Re: [PATCH 1/2] ASoC: sunxi: Add bindings for sun6i to SPDIF
In reply to Maxime RipardQuoted 23 lines · Maxime Ripard
Quoted 22 lines · On Sat, Jul 30, 2016 at 04:27:15PM +0200…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
Signed-off-by Marcus Cooper <[email protected]>--- Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0@@ -9,6 +9,7 @@ Required properties: - compatible : should be one of the following: - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC + - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC - reg : Offset and length of the register set for the device.
Quoted 7 lines
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt Required properties: · line 29
Quoted 5 lines
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0@@ -25,6 +26,8 @@ Required properties: "apb" clock for the spdif bus. "spdif" clock for spdif controller. + - reset : reset specifier for the ahb reset (A31 and newer only)Isn't it resets ? (plural)
Dohh..yes it is. Do you want me to send an updated patch series, a single patch change or could I beg for your commit massaging? Thanks,
CK
Quoted 8 lines
Thanks,
Maxime--
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
Re: [PATCH 1/2] ASoC: sunxi: Add bindings for sun6i to SPDIF
Quoted 29 lines · Code Kipper
Quoted 27 lines · Maxime Ripard
Quoted 26 lines · On Sat, Jul 30, 2016 at 04:27:15PM +0200…
From: Marcus Cooper <[email protected]>
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
Signed-off-by Marcus Cooper <[email protected]>--- Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt | 3 +++ 1 file changed, 3 insertions(+)Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0@@ -9,6 +9,7 @@ Required properties: - compatible : should be one of the following: - "allwinner,sun4i-a10-spdif": for the Allwinner A10 SoC + - "allwinner,sun6i-a31-spdif": for the Allwinner A31 SoC - reg : Offset and length of the register set for the device.@@ -25,6 +26,8 @@ Required properties: "apb" clock for the spdif bus. "spdif" clock for spdif controller.
Quoted 6 lines
Quoted 3 lines
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt Required properties: · line 29
Quoted 1 line
Documentation/devicetree/bindings/sound/sunxi,sun4i-spdif.txt +1
-0+ - reset : reset specifier for the ahb reset (A31 and newer only)Isn't it resets ? (plural)
Dohh..yes it is. Do you want me to send an updated patch series, a single patch change or could I beg for your commit massaging?
I'm not the one who is going to apply that patch, so I don't know :)
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com
Re: [linux-sunxi] Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to [email protected]Hi,
Quoted 13 lines · On Sat, Jul 30, 2016 at 11:20 PM, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV…
Quoted 12 lines · Icenowy Zheng
Quoted 12 lines
+ if (of_device_is_compatible(pdev->dev.of_node,
+ "allwinner,sun6i-a31-spdif")) {
+host->rst=devm_reset_control_get_optional(&pdev->dev, NULL);
+ if (IS_ERR(host->rst)&&PTR_ERR(host->rst)== -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
+ gotoerr_disable_apb_clk;
+ }
+ if (!IS_ERR(host->rst))
+reset_control_deassert(host->rst);
+ }
+
Quoted 5 lines
Quoted 2 lines
I think you do not need the compatible.
You can just detect whether the reset is present.That would weaken the error check. If we're running on the A31 and are missing our reset property, it would go unnoticed.
We've been doing it this way with the mmc controller and the usb hosts though. IIRC you once said in the older SoCs, the reset control is tied to the clock gate in the hardware.
The _optional variant is also funny, though I understand it is a design of the reset controller framework.
Regards
ChenYu
Re: Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to a message not in the archive01.08.2016, 21:40, "Chen-Yu Tsai" <[email protected]>:
Quoted 20 lines
Hi,
Quoted 16 lines · On Sat, Jul 30, 2016 at 11:20 PM, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV…
Quoted 14 lines · Icenowy Zheng
> + if (of_device_is_compatible(pdev->dev.of_node,
> + "allwinner,sun6i-a31-spdif")) {
> +host->rst=devm_reset_control_get_optional(&pdev->dev, NULL); > + if (IS_ERR(host->rst)&&PTR_ERR(host->rst)== -EPROBE_DEFER) { > + ret = -EPROBE_DEFER;
> +dev_err(&pdev->dev, "Failed to get reset: %d\n", ret); > + gotoerr_disable_apb_clk;
> + }
> + if (!IS_ERR(host->rst))
> +reset_control_deassert(host->rst);
> + }
> +
I think you do not need the compatible.
You can just detect whether the reset is present.
Quoted 4 lines
Quoted 2 lines
That would weaken the error check. If we're running on the A31 and are missing our reset property, it would go unnoticed.
We've been doing it this way with the mmc controller and the usb hosts though.
I did the same thing on NAND controller.
Quoted 8 lines
IIRC you once said in the older SoCs, the reset control is tied to the clock gate in the hardware.
The
_optionalvariant is also funny, though I understand it is a design of the reset controller framework.Regards
ChenYu
Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.
Mark Brown
maintainerApplied "ASoC: sunxi: compatibility for sun6i to SPDIF" to the asoc tree
In reply to [email protected]The patch
ASoC: sunxi: compatibility for sun6i to SPDIF
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
Quoted 1 line
From
2f6963cb52bee440105f732b3411f18e38ed6e52Mon Sep 17 00:00:00 2001
From: Marcus Cooper <[email protected]>
Date: Sat, 30 Jul 2016 17:56:38 +0200
Subject: [PATCH] ASoC: sunxi: compatibility for sun6i to SPDIF
The A31 SoC uses the same SPDIF block as found in earlier SoCs, but its reset is controlled via a separate reset controller.
The DMA also complains when the maxburst is set to 4 so it's been adjusted to 8 which suites both the older and newer SoCs.
--- sound/soc/sunxi/sun4i-spdif.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/sunxi/sun4i-spdif.c +16 -1
@@ -29,6 +29,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/reset.h> #include <sound/dmaengine_pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
@@ -162,6 +163,7 @@ struct sun4i_spdif_dev {struct platform_device *pdev;struct clk *spdif_clk;struct clk *apb_clk; +struct reset_control *rst;struct snd_soc_dai_driver cpu_dai_drv;struct regmap *regmap;struct snd_dmaengine_dai_dma_data dma_params_tx;
@@ -411,6 +413,7 @@ static const struct snd_soc_dapm_route dit_routes[] = {static const struct of_device_id sun4i_spdif_of_match[] = { { .compatible ="allwinner,sun4i-a10-spdif" , }, + { .compatible ="allwinner,sun6i-a31-spdif" , }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, sun4i_spdif_of_match);
@@ -482,11 +485,23 @@ static int sun4i_spdif_probe(struct platform_device *pdev) } host->dma_params_tx.addr = res->start +SUN4I_SPDIF_TXFIFO ; - host->dma_params_tx.maxburst =4 ; + host->dma_params_tx.maxburst =8 ; host->dma_params_tx.addr_width =DMA_SLAVE_BUSWIDTH_2_BYTES ;platform_set_drvdata (pdev, host); +if (of_device_is_compatible (pdev->dev.of_node, +"allwinner,sun6i-a31-spdif" )) { + host->rst =devm_reset_control_get_optional (&pdev->dev,NULL ); +if (IS_ERR (host->rst) &&PTR_ERR (host->rst) == -EPROBE_DEFER ) { + ret = -EPROBE_DEFER ; +dev_err (&pdev->dev,"Failed to get reset: %d\n" , ret); + goto err_disable_apb_clk; + } +if (!IS_ERR (host->rst)) +reset_control_deassert (host->rst); + } + ret =devm_snd_soc_register_component (&pdev->dev, &sun4i_spdif_component, &sun4i_spdif_dai,1 );if (ret)
Signature · 1 line
2.8.1
Re: [linux-sunxi] Re: [PATCH 2/2] ASoC: sunxi: compatibility for sun6i to SPDIF
In reply to Chen-Yu TsaiHi,
Quoted 23 lines · Chen-Yu Tsai
Hi,
Quoted 13 lines · On Sat, Jul 30, 2016 at 11:20 PM, maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV…
Quoted 12 lines · Icenowy Zheng
Quoted 12 lines
+ if (of_device_is_compatible(pdev->dev.of_node,
+ "allwinner,sun6i-a31-spdif")) {
+host->rst=devm_reset_control_get_optional(&pdev->dev, NULL);
+ if (IS_ERR(host->rst)&&PTR_ERR(host->rst)== -EPROBE_DEFER) {
+ ret = -EPROBE_DEFER;
+dev_err(&pdev->dev, "Failed to get reset: %d\n", ret);
+ gotoerr_disable_apb_clk;
+ }
+ if (!IS_ERR(host->rst))
+reset_control_deassert(host->rst);
+ }
+Quoted 5 lines
Quoted 2 lines
I think you do not need the compatible.
You can just detect whether the reset is present.That would weaken the error check. If we're running on the A31 and are missing our reset property, it would go unnoticed.
Quoted 6 lines
We've been doing it this way with the mmc controller and the usb hosts though. IIRC you once said in the older SoCs, the reset control is tied to the clock gate in the hardware.
The
_optionalvariant is also funny, though I understand it is a design of the reset controller framework.
Yes, I know. But that doesn't prevent that design from being better.
Maxime
Signature · 3 lines
Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com