From patchwork Sat Oct 28 09:38:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Bondavalli X-Patchwork-Id: 831594 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iGML7PU7"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cp44vPoy"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yPFzz5nN7z9t30 for ; Sat, 28 Oct 2017 20:38:39 +1100 (AEDT) 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:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Subject:To:From :Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ACzCeyx25094MFm86PXq0igk9Z8dc2zRCo3hD0iemD4=; b=iGML7PU7RD94tw Ymbxz66DkNfYgxBxgKaZlegPVcdzGdfrkwpa7WKb1cBfQzaCsvUYkAnsub741BebxItmXbkyCMqCq E57XbDNwEXGcfdpsFc93vg2C3cU7fX7sf96S3riyDZdwXV8e6Y6nPEB3XPbtpXx292n03E70JGxP8 VdSThLnZBpFHza+goQO73ntEQ2MuNUOFf25lrpnAU2dDJogmn+F2N6dRgn9EGxIh8RXAMklbyv1C4 tPv9CuisQA2ptGctMMqSYygrtIUNwDgJoIsquPWA1wHTBgUIXYqQx+FlL4A8iuCNvRkw6GAdbBED9 Swg6TnUN0U8CYnOFTp1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e8NZa-0003TW-29; Sat, 28 Oct 2017 09:38:34 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e8NZW-0003Sc-Gw for linux-arm-kernel@lists.infradead.org; Sat, 28 Oct 2017 09:38:32 +0000 Received: by mail-wr0-x242.google.com with SMTP id r79so8108068wrb.13 for ; Sat, 28 Oct 2017 02:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent:content-transfer-encoding; bh=6W+ImkdmhBavYbg5YwFRcdG7o6fCx4imICpejGLG3QA=; b=cp44vPoynAL+MXgwpvBS+iAmtZk8TialTwn5Tpb1f9G9b0Fr0AQK4Yk/nVcPPEWdZY R5/MGhuz6neWnGikMfk35QSnZ6z3GEi2W5r00ahFGIecu6mWlWq/UNlus9HZgrNj4GOT u579OQ4XGWiV02pTUG6CaRs9ZDuRNo+FEwmw6DEXWTR2XDA52z31I66fYMTfv4S4Tw0M UgPSyNeyG0AYZf+sgWLel5spKr5NJwpqui9mLngs9tsKJSgVDCtx4iyRfsK/k+8UB4F0 EYBvi3jreSl7bojdHoBcNmEe/bkfUr3Xz24tmzCd72/h6cev6xg2EeyT+55QxX9gff7Z Cv+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent:content-transfer-encoding; bh=6W+ImkdmhBavYbg5YwFRcdG7o6fCx4imICpejGLG3QA=; b=jfHBxX6ojNgp2Ge9ivMotfjAablt2VdGhJlBd9rssmTtKno7xpUqOUDdcyxXLXMFvy RXFejLAhOD1zb1BWfVhpKtgoEiPfVjOouVZoKMUGOvH9GS022JoHKL14GyxeEq01pWOX MY6NgJeLN3P+cPg/eU+pa4/5pNThjZf3CIN6mfgq8WQFzRscyXne1o++d+9bTKq0K0jB EBQ9G6qF8tIQUvdIzE9Vvxom3afMgOgHVhFHuKUric0sR9Ekp9A1hvG1DTG5gpgj63n4 y8axmgdX8n17aItlkVSNapqGMQ/Rghwh4WW4BhzD88LfS5IAwsMZjq7KvmD4xIB0FJFo 0EtQ== X-Gm-Message-State: AMCzsaVTpkykGdpA8LMIS7Oxg9rh64xdo/tkldecZRVzxVmZV5nX0xep PmMhNB9VRrFUcIHBI54C6Yg= X-Google-Smtp-Source: ABhQp+S/KscIPZU5/XARykHNAPnLnLVG+wt4IfkchKGH0FKqb/yxF0MKEbn0BeQyip2vkbwWDzuUyA== X-Received: by 10.223.146.197 with SMTP id 63mr2498720wrn.180.1509183487296; Sat, 28 Oct 2017 02:38:07 -0700 (PDT) Received: from ubuntu (46-126-237-199.dynamic.hispeed.ch. [46.126.237.199]) by smtp.gmail.com with ESMTPSA id z35sm14959640wrc.9.2017.10.28.02.38.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Oct 2017 02:38:06 -0700 (PDT) Date: Sat, 28 Oct 2017 02:38:01 -0700 From: Andrea Bondavalli To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Subject: [PATCH] ASoC: sun4i-codec: fixed 32bit audio capture support for H3/H2+ Message-ID: <20171028093755.GA4131@ubuntu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Antivirus: Avast (VPS 171028-0, 28.10.2017), Outbound message X-Antivirus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171028_023830_744628_ACEBBA67 X-CRM114-Status: GOOD ( 10.88 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c0c:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (andrea.bondavalli74[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (andrea.bondavalli74[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Fixed support for 32bit audio capture for Allwinners H3/H2+ SoC Signed-off-by: Andrea Bondavalli --- sound/soc/sunxi/sun4i-codec.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index baa9007..f40fa34 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -346,11 +346,6 @@ static int sun4i_codec_prepare_capture(struct snd_pcm_substream *substream, 0x3 << 8, 0x1 << 8); - /* Fill most significant bits with valid data MSB */ - regmap_field_update_bits(scodec->reg_adc_fifoc, - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), - BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); - return 0; } @@ -490,6 +485,30 @@ static int sun4i_codec_hw_params_capture(struct sun4i_codec *scodec, BIT(SUN4I_CODEC_ADC_FIFOC_MONO_EN), 0); + /* Set the number of sample bits to either 16 or 24 bits */ + if (hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min == 32) { + regmap_field_update_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS)); + + regmap_field_update_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + 0); + + scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; + } else { + regmap_field_update_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_SAMPLE_BITS), + 0); + + /* Fill most significant bits with valid data MSB */ + regmap_field_update_bits(scodec->reg_adc_fifoc, + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE), + BIT(SUN4I_CODEC_ADC_FIFOC_RX_FIFO_MODE)); + + scodec->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + } + return 0; }