From patchwork Sun Oct 29 09:41: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: 831686 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="NxmX4TB9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="FqI5I4Es"; 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 3yPt1J2fZ5z9sNV for ; Sun, 29 Oct 2017 20:41:54 +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=xvNfDS6O09TyMgGB6pvilghgEygkeewHqSNWejscIn8=; b=NxmX4TB9+YoIBy 9FMIYvicAJ8stTdc3LChiEFMCBFT5EJU6sHLO4K7XZKs96yLNs2+cbsutwxJS9avuoLzDfkk2UiZN VXhoNIHIjm7aRrGmErIzjhAUI2f+yF0Kb99vQWXt7MYaGuVBLukxLgC8n7JSm8itfnOdJVlVVGGOe WmhZLu9AGb6Wu1RdZnaSYPASWn/pAJgba6+OoLWAZCVQJD022XS47ruZEjdtulEhbeJtlh83uvp2D mryrsJGQajNW0w0jPykP0KMBqS5pEeE2zPhJiwP04EytAHj6LpfZharcaTnPqtd9SIOU2AM0KvUf+ GEljpDV6vPS+mesmXBag==; 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 1e8k6E-0000ij-VS; Sun, 29 Oct 2017 09:41:46 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e8k5y-0000fq-Lh for linux-arm-kernel@lists.infradead.org; Sun, 29 Oct 2017 09:41:32 +0000 Received: by mail-wm0-x243.google.com with SMTP id s66so10201001wmf.5 for ; Sun, 29 Oct 2017 02:41:09 -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=hfIpcBr3AAYp9Mzv07t7abBG2fqxced8eQNUX2OlgkY=; b=FqI5I4EsKVYBHQ1A/HVtVStEW40jGCHtN9QJVF/d/5hOpI6kj2CSxoIA0WmWGSrl9U VZT//mf9XL+RoJPUYD4Xm67JzYmdYlMozZj3zePcLbAmFvkQ0bt4Z9nenQt2FhlTBBfd Ik3lEe+cGPQ/da3i2is3VX4MOshqUCWgdRhZeg4fxmATvS1Nk+BWP4yKC1IkWL3R5kFL C1DmY6uozNj0ur3XIBbg8wdDmJNkTFoCqis/FF/es4aGxtL+ZHH1obvBvK0Yhz8Fd3mF 1bp1QSa4JZXprTBNz3EtFSLM3Xp6ixfJfHZhAOsXC4HsnLjFY8RG8oldCYkiMbpWe5bw EdCw== 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=hfIpcBr3AAYp9Mzv07t7abBG2fqxced8eQNUX2OlgkY=; b=n3f7MkRYHUz2mgp1HByWNDrvnFvgXyruQU0/7DW/vyHtEAjCGTQ2ZZ0vc+gNmA6QV/ mGJPr7+x9g+WIXwWHlymGNMYOpAz5vRfolPj9KVjuSIBJNbs8J9QwgRdrNd2GFvtVKeg oxreM8/zsxW4p/urjLtzwh4LQDZ18cwQdiNuhz7/EYVqxJSFKX+WNe3vaUl8l54w287V RnBCwrrAyPWPaztz3b3wdINTEooiZHlj6CFmoCXujU8qfSila1kvLihPYjjV28Ino3su AUsHjPxe/GPuoPQ3lMWHQhXU9TDXrsyBJBYwZZXDogJDvRVO7cwGh0GXmZtbnZS+S2DG 8qUw== X-Gm-Message-State: AMCzsaVgcocywGov1b0J7TTbAx5Q0TSa0jiiVZR0DBcMKP0CVRW621ic yzkX14skprthywo/Srb3SZc= X-Google-Smtp-Source: ABhQp+QWFfEyb+VBOA1VDrvQGzCoDdV8rtQR4y1V9mUrfpcyu/fjNrh9ejsheF58FSwuiG0t7gEXVQ== X-Received: by 10.28.230.216 with SMTP id e85mr1260383wmi.86.1509270068299; Sun, 29 Oct 2017 02:41:08 -0700 (PDT) Received: from ubuntu (46-126-237-199.dynamic.hispeed.ch. [46.126.237.199]) by smtp.gmail.com with ESMTPSA id b11sm10635843wrd.91.2017.10.29.02.41.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 02:41:07 -0700 (PDT) Date: Sun, 29 Oct 2017 02:41: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: <20171029094048.GA5295@ubuntu> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Antivirus: Avast (VPS 171029-0, 29.10.2017), Outbound message X-Antivirus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171029_024130_892407_5AD32076 X-CRM114-Status: GOOD ( 10.86 ) 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 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 -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2a00:1450:400c:c09:0:0:0:243 listed in] [list.dnswl.org] 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 Allwinner 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->capture_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->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + } + return 0; }