Received: by 10.213.65.68 with SMTP id h4csp133838imn; Mon, 12 Mar 2018 08:59:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELsh9pUJ6trsFeYlsJ2YJDBDHg8dyE23lFCBZQk3eY5KPrqVJjmzq3PwmSfklFnrdwmYsAld X-Received: by 10.98.27.10 with SMTP id b10mr8475171pfb.121.1520870385241; Mon, 12 Mar 2018 08:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520870385; cv=none; d=google.com; s=arc-20160816; b=wd1qX2I/ogaqPgBbt5R/f9EER0OLE4yJ+Shrg8vEWOPMwe0rAtHJZ4Jb7HFPZP2/Pt 28ZV0O9Mi/qdLsEt4iakk9+R1L9GXzPW6sIbKWaNDTELVw87VpgMiup7n2OHRR24TQFL Zq4chHWjZRsz3w707OqJCo4Js9WoliSvgdOQzh9leS0qHyXLBmiSkLW4+tPloYD13dtk qidDSLAAyUKkruxAEU4h+3GKDB0g3z5QLcYth7RYbZyR4w13qjknoyzEuiVVftAtQY2N vq5BHVFs2t7QnKFnljN8bmwiCGZHk03LoP16EryWfBj2kVMp7sPA1I4Xe91As7cwV/Qs jNhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=99qtNV4j6dXaHKpegWHyzTQ3DepSFNY9Zs222yIUaac=; b=RTRTa8wvavmwL69gEG3+k7m9EUGgeDp0SRoMMAqKhn2qAutkk8RJTVlsNAHEj3ZzAh z5gnB1iklzN4dGIHcZaGMmBr3UfSN1mRc1CqihE956Z5oHknwbTTngnSARvGtwZAMKn3 z9H7BIj52x5A0BzWGt05uDOyKIV7Lduhi+HNG0/BH6fMwFHIStCi9hJbFSen+ZJFl1K6 J+XLnVh+SNiWiFWLOQCZixKYkB9tXe9KSZlLMl43wCL4xXbKxjSRTQ06vPm01V7hDHeT C9KwxbltI3t2TFozjLzmsJjR/yWIGogne/Q96OqggY9mIuQKqnGppHnm0Zz8+Re8V4/x /LOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V/X1baCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u45si4077118pgn.702.2018.03.12.08.59.30; Mon, 12 Mar 2018 08:59:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=V/X1baCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932746AbeCLP6U (ORCPT + 99 others); Mon, 12 Mar 2018 11:58:20 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:42152 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932715AbeCLP6F (ORCPT ); Mon, 12 Mar 2018 11:58:05 -0400 Received: by mail-lf0-f68.google.com with SMTP id a22-v6so2129409lfg.9 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=bh0YrKLbQkLLwda1cgQqd+2d1d6h+aqKyKPQETbKCeDyNq168/g06e7+dPaeQe9aRP Nym0e3wrFb2z+TRRjpt4AEEUa7Ncb4fXPlSnPS/tolzNM0hPrLiRrPJrXaNTnk/Y6+1M PrT/5uufIDxOBMzsIVZuQSa4ySe28ffPAkifCGvDWqab6BspdyHrjPd4DoIJ6wJDX+M1 qnstcDqdihmahvH+TkSnDC8PSYlVf0TDrHfR1K6xf5UTSkQTBxN3OyL9cf7kfOKN9fQO di+tZcvcTuH7g2jL88Mr9MU9AXw5u3mRFhlIG9pyY9O6sCRAKeVzgKbb1ek4/OVaD+xX gRhg== X-Gm-Message-State: AElRT7Fstutv9htPdNpIUbMQTS2oOOzPLpOLWqhrL00pL5kcDTxoJQsm UU2yc4v8MsycteKI21ezTNk= 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 Cc: linux-arm-kernel@lists.infradead.org, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, be17068@iperbole.bo.it, Marcus Cooper Subject: [PATCH v2 6/6] ASoC: sun4i-i2s: Add support for loopback 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.16.2