From patchwork Wed Jul 3 12:07:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 11029395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ADBD112C for ; Wed, 3 Jul 2019 12:08:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A25D28884 for ; Wed, 3 Jul 2019 12:08:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E3DF28932; Wed, 3 Jul 2019 12:08:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AD12328884 for ; Wed, 3 Jul 2019 12:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0yzQI1n1FD956wwV0tC0FvK1SvS8Qtbi/xufpMg2QeI=; b=Q0+JRsbfTY4hR2 eBbKZCB/hqCa6lVzk64jQ5LBvk+uv7l/H+1dIkGDgTkdtHtHxt4HW5tebsT4BE4H752ELphscOGZS cc2o+ve7LRPkJwZAoh1VC7Ulav75VWGaw2KP6Hal3AeuelyBwCI+N33JfKU8ruG5huo4cL6Lq3fnK +kY/53gTQLcXWJsHRca7tJ6heTIigXBqIfjBfmX1G/As6xzZZU32GFPY2+bvNdCec4giq6FZ2D4QM ggqVIV0Qiqvv1YXQ6oZVcS0E76pAzlL2cjMngfSYWinLZNSlW5jCENyMlyvgyrEBGl+VhG7vaSvSn uiH66LOATydUHni/grDw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hie3M-0004L8-3n; Wed, 03 Jul 2019 12:08:00 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hie3H-0004JR-Ua for linux-amlogic@lists.infradead.org; Wed, 03 Jul 2019 12:07:57 +0000 Received: by mail-wm1-x343.google.com with SMTP id u8so2122038wmm.1 for ; Wed, 03 Jul 2019 05:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3nDWpJDfpOQfXawVusespJk2SyBgud3JYRZ5ZXC0wU4=; b=BWYV3U428Gc8QR7aKZY4nWtDDgoYNuQo2A3i0xocI7A1OdX/bXOHlzZbpoM9HpZmu5 w2eYh3sthQswiY9VQBzBrJA/+2OlKshkF9G/8p28Jf9knhlhOXiQd6jE/8WJgbvP5mzO 8jyDCL1dq/c999yNYGKrDCJssPk/zSlvY4AQrzN68K3tX50+QFWAfb6I+LneNIxK1CVp 75CXk6f1JvxnxN6ria/lK5C9QmHE3C1pGG2a+/8V7UjhZ7VtfjD2HVJp8v3+ICLd3189 6Ocyz1v/BB5Zms/+78h+0r1N4ckL3eh/r0S3CTS9XS8F6LUiDwoZSOUpilo/CwiEA7JP C7BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3nDWpJDfpOQfXawVusespJk2SyBgud3JYRZ5ZXC0wU4=; b=ejEaUzCWlymTXQ4xJjPj1uAfnfGH1Pc60aAVujVUSfaT1K8b9R/IBvD3a+WyEejKs1 1ztuUOnp2aaK43P7JZUPmtmqj2R6c7l9r7f6ee1mEAyz1O4vwbpdbuB6VPlTVqmywcPZ SwFn54o+uxX3VALHbLQylMtpXazEcX6ooyZLj7G4UbBcmH0plsdCBfs6B/v+M1P/V65M WkAaCFqmaA5I/So/8kgz0vhhvjUHn/KsXXS2+AWFzFsUpCBqIR02ahnfjUr7aRYQjtyG iCIZGA+KNpSNVeDOKAbvLV8KQC+6p7ucDyAtYYN8aj8q9jIQR6JUNWVv2Ad9shiSOErP G+TA== X-Gm-Message-State: APjAAAUPloPCqapqLV9KGssYJ71C2eF3wCVMWxCqXB7TxvEGYUnGCqAX qz1noFw6EpzAcMGIEAcrQaMjhQ== X-Google-Smtp-Source: APXvYqzol6Ot5n5vTIYz4kULwGeZdgCKUF/deXcHiE+/rQ3Rb/Lb4EzxU0wc9AZz6JzdmHnS4EQ/7g== X-Received: by 2002:a1c:4041:: with SMTP id n62mr8190423wma.100.1562155674760; Wed, 03 Jul 2019 05:07:54 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id z126sm2767638wmb.32.2019.07.03.05.07.53 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 05:07:54 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood , Kevin Hilman Subject: [PATCH 1/2] ASoC: meson: axg-tdm-formatter: add reset to the bindings documentation Date: Wed, 3 Jul 2019 14:07:48 +0200 Message-Id: <20190703120749.32341-2-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703120749.32341-1-jbrunet@baylibre.com> References: <20190703120749.32341-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_050755_983457_DDDC8F33 X-CRM114-Status: UNSURE ( 8.92 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Jerome Brunet Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add an optional reset property to the tdm formatter bindings. The dedicated reset line is present on some SoC families, such as the g12a. Signed-off-by: Jerome Brunet --- .../bindings/sound/amlogic,axg-tdm-formatters.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt index 3b94a715a0b9..8835a43edfbb 100644 --- a/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt +++ b/Documentation/devicetree/bindings/sound/amlogic,axg-tdm-formatters.txt @@ -15,11 +15,15 @@ Required properties: * "lrclk" : sample clock * "lrclk_sel": sample clock input multiplexer -Example of TDMOUT_A on the A113 SoC: +Optional property: +- resets: phandle to the dedicated reset line of the tdm formatter. + +Example of TDMOUT_A on the S905X2 SoC: tdmout_a: audio-controller@500 { compatible = "amlogic,axg-tdmout"; reg = <0x0 0x500 0x0 0x40>; + resets = <&clkc_audio AUD_RESET_TDMOUT_A>; clocks = <&clkc_audio AUD_CLKID_TDMOUT_A>, <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK>, <&clkc_audio AUD_CLKID_TDMOUT_A_SCLK_SEL>, From patchwork Wed Jul 3 12:07:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 11029397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D79114F6 for ; Wed, 3 Jul 2019 12:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BED728884 for ; Wed, 3 Jul 2019 12:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 603B228932; Wed, 3 Jul 2019 12:08:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 085A128884 for ; Wed, 3 Jul 2019 12:08:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EfkIUsosfvBrfuAJ4cM514gcrgMNwRrzATRTctkokRw=; b=IMYK3I44x1lLJQ XfihHwwzLNi0kSt2GfDQib3CAxSgZIzm8ICplnPieysqjNdWg/CVIRpCuIKAwx7AXZgsfBWMurp6d +5lyCggDXivjE+NAXrUB8zSRI2BzHwaZsmy55DOiLtkYEpIu5HJB7Hf0oQQpVILy3SGp8OcAZ7a7m LkvUAXjPCcJ6ehNhXPcD9p6is+7aSehg39wvIhOjL13BVM9aCcBxGxgF4qSxx8vvrqlGCRI6rd8ds eZVtRO8FVs3Kgqlm0o+P2j2W20swjtRZZ2GrlrZoZwI+dt6ikJZ5KypKfZtEkSW1ozIlZG7M4cNZK 1MpVQMZAgavpSxqsYXTw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hie3O-0004Oj-My; Wed, 03 Jul 2019 12:08:02 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hie3L-0004Jr-O9 for linux-amlogic@lists.infradead.org; Wed, 03 Jul 2019 12:08:01 +0000 Received: by mail-wr1-x442.google.com with SMTP id c2so2500434wrm.8 for ; Wed, 03 Jul 2019 05:07:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m6jmfxNF0bKXTHuQ9MiaMGLVqO2khGBwkEkz0kXerFA=; b=JrcDlvvTu/UsNIG0vNxgNTXhOeeuaxZSo57yFAMP/xUZSJ0e+TmYtRFDzHNVWp3/2W WL7VXbaVLmT0arVzNS3T6C6CTredekNz7iHmVMUKkzUOkMQqzjJgSJxtZrK9xi60Omzm 7rMGge4rmwUX+m0a7K72LzFQxvk6I1a5msWlscLQi9xL2pFct8QbyQ9pN5btRBkmlak4 28L6JNF30BSyhM5y8HR5cccDJt1pSGxI8NxN6gvkrSyFIdW+wiIPTsdYhjcCXIkwcTjH f63rXZf/IzhUP5KlgoPcMSvkpDEqS7ubdYS70hqaG4LPhLfTSntiquOLtUwmlLIgqgrb ATUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m6jmfxNF0bKXTHuQ9MiaMGLVqO2khGBwkEkz0kXerFA=; b=WC1odRwlvMaiP3UBoAVzrT1o4X0vk6cMr0hAn/8HP2OpM6R+jgGDjAFv3YsHr/fhpt ad/ixw8qHztR3cMOk8idTvvztqGOuzWzeAQM4od8ZapvxmD78LwMciuR6u9cP07ZrWrD VmUzKLw6xFGMecz6ywWb8NVed0Icp993yQ6mibTW6AnWYX5NyIdaR3Ch9gyDAOiGW9yl Mdst20+qKcRm9ksLgGCo+SocOOhB5qff7uWo8jIxhdf583TeLbwnqbExx7sjxZvKsywM ydJgtl4OavfrOP+AJiewSR+pz7xa10ON/ezAFjTP02Gz2Xvb1Wla64TwrCCKYVbD/Axq ukfg== X-Gm-Message-State: APjAAAUW5qp8f4kT9/cd724DyPHLPxxMYBKcJehNHz1oL/8Yhmd4ciU3 4mzL91aAv+SvMb9tbHUOFfv1VQ== X-Google-Smtp-Source: APXvYqw931AA2gewVKXUYTgyeeVPRjW4aXRpl7vYMadJOlnoIda8+dbNBrBJbhCSF/FyzoCyWHZOZw== X-Received: by 2002:a05:6000:1043:: with SMTP id c3mr3594718wrx.226.1562155675701; Wed, 03 Jul 2019 05:07:55 -0700 (PDT) Received: from starbuck.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id z126sm2767638wmb.32.2019.07.03.05.07.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 05:07:55 -0700 (PDT) From: Jerome Brunet To: Mark Brown , Liam Girdwood , Kevin Hilman Subject: [PATCH 2/2] ASoC: meson: axg-tdm-formatter: add reset Date: Wed, 3 Jul 2019 14:07:49 +0200 Message-Id: <20190703120749.32341-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703120749.32341-1-jbrunet@baylibre.com> References: <20190703120749.32341-1-jbrunet@baylibre.com> MIME-Version: 1.0 X-Patchwork-Bot: notify X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190703_050759_957406_789571ED X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Jerome Brunet Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add the optional reset line handling which is present on the new SoC families, such as the g12a. Triggering this reset is not critical but it helps solve a channel shift issue on the g12a. Signed-off-by: Jerome Brunet --- sound/soc/meson/axg-tdm-formatter.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/sound/soc/meson/axg-tdm-formatter.c b/sound/soc/meson/axg-tdm-formatter.c index 0c6cce5c5773..2e498201139f 100644 --- a/sound/soc/meson/axg-tdm-formatter.c +++ b/sound/soc/meson/axg-tdm-formatter.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "axg-tdm-formatter.h" @@ -20,6 +21,7 @@ struct axg_tdm_formatter { struct clk *lrclk; struct clk *sclk_sel; struct clk *lrclk_sel; + struct reset_control *reset; bool enabled; struct regmap *map; }; @@ -75,6 +77,24 @@ static int axg_tdm_formatter_enable(struct axg_tdm_formatter *formatter) if (formatter->enabled) return 0; + /* + * On the g12a (and possibly other SoCs), when a stream using + * multiple lanes is restarted, it will sometimes not start + * from the first lane, but randomly from another used one. + * The result is an unexpected and random channel shift. + * + * The hypothesis is that an HW counter is not properly reset + * and the formatter simply starts on the lane it stopped + * before. Unfortunately, there does not seems to be a way to + * reset this through the registers of the block. + * + * However, the g12a has indenpendent reset lines for each audio + * devices. Using this reset before each start solves the issue. + */ + ret = reset_control_reset(formatter->reset); + if (ret) + return ret; + /* * If sclk is inverted, invert it back and provide the inversion * required by the formatter @@ -306,6 +326,15 @@ int axg_tdm_formatter_probe(struct platform_device *pdev) return ret; } + /* Formatter dedicated reset line */ + formatter->reset = reset_control_get_optional_exclusive(dev, NULL); + if (IS_ERR(formatter->reset)) { + ret = PTR_ERR(formatter->reset); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get reset: %d\n", ret); + return ret; + } + return devm_snd_soc_register_component(dev, drv->component_drv, NULL, 0); }