From patchwork Wed Sep 3 14:17:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 4834951 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32B19C033A for ; Wed, 3 Sep 2014 14:17:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 033EB200ED for ; Wed, 3 Sep 2014 14:17:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 126AB201DD for ; Wed, 3 Sep 2014 14:17:52 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 93C2526564A; Wed, 3 Sep 2014 16:17:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 70A1826561A; Wed, 3 Sep 2014 16:17:39 +0200 (CEST) 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 EF29C265620; Wed, 3 Sep 2014 16:17:37 +0200 (CEST) Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by alsa0.perex.cz (Postfix) with ESMTP id CA1032655F2 for ; Wed, 3 Sep 2014 16:17:29 +0200 (CEST) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s83EHRsh015108; Wed, 3 Sep 2014 09:17:27 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s83EHR8s028820; Wed, 3 Sep 2014 09:17:27 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Wed, 3 Sep 2014 09:17:26 -0500 Received: from dflp32.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s83EHOq8002721; Wed, 3 Sep 2014 09:17:25 -0500 From: Peter Ujfalusi To: Mark Brown , Liam Girdwood Date: Wed, 3 Sep 2014 17:17:21 +0300 Message-ID: <1409753841-31084-1-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, jsarha@ti.com, zonque@gmail.com Subject: [alsa-devel] [PATCH] ASoC: davinci-mcasp: Fix rx rotation settings 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP We need to take into account the slot size as well when calculating the RROT for received data. This patch will fix S24_3LE audio capture. Signed-off-by: Peter Ujfalusi --- sound/soc/davinci/davinci-mcasp.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index 6a6b2ff7d7d7..267cd4937c7c 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -463,11 +463,11 @@ static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, } static int davinci_config_channel_size(struct davinci_mcasp *mcasp, - int word_length) + int slot_size, int word_length) { u32 fmt; u32 tx_rotate = (word_length / 4) & 0x7; - u32 rx_rotate = (32 - word_length) / 4; + u32 rx_rotate = (slot_size - word_length) / 4; u32 mask = (1ULL << word_length) - 1; /* @@ -726,7 +726,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(cpu_dai); struct davinci_pcm_dma_params *dma_params = &mcasp->dma_params[substream->stream]; - int word_length; + int word_length, slot_size; int channels = params_channels(params); int period_size = params_period_size(params); int ret; @@ -766,31 +766,32 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, case SNDRV_PCM_FORMAT_U8: case SNDRV_PCM_FORMAT_S8: dma_params->data_type = 1; - word_length = 8; + slot_size = word_length = 8; break; case SNDRV_PCM_FORMAT_U16_LE: case SNDRV_PCM_FORMAT_S16_LE: dma_params->data_type = 2; - word_length = 16; + slot_size = word_length = 16; break; case SNDRV_PCM_FORMAT_U24_3LE: case SNDRV_PCM_FORMAT_S24_3LE: dma_params->data_type = 3; - word_length = 24; + slot_size = word_length = 24; break; case SNDRV_PCM_FORMAT_U24_LE: case SNDRV_PCM_FORMAT_S24_LE: dma_params->data_type = 4; word_length = 24; + slot_size = 32; break; case SNDRV_PCM_FORMAT_U32_LE: case SNDRV_PCM_FORMAT_S32_LE: dma_params->data_type = 4; - word_length = 32; + slot_size = word_length = 32; break; default: @@ -803,7 +804,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream, else dma_params->acnt = dma_params->data_type; - davinci_config_channel_size(mcasp, word_length); + davinci_config_channel_size(mcasp, slot_size, word_length); return 0; }