From patchwork Fri Jan 25 20:30:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10782009 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 49C8691E for ; Fri, 25 Jan 2019 20:30:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3772D3062D for ; Fri, 25 Jan 2019 20:30:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B99730669; Fri, 25 Jan 2019 20:30:35 +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 BE3AD30654 for ; Fri, 25 Jan 2019 20:30:34 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 06959267964; Fri, 25 Jan 2019 21:30:30 +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 3A08B267350; Fri, 25 Jan 2019 21:30:26 +0100 (CET) Received: from crapouillou.net (outils.crapouillou.net [89.234.176.41]) by alsa0.perex.cz (Postfix) with ESMTP id B0B762666B3 for ; Fri, 25 Jan 2019 21:30:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1548448219; 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:references; bh=2GB/9omsfAEJyxvwqR9Fp/FkRyq3uxmoYeckV+aQibQ=; b=JhRR6ouOHPn3mJD/ms9WPtt1JppWnhQCHDlRWQmArUva1qk+6c2NlTrpsu2NVSUYWoj//e CZ5xPp/F3ZJbAfX0+/6VTsuolqpY2A7siLhk7724tmYHe6CqHbYAlyga53P8LEklQy3ZxC Zif3mwgAZ97+D0rB4u737Dle5jHoYAg= From: Paul Cercueil To: Liam Girdwood , Mark Brown Date: Fri, 25 Jan 2019 17:30:08 -0300 Message-Id: <20190125203009.24301-1-paul@crapouillou.net> Cc: Paul Cercueil , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH 1/2] sound: soc: JZ4740: Fix divider written at incorrect offset in register 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 4-bit divider value was written at offset 8, while the jz4740 programming manual locates it at offset 0. Fixes: 26b0aad80a86 Signed-off-by: Paul Cercueil --- sound/soc/jz4740/jz4740-i2s.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c index 99394c036998..e099c0505b76 100644 --- a/sound/soc/jz4740/jz4740-i2s.c +++ b/sound/soc/jz4740/jz4740-i2s.c @@ -92,7 +92,7 @@ #define JZ_AIC_I2S_STATUS_BUSY BIT(2) #define JZ_AIC_CLK_DIV_MASK 0xf -#define I2SDIV_DV_SHIFT 8 +#define I2SDIV_DV_SHIFT 0 #define I2SDIV_DV_MASK (0xf << I2SDIV_DV_SHIFT) #define I2SDIV_IDV_SHIFT 8 #define I2SDIV_IDV_MASK (0xf << I2SDIV_IDV_SHIFT) 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 {