Skip to contentSkip to conversation

ASoC: dwc: add optional reset support

PATCH In review Maxim Kochetkov 4 participants 5 messages May 4, 2023 – May 9, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 ASoC: dwc: add optional reset support

Some SoC may have resets for I2S subsystem. So add optional reset support.

---
 sound/soc/dwc/dwc-i2s.c | 27 +++++++++++++++++++++------
 sound/soc/dwc/local.h   |  1 +
 2 files changed, 22 insertions(+), 6 deletions(-)
sound/soc/dwc/dwc-i2s.c +21 -6
index acdf98b2ee9c..e2b2ba014a2e 100644
@@ -17,6 +17,7 @@
 #include <linux/io.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 #include <sound/designware_i2s.h>
@@ -648,6 +649,14 @@ static int dw_i2s_probe(struct platform_device *pdev)
 	if (IS_ERR(dev->i2s_base))
 		return PTR_ERR(dev->i2s_base);
 
+	dev->reset = devm_reset_control_array_get_optional_shared(&pdev->dev);
+	if (IS_ERR(dev->reset))
+		return PTR_ERR(dev->reset);
+
+	ret = reset_control_deassert(dev->reset);
+	if (ret)
+		return ret;
+
 	dev->dev = &pdev->dev;
 
 	irq = platform_get_irq_optional(pdev, 0);
@@ -656,7 +665,7 @@ static int dw_i2s_probe(struct platform_device *pdev)
 				pdev->name, dev);
 		if (ret < 0) {
 			dev_err(&pdev->dev, "failed to request irq\n");
-			return ret;
+			goto err_assert_reset;
 		}
 	}
 
@@ -676,24 +685,27 @@ static int dw_i2s_probe(struct platform_device *pdev)
 		ret = dw_configure_dai_by_dt(dev, dw_i2s_dai, res);
 	}
 	if (ret < 0)
-		return ret;
+		goto err_assert_reset;
 
 	if (dev->capability & DW_I2S_MASTER) {
 		if (pdata) {
 			dev->i2s_clk_cfg = pdata->i2s_clk_cfg;
 			if (!dev->i2s_clk_cfg) {
 				dev_err(&pdev->dev, "no clock configure method\n");
-				return -ENODEV;
+				ret = -ENODEV;
+				goto err_assert_reset;
 			}
 		}
 		dev->clk = devm_clk_get(&pdev->dev, clk_id);
 
-		if (IS_ERR(dev->clk))
-			return PTR_ERR(dev->clk);
+		if (IS_ERR(dev->clk)) {
+			ret = PTR_ERR(dev->clk);
+			goto err_assert_reset;
+		}
 
 		ret = clk_prepare_enable(dev->clk);
 		if (ret < 0)
-			return ret;
+			goto err_assert_reset;
 	}
 
 	dev_set_drvdata(&pdev->dev, dev);
@@ -727,6 +739,8 @@ static int dw_i2s_probe(struct platform_device *pdev)
 err_clk_disable:
 	if (dev->capability & DW_I2S_MASTER)
 		clk_disable_unprepare(dev->clk);
+err_assert_reset:
+	reset_control_assert(dev->reset);
 	return ret;
 }
 
@@ -737,6 +751,7 @@ static void dw_i2s_remove(struct platform_device *pdev)
 	if (dev->capability & DW_I2S_MASTER)
 		clk_disable_unprepare(dev->clk);
 
+	reset_control_assert(dev->reset);
 	pm_runtime_disable(&pdev->dev);
 }
 
sound/soc/dwc/local.h +1 -0
index 1c361eb6127e..d64bd4f8fd34 100644
@@ -89,6 +89,7 @@ union dw_i2s_snd_dma_data {
 struct dw_i2s_dev {
 	void __iomem *i2s_base;
 	struct clk *clk;
+	struct reset_control *reset;
 	int active;
 	unsigned int capability;
 	unsigned int quirks;
Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 2/2 ASoC: dt-bindings: designware-i2s: add optional resets

Some SoC may have resets for I2S subsystem. So add optional resets support.

---
 .../devicetree/bindings/sound/snps,designware-i2s.yaml         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml +2 -1
index 56e623d4e168..a970fd264b21 100644
@@ -36,7 +36,8 @@ properties:
     const: i2sclk
 
   resets:
-    maxItems: 1
+    items:
+      - description: Optional controller resets
 
   dmas:
     items:
Signature · 1 line
2.39.2
#2 lore raw

Re: [PATCH v2 2/2] ASoC: dt-bindings: designware-i2s: add optional resets

Quoted 1 line · Maxim Kochetkov

Some SoC may have resets for I2S subsystem. So add optional resets support.

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed at least DT list (maybe more), so this won't be tested. Please resend and include all necessary entries.

Quoted 11 lines
---
 .../devicetree/bindings/sound/snps,designware-i2s.yaml         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml +0 -0
index 56e623d4e168..a970fd264b21 100644

Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml properties: · line 40

Quoted 6 lines
Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml +2 -1
@@ -36,7 +36,8 @@ properties:
     const: i2sclk
 
   resets:
-    maxItems: 1
+    items:
+      - description: Optional controller resets

This does not make much sense. Your change does nothing. NAK.

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/2 ASoC: dt-bindings: designware-i2s: add optional resets

In reply to Maxim Kochetkov

Some SoC may have resets for I2S subsystem. So add optional resets support.

---
 .../devicetree/bindings/sound/snps,designware-i2s.yaml         | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml +2 -1
index 56e623d4e168..a970fd264b21 100644
@@ -36,7 +36,8 @@ properties:
     const: i2sclk
 
   resets:
-    maxItems: 1
+    items:
+      - description: Optional controller resets
 
   dmas:
     items:
Signature · 1 line
2.39.2
maintainer
#4 lore raw
In reply to Maxim Kochetkov
Quoted 3 lines · Maxim Kochetkov

Some SoC may have resets for I2S subsystem. So add optional reset support.

Applied to

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

Thanks!

[1/2] ASoC: dwc: add optional reset support

      commit: c00018cadfbf07b95d10b0e152c4edd7d5d19779
[2/2] ASoC: dt-bindings: designware-i2s: add optional resets
      commit: 12b99ec3b9b6349a38223cf4d13818cb5cbdcd46

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