[PATCH] ASoC: dwc: add reset support
Some SoC may have resets for I2S subsystem. So add optional reset deassert at startup.
Signed-off-by: Maxim Kochetkov fido_max@inbox.ru --- sound/soc/dwc/dwc-i2s.c | 9 +++++++++ sound/soc/dwc/local.h | 1 + 2 files changed, 10 insertions(+)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index acdf98b2ee9c..8c8bc7116f86 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -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); diff --git a/sound/soc/dwc/local.h b/sound/soc/dwc/local.h index 1c361eb6127e..d64bd4f8fd34 100644 --- a/sound/soc/dwc/local.h +++ b/sound/soc/dwc/local.h @@ -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;
Hi Maxim,
On Fri, Apr 21, 2023 at 10:33:19PM +0300, Maxim Kochetkov wrote:
Some SoC may have resets for I2S subsystem. So add optional reset deassert at startup.
Signed-off-by: Maxim Kochetkov fido_max@inbox.ru
sound/soc/dwc/dwc-i2s.c | 9 +++++++++ sound/soc/dwc/local.h | 1 + 2 files changed, 10 insertions(+)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index acdf98b2ee9c..8c8bc7116f86 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -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);
Since this is a shared reset control, matching reset_control_assert() calls are required in the subsequent error paths and in dw_i2s_remove().
regards Philipp
On 26.04.2023 10:57, Philipp Zabel wrote:
Hi Maxim,
On Fri, Apr 21, 2023 at 10:33:19PM +0300, Maxim Kochetkov wrote:
Some SoC may have resets for I2S subsystem. So add optional reset deassert at startup.
Signed-off-by: Maxim Kochetkov fido_max@inbox.ru
sound/soc/dwc/dwc-i2s.c | 9 +++++++++ sound/soc/dwc/local.h | 1 + 2 files changed, 10 insertions(+)
diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index acdf98b2ee9c..8c8bc7116f86 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -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);
Since this is a shared reset control, matching reset_control_assert() calls are required in the subsequent error paths and in dw_i2s_remove().
Sure. Will update in v2
On Fri, Apr 21, 2023 at 10:33:19PM +0300, Maxim Kochetkov wrote:
Some SoC may have resets for I2S subsystem. So add optional reset deassert at startup.
Signed-off-by: Maxim Kochetkov fido_max@inbox.ru
sound/soc/dwc/dwc-i2s.c | 9 +++++++++ sound/soc/dwc/local.h | 1 + 2 files changed, 10 insertions(+)
I'd expect to see a binding update along with this?
On 26.04.2023 14:29, Mark Brown wrote:
On Fri, Apr 21, 2023 at 10:33:19PM +0300, Maxim Kochetkov wrote:
Some SoC may have resets for I2S subsystem. So add optional reset deassert at startup.
Signed-off-by: Maxim Kochetkov fido_max@inbox.ru
sound/soc/dwc/dwc-i2s.c | 9 +++++++++ sound/soc/dwc/local.h | 1 + 2 files changed, 10 insertions(+)
I'd expect to see a binding update along with this?
Sure. Will update in v2
participants (3)
-
Mark Brown
-
Maxim Kochetkov
-
Philipp Zabel