From patchwork Mon Mar 12 15:57:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Code Kipper X-Patchwork-Id: 10276667 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F9A6602BD for ; Mon, 12 Mar 2018 15:59:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E45128AF3 for ; Mon, 12 Mar 2018 15:59:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0291128B30; Mon, 12 Mar 2018 15:59:04 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3301528AF3 for ; Mon, 12 Mar 2018 15:59:04 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 89B2C2676DC; Mon, 12 Mar 2018 16:58:13 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 3112826743A; Mon, 12 Mar 2018 16:58:06 +0100 (CET) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by alsa0.perex.cz (Postfix) with ESMTP id 75253266E63 for ; Mon, 12 Mar 2018 16:58:04 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id v9-v6so24012057lfa.11 for ; Mon, 12 Mar 2018 08:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=99qtNV4j6dXaHKpegWHyzTQ3DepSFNY9Zs222yIUaac=; b=V/X1baCTFBrBzFsaD8L6vySG05LcJ53cK06EV6Y6QsBbKmISYN4p97evGpVQQz9g2k TNN51OWk5GCBpP+iHhnZgkPPYUKtIRaMe4novjsmzTmXQBwpxkMsFobDx+dyUPuotG7L /AAHExPC8R0E/FjfCzmwwkhh7lmlyOjiUDfRMh+r0GkWciaiS9ZexwgSG2N5dXm+n1mi McwV7lbhQoOaXH03RFBT0j9Wm/UGY0cAscXqMEdpBpTSo2wKfr+X1TYuSJ+kVCeWw5Vg DqpOwjew5SUjniDxN2YpGr1fYcbOCqSNQFq77jbMDU3L2dPHdf4XlEpPCh0yYKuTLdqC W0lQ== 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; bh=99qtNV4j6dXaHKpegWHyzTQ3DepSFNY9Zs222yIUaac=; b=IHd/1MSwpkYCg9Mk/pwgmG5nuF1jBrS4WzRqlaXfaBI73djzJap6oJqtCm0PsfLfeZ DjbK1Tk9X31KemqROSBNAG2ioTTuAVCGWV+tdtApCSUEUF1igu40o94WJfoMVrnwZxaA OFlcdVWWBDhacI7c3lVTQ4uimXpu2nt+t2d7shhFieTEXUGBGujC6amNtW+tHuWQUHaX TiKcnUjjEc7J+4OzK5/Zlr/2TQW6MMSGxI2h5ckaMgCcVKVBjsApz57Nx3YEI2wpp9eH PbO7Y3KRLXDSFqs+9dl0z1otYr1p+Qg7ZHXKX0IqRM1ehKx9ig/CKIA6MD3/FdDsGMND ekug== X-Gm-Message-State: AElRT7FRN/O1/CO1KsH6leEqK5ec1jfhNaEK0GU91pBHuPMIgtK8Nkq5 iJBJsXndwxnsset+csBPLVk= X-Google-Smtp-Source: AG47ELuDfKabo23IdzTcxrSctGZhe2DFn7BqgYQmYjHM/8qlaCh8yAFJ5SSxJaWeMr2R0JnI/47p5w== X-Received: by 10.46.81.73 with SMTP id b9mr5389588lje.9.1520870283906; Mon, 12 Mar 2018 08:58:03 -0700 (PDT) Received: from localhost.localdomain (c83-253-254-90.bredband.comhem.se. [83.253.254.90]) by smtp.gmail.com with ESMTPSA id h11-v6sm1833448lfd.88.2018.03.12.08.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 08:58:03 -0700 (PDT) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com, wens@csie.org, linux-sunxi@googlegroups.com Date: Mon, 12 Mar 2018 16:57:53 +0100 Message-Id: <20180312155753.9478-7-codekipper@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180312155753.9478-1-codekipper@gmail.com> References: <20180312155753.9478-1-codekipper@gmail.com> Cc: alsa-devel@alsa-project.org, Marcus Cooper , lgirdwood@gmail.com, linux-kernel@vger.kernel.org, be17068@iperbole.bo.it, broonie@kernel.org, linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2 6/6] ASoC: sun4i-i2s: Add support for loopback X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Marcus Cooper The DAI has a loopback register which can be set and therefore routes the transmit fifo to receive fifo. This is useful for testing the block without the need for any external hardware. Signed-off-by: Marcus Cooper --- Documentation/devicetree/bindings/sound/sun4i-i2s.txt | 3 +++ sound/soc/sunxi/sun4i-i2s.c | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt index 3f966ac61b9e..325e3d4571f1 100644 --- a/Documentation/devicetree/bindings/sound/sun4i-i2s.txt +++ b/Documentation/devicetree/bindings/sound/sun4i-i2s.txt @@ -32,6 +32,9 @@ Optional properties: - allwinner,slot-width-override:if this property is present then the dai is configured to extend the slot width to the value specified. Min 8, Max 32. +- loopback: if this property is present then the dai is configured in + loopback mode where the output fifo is redirected to the input + fifo. - allwinner,playback-channels: if this property is present then the number of available channels is extended and the diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 7cf4dfe440de..a3c33814d33e 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -31,6 +31,7 @@ #define SUN4I_I2S_CTRL_MODE_MASK BIT(5) #define SUN4I_I2S_CTRL_MODE_SLAVE (1 << 5) #define SUN4I_I2S_CTRL_MODE_MASTER (0 << 5) +#define SUN4I_I2S_CTRL_LOOP BIT(3) #define SUN4I_I2S_CTRL_TX_EN BIT(2) #define SUN4I_I2S_CTRL_RX_EN BIT(1) #define SUN4I_I2S_CTRL_GL_EN BIT(0) @@ -195,6 +196,8 @@ struct sun4i_i2s { const struct sun4i_i2s_quirks *variant; + bool loopback; + unsigned int slot_width; }; @@ -639,6 +642,11 @@ static void sun4i_i2s_start_capture(struct sun4i_i2s *i2s) regmap_update_bits(i2s->regmap, SUN4I_I2S_DMA_INT_CTRL_REG, SUN4I_I2S_DMA_INT_CTRL_RX_DRQ_EN, SUN4I_I2S_DMA_INT_CTRL_RX_DRQ_EN); + + /* Debugging without codec */ + if (i2s->loopback) + regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG, + SUN4I_I2S_CTRL_LOOP, SUN4I_I2S_CTRL_LOOP); } static void sun4i_i2s_start_playback(struct sun4i_i2s *i2s) @@ -1204,6 +1212,9 @@ static int sun4i_i2s_probe(struct platform_device *pdev) soc_dai->playback.channels_max = val; } + if (of_property_read_bool(pdev->dev.of_node, "loopback")) + i2s->loopback = true; + pm_runtime_enable(&pdev->dev); if (!pm_runtime_enabled(&pdev->dev)) { ret = sun4i_i2s_runtime_resume(&pdev->dev);