From patchwork Fri Jan 25 20:30:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10782007 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 3A6A9746 for ; Fri, 25 Jan 2019 20:30:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 290B330620 for ; Fri, 25 Jan 2019 20:30:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1DA363065E; Fri, 25 Jan 2019 20:30:30 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham 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 6A0E330620 for ; Fri, 25 Jan 2019 20:30:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 570DC26680F; Fri, 25 Jan 2019 21:30:27 +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 5FEFC267350; Fri, 25 Jan 2019 21:30:25 +0100 (CET) Received: from crapouillou.net (outils.crapouillou.net [89.234.176.41]) by alsa0.perex.cz (Postfix) with ESMTP id 583EA2666B3 for ; Fri, 25 Jan 2019 21:30:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1548448221; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=nU4nsC16XwU32AgrNaULkRhA19eZpel/HCT5A8SWe08=; b=OylEizMGiL5YRP90sN3JQebYz/Vmw8HxsMTwgTxTpinKVlaS1wJR+0b9YR/hcy+3hG/FPF k2U4GUQWSX07AGufgC71QM5ShYIUZDov1LNTVhLZmAqYgdAJg7tRYTS1akjEGfQGl8FWLS W2R5uyexFzmsPSOSdYlxreCdhqfDd/s= From: Paul Cercueil To: Liam Girdwood , Mark Brown Date: Fri, 25 Jan 2019 17:30:09 -0300 Message-Id: <20190125203009.24301-2-paul@crapouillou.net> In-Reply-To: <20190125203009.24301-1-paul@crapouillou.net> References: <20190125203009.24301-1-paul@crapouillou.net> Cc: Paul Cercueil , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 2/2] sound: soc: jz4740: Add support for multichannel audio on JZ4780 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 The jz4780 SoC offers the possibility to configure the number of channels used for playback. Right now, the corresponding bits in the configuration register are always zero, which means that the hardware is only configured for monaural sound. With this commit, the hardware is now correctly configured for the number of channels requested by ALSA. Signed-off-by: Paul Cercueil --- sound/soc/jz4740/jz4740-i2s.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index e099c0505b76..05a9d7c20fb0 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -65,6 +65,7 @@ #define JZ4780_AIC_CONF_FIFO_TX_THRESHOLD_MASK \ (0x1f << JZ4780_AIC_CONF_FIFO_TX_THRESHOLD_OFFSET) +#define JZ_AIC_CTRL_CHANNELS_MASK (0x7 << 24) #define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_MASK (0x7 << 19) #define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_MASK (0x7 << 16) #define JZ_AIC_CTRL_ENABLE_RX_DMA BIT(15) @@ -81,6 +82,7 @@ #define JZ_AIC_CTRL_ENABLE_PLAYBACK BIT(1) #define JZ_AIC_CTRL_ENABLE_CAPTURE BIT(0) +#define JZ_AIC_CTRL_CHANNELS_OFFSET 24 #define JZ_AIC_CTRL_OUTPUT_SAMPLE_SIZE_OFFSET 19 #define JZ_AIC_CTRL_INPUT_SAMPLE_SIZE_OFFSET 16 @@ -287,6 +289,12 @@ static int jz4740_i2s_hw_params(struct snd_pcm_substream *substream, else ctrl &= ~JZ_AIC_CTRL_MONO_TO_STEREO; + if (i2s->version >= JZ_I2S_JZ4780) { + ctrl &= ~JZ_AIC_CTRL_CHANNELS_MASK; + ctrl |= (params_channels(params) - 1) << + JZ_AIC_CTRL_CHANNELS_OFFSET; + } + div_reg &= ~I2SDIV_DV_MASK; div_reg |= (div - 1) << I2SDIV_DV_SHIFT; } else {