From patchwork Thu Aug 13 14:35:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 41071 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7DEnJ9p025728 for ; Thu, 13 Aug 2009 14:49:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754137AbZHMOsz (ORCPT ); Thu, 13 Aug 2009 10:48:55 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754164AbZHMOsy (ORCPT ); Thu, 13 Aug 2009 10:48:54 -0400 Received: from smtp.nokia.com ([192.100.122.233]:38983 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754135AbZHMOsw (ORCPT ); Thu, 13 Aug 2009 10:48:52 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx06.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n7DEmXSl012260; Thu, 13 Aug 2009 17:48:40 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 13 Aug 2009 17:48:44 +0300 Received: from vaebe101.NOE.Nokia.com ([10.160.244.11]) by vaebh104.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 13 Aug 2009 17:48:44 +0300 Received: from localhost.localdomain ([172.21.41.99]) by vaebe101.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 13 Aug 2009 17:48:42 +0300 From: Eduardo Valentin To: Linux-OMAP , ALSA-Devel Cc: Jarkko Nikula , "\\\"Ujfalusi Peter (Nokia-D/Tampere)\\\"" , "Nurkkala Eero.An (EXT-Offcode/Oulu)" , Eero Nurkkala Subject: [PATCHv3 18/20] ASoC: Always syncronize audio transfers on frames Date: Thu, 13 Aug 2009 17:35:31 +0300 Message-Id: <1250174133-451-19-git-send-email-eduardo.valentin@nokia.com> X-Mailer: git-send-email 1.6.2.GIT In-Reply-To: <1250174133-451-18-git-send-email-eduardo.valentin@nokia.com> References: <1250174133-451-1-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-2-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-3-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-4-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-5-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-6-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-7-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-8-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-9-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-10-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-11-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-12-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-13-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-14-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-15-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-16-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-17-git-send-email-eduardo.valentin@nokia.com> <1250174133-451-18-git-send-email-eduardo.valentin@nokia.com> X-OriginalArrivalTime: 13 Aug 2009 14:48:42.0909 (UTC) FILETIME=[271D74D0:01CA1C25] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Eero Nurkkala All these steps are required for ASoC to behave correctly. rccr and xccr are format dependent, for example TDM audio has different values than I2S or DSP_A. Also the omap_mcbsp_xmit_enable and/or omap_mcbsp_recv_enable must be called right after the DMA has started. This provides no longer L and R channels switching at random. Signed-off-by: Eero Nurkkala --- sound/soc/omap/omap-mcbsp.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 8f361b1..0272d3f 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c @@ -191,6 +191,11 @@ static int omap_mcbsp_dai_trigger(struct snd_pcm_substream *substream, int cmd, case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: if (!mcbsp_data->active++) omap_mcbsp_start(mcbsp_data->bus_id); + /* Make sure data transfer is frame synchronized */ + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + omap_mcbsp_xmit_enable(mcbsp_data->bus_id, 1); + else + omap_mcbsp_recv_enable(mcbsp_data->bus_id, 1); break; case SNDRV_PCM_TRIGGER_STOP: @@ -336,11 +341,15 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, /* 1-bit data delay */ regs->rcr2 |= RDATDLY(1); regs->xcr2 |= XDATDLY(1); + regs->rccr |= RFULL_CYCLE | RDMAEN | RDISABLE; + regs->xccr |= (DXENDLY(1) | XDMAEN | XDISABLE); break; case SND_SOC_DAIFMT_DSP_A: /* 1-bit data delay */ regs->rcr2 |= RDATDLY(1); regs->xcr2 |= XDATDLY(1); + regs->rccr |= RFULL_CYCLE | RDMAEN | RDISABLE; + regs->xccr |= (DXENDLY(1) | XDMAEN | XDISABLE); /* Invert FS polarity configuration */ temp_fmt ^= SND_SOC_DAIFMT_NB_IF; break;