From patchwork Thu May 4 07:16:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 680240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3A91AC77B73 for ; Mon, 8 May 2023 07:45:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BBAFD12BE; Mon, 8 May 2023 09:44:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BBAFD12BE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683531943; bh=b40Kk6ygL/6dN8P/x+3akpBi4xadkxrZDsPy/MKnihk=; h=To:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From:Reply-To:Cc:From; b=rRXEe0cWwhENpzskum4/r+GRViqurNn/0q/n11qj2cBJ4ScA6zybs7xFG5yB2yJdg PA9rD/vTNaAxQkE8ixESMs5pNQxmbkeGJXwtFUw4dqRYFuTLii0bEPPus46j3BHxV1 gXbIhhtiAYnIwfFX3AjtkO4qe2bDQJNE/QhC84HM= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 07F4CF8014C; Mon, 8 May 2023 09:44:34 +0200 (CEST) To: alsa-devel@alsa-project.org Subject: [PATCH v2 1/2] ASoC: dwc: add optional reset support Date: Thu, 4 May 2023 10:16:17 +0300 X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 X-Mailman-Approved-At: Mon, 08 May 2023 07:44:30 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <168353187320.26.35269573829590476@mailman-core.alsa-project.org> X-Patchwork-Original-From: Maxim Kochetkov via Alsa-devel From: Maxim Kochetkov Reply-To: Maxim Kochetkov Cc: lgirdwood@gmail.com, broonie@kernel.org, tiwai@suse.com, p.zabel@pengutronix.de, ckeepax@opensource.cirrus.com, u.kleine-koenig@pengutronix.de, nicolas.ferre@microchip.com, Maxim Kochetkov Content-Disposition: inline Some SoC may have resets for I2S subsystem. So add optional reset support. Signed-off-by: Maxim Kochetkov --- sound/soc/dwc/dwc-i2s.c | 27 +++++++++++++++++++++------ sound/soc/dwc/local.h | 1 + 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sound/soc/dwc/dwc-i2s.c b/sound/soc/dwc/dwc-i2s.c index acdf98b2ee9c..e2b2ba014a2e 100644 --- a/sound/soc/dwc/dwc-i2s.c +++ b/sound/soc/dwc/dwc-i2s.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -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); } 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; From patchwork Thu May 4 07:16:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Kochetkov X-Patchwork-Id: 679923 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 411CBC77B73 for ; Mon, 8 May 2023 07:45:41 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 07EE012B8; Mon, 8 May 2023 09:44:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 07EE012B8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1683531938; bh=8IEAxTCzBq2JPGGEYfLyk79zvoWSjLtAxaE+j4BSvkI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Reply-To:Cc:From; b=ilaGYsVXrOpt8FgTjrqcGEHy+1XFaFZt+GUP0F/MRXcKYZ1fJ0fcM6OdyijghM2EC 1hlD/bSj32j9XSOJEQHruiU+B7sN2K3jymkBjpZTE/wOeXKzaxC1XzJqNRHorkpVQR yoPQdfYQ2bo9C2P0F9DSVHiZpysZzLPjVirYXbLE= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 75FF4F8053B; Mon, 8 May 2023 09:44:32 +0200 (CEST) To: alsa-devel@alsa-project.org Subject: [PATCH v2 2/2] ASoC: dt-bindings: designware-i2s: add optional resets Date: Thu, 4 May 2023 10:16:18 +0300 In-Reply-To: <20230504071618.52012-1-fido_max@inbox.ru> References: <20230504071618.52012-1-fido_max@inbox.ru> X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 X-Mailman-Approved-At: Mon, 08 May 2023 07:44:29 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <168353187164.26.12256856235696855679@mailman-core.alsa-project.org> X-Patchwork-Original-From: Maxim Kochetkov via Alsa-devel From: Maxim Kochetkov Reply-To: Maxim Kochetkov Cc: lgirdwood@gmail.com, broonie@kernel.org, tiwai@suse.com, p.zabel@pengutronix.de, ckeepax@opensource.cirrus.com, u.kleine-koenig@pengutronix.de, nicolas.ferre@microchip.com, Maxim Kochetkov Content-Disposition: inline Some SoC may have resets for I2S subsystem. So add optional resets support. Signed-off-by: Maxim Kochetkov --- .../devicetree/bindings/sound/snps,designware-i2s.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml b/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml index 56e623d4e168..a970fd264b21 100644 --- a/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml +++ b/Documentation/devicetree/bindings/sound/snps,designware-i2s.yaml @@ -36,7 +36,8 @@ properties: const: i2sclk resets: - maxItems: 1 + items: + - description: Optional controller resets dmas: items: