From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC702C43603 for ; Tue, 17 Dec 2019 10:31:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FBFD20717 for ; Tue, 17 Dec 2019 10:31:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="dfWCytMo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FBFD20717 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0527382A; Tue, 17 Dec 2019 11:30:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0527382A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1576578708; bh=pyi0WaSIQIjHnb9FNeaaTPvBFUgiGZCFkTYvT+3l8uc=; h=Date:From:To:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=dfWCytMo+8mBnHOr+LLHWTNEGnPM26rRjK7aw9EtZt1YBDHFu8HB5rfd2TRa7Kp7I Lm7hunAA2mLUZBOFLJOQRo1+VvWtodgD7B2DURkWUdN9jxdQuvyWLOhI2MMFMgJJ/S L8+dqn5hjhzLPLuC1indLq21PWb0fHVz0+HQE23k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 77108F80218; Tue, 17 Dec 2019 11:30:57 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3885F80100; Tue, 17 Dec 2019 11:30:55 +0100 (CET) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2490DF80100 for ; Tue, 17 Dec 2019 11:30:52 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2490DF80100 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 00726B01D; Tue, 17 Dec 2019 10:30:52 +0000 (UTC) Date: Tue, 17 Dec 2019 11:30:51 +0100 Message-ID: From: Takashi Iwai To: Cezary Rojewski In-Reply-To: <20191217095851.19629-8-cezary.rojewski@intel.com> References: <20191217095851.19629-1-cezary.rojewski@intel.com> <20191217095851.19629-8-cezary.rojewski@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: lgirdwood@gmail.com, alsa-devel@alsa-project.org, broonie@kernel.org, tiwai@suse.com, pierre-louis.bossart@linux.intel.com Subject: Re: [alsa-devel] [PATCH 7/7] ASoC: SOF: Intel: Account for compress streams when servicing IRQs X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Tue, 17 Dec 2019 10:58:51 +0100, Cezary Rojewski wrote: > > Update stream irq handler definition to correctly set hdac_stream > current position when servicing stream interrupts for compress streams. > > Cc: Pierre-Louis Bossart > Signed-off-by: Cezary Rojewski > --- > include/sound/hdaudio.h | 1 + > sound/soc/sof/intel/hda-stream.c | 26 ++++++++++++++++++++++++-- > 2 files changed, 25 insertions(+), 2 deletions(-) > > diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h > index 9a8bf1eb7d69..9a24d57f0cf2 100644 > --- a/include/sound/hdaudio.h > +++ b/include/sound/hdaudio.h > @@ -496,6 +496,7 @@ struct hdac_stream { > bool locked:1; > bool stripe:1; /* apply stripe control */ > > + unsigned long curr_pos; Unless the actual implementation of this user is shown, it's a bit hard to judge whether this addition is really OK or not.... I don't believe it'd be a big problem at all, but still we need the usage implementation for a proper evaluation. And, IMO, such a change should be split to two parts: the common API change and its user. thanks, Takashi > /* timestamp */ > unsigned long start_wallclk; /* start + minimum wallclk */ > unsigned long period_wallclk; /* wallclk for period */ > diff --git a/sound/soc/sof/intel/hda-stream.c b/sound/soc/sof/intel/hda-stream.c > index c0ab9bb2a797..ddf755a5a730 100644 > --- a/sound/soc/sof/intel/hda-stream.c > +++ b/sound/soc/sof/intel/hda-stream.c > @@ -571,6 +571,23 @@ bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev) > return ret; > } > > +static void hda_dsp_update_bytes_transferred(struct hdac_stream *hstream, > + u64 buffer_size) > +{ > + unsigned int prev_pos; > + int pos, num_bytes; > + > + div_u64_rem(hstream->curr_pos, buffer_size, &prev_pos); > + pos = snd_hdac_stream_get_pos_posbuf(hstream); > + > + if (pos < prev_pos) > + num_bytes = (buffer_size - prev_pos) + pos; > + else > + num_bytes = pos - prev_pos; > + > + hstream->curr_pos += num_bytes; > +} > + > static bool hda_dsp_stream_check(struct hdac_bus *bus, u32 status) > { > struct sof_intel_hda_dev *sof_hda = bus_to_sof_hda(bus); > @@ -588,14 +605,19 @@ static bool hda_dsp_stream_check(struct hdac_bus *bus, u32 status) > snd_hdac_stream_writeb(s, SD_STS, sd_status); > > active = true; > - if (!s->substream || > + if ((!s->substream && !s->cstream) || > !s->running || > (sd_status & SOF_HDA_CL_DMA_SD_INT_COMPLETE) == 0) > continue; > > /* Inform ALSA only in case not do that with IPC */ > - if (sof_hda->no_ipc_position) > + if (s->substream && sof_hda->no_ipc_position) { > snd_sof_pcm_period_elapsed(s->substream); > + } else if (s->cstream) { > + hda_dsp_update_bytes_transferred(s, > + s->cstream->runtime->buffer_size); > + snd_compr_fragment_elapsed(s->cstream); > + } > } > } > > -- > 2.17.1 > _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel