From patchwork Mon Aug 17 06:12:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yang.a.fang@intel.com X-Patchwork-Id: 7023311 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C5D679F373 for ; Mon, 17 Aug 2015 06:13:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E66E720685 for ; Mon, 17 Aug 2015 06:13:56 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 131D2205DC for ; Mon, 17 Aug 2015 06:13:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9C3E9260595; Mon, 17 Aug 2015 08:13:52 +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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 05DE6260547; Mon, 17 Aug 2015 08:13:44 +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 428DB26054D; Mon, 17 Aug 2015 08:13:43 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id CA6E026053D for ; Mon, 17 Aug 2015 08:13:35 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 16 Aug 2015 23:13:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,693,1432623600"; d="scan'208";a="770113021" Received: from mocha.sc.intel.com ([143.183.245.87]) by fmsmga001.fm.intel.com with ESMTP; 16 Aug 2015 23:13:34 -0700 From: yang.a.fang@intel.com To: broonie@kernel.org, lgirdwood@gmail.com Date: Sun, 16 Aug 2015 23:12:25 -0700 Message-Id: <1439791945-106012-1-git-send-email-yang.a.fang@intel.com> X-Mailer: git-send-email 1.7.9.5 Cc: alsa-devel@alsa-project.org, srinivas.sripathi@intel.com, vinod.koul@intel.com, praveen.k.jain@intel.com, dinesh.mirche@intel.com, denny.iriawan@intel.com, "Fang, Yang A" , sathyanarayana.nujella@intel.com, kevin.strasser@linux.intel.com, dgreid@chromium.org Subject: [alsa-devel] [PATCH] ASoC: Intel: Bsw: Read sst DSP DMA pointer after period elapse occurs 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 From: "Fang, Yang A" We should not read sst hw_ptr and pcm_delay in sst_platform_pcm_pointer Since it will be ricky if sst_platform_pcm_pointer is called while dsp is updating the timestamp.Now read sst hw_ptr after period elapse interrupt occurs. Signed-off-by: Fang, Yang A Acked-by: Vinod Koul --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 683e501..d58230b 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -263,17 +263,27 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream, static void sst_period_elapsed(void *arg) { struct snd_pcm_substream *substream = arg; + struct snd_soc_pcm_runtime *rtd; struct sst_runtime_stream *stream; + struct pcm_stream_info *str_info; int status; + int ret_val; if (!substream || !substream->runtime) return; + rtd = substream->private_data; stream = substream->runtime->private_data; if (!stream) return; status = sst_get_stream_status(stream); if (status != SST_PLATFORM_RUNNING) return; + str_info = &stream->stream_info; + ret_val = stream->ops->stream_read_tstamp(sst->dev, str_info); + if (ret_val) { + dev_err(rtd->dev, "sst: err code = %d\n", ret_val); + return; + } snd_pcm_period_elapsed(substream); } @@ -660,20 +670,14 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer (struct snd_pcm_substream *substream) { struct sst_runtime_stream *stream; - int ret_val, status; + int status; struct pcm_stream_info *str_info; - struct snd_soc_pcm_runtime *rtd = substream->private_data; stream = substream->runtime->private_data; status = sst_get_stream_status(stream); if (status == SST_PLATFORM_INIT) return 0; str_info = &stream->stream_info; - ret_val = stream->ops->stream_read_tstamp(sst->dev, str_info); - if (ret_val) { - dev_err(rtd->dev, "sst: error code = %d\n", ret_val); - return ret_val; - } substream->runtime->delay = str_info->pcm_delay; return str_info->buffer_ptr; }