From patchwork Tue Jul 30 10:16:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rajwa, Marcin" X-Patchwork-Id: 11065527 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 5B745912 for ; Tue, 30 Jul 2019 10:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B87228758 for ; Tue, 30 Jul 2019 10:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F664287A0; Tue, 30 Jul 2019 10:17:25 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E9A4D28758 for ; Tue, 30 Jul 2019 10:17:23 +0000 (UTC) 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 30C801846; Tue, 30 Jul 2019 12:16:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 30C801846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1564481842; bh=XGxWRvlQzvqB77Rgrt5HSWKVXvIK7Z2unKVOn5Iu7Yk=; h=To:From:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=YFVVYwGOHX3vsXamxxZVSPLOXOTMun7JR4wT8OsAaOaTPVksfVMA22dMzNmyxjite WeEVXLhQY+0VB72Xode42ZhYxcB/fsf8HE2f7pl8jM1Mpy2Ny6+cXHcXmhbDDusQ71 QqeZIk77/VM94PNTdEqEJIevM5ebNessDEq7jSzs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8F275F80482; Tue, 30 Jul 2019 12:16:31 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 28B08F804CA; Tue, 30 Jul 2019 12:16:30 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 159CBF80214 for ; Tue, 30 Jul 2019 12:16:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 159CBF80214 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 03:16:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="370902392" Received: from mrajwa-mobl.ger.corp.intel.com (HELO [10.237.142.227]) ([10.237.142.227]) by fmsmga005.fm.intel.com with ESMTP; 30 Jul 2019 03:16:22 -0700 To: marcin.rajwa@intel.com, Keyon Jie , ranjani.sridharan@linux.intel.com, Pierre-Louis Bossart , kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org From: "Rajwa, Marcin" Message-ID: <9d92551a-fa10-4ecd-47f1-5b3b67824a12@linux.intel.com> Date: Tue, 30 Jul 2019 12:16:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 Content-Language: en-US Subject: [alsa-devel] [PATCH v4 1/2] ASoC: SOF: introduce no_stream_position so host_period_bytes preserves its data 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marcin Rajwa Change the use of host_period_bytes. So far this field was used as an bool value indicating whether FW should send stream position update. With this patch we use host_period_bytes to provide firmware information about the frequency of host interrupts aimed to read its input buffer. This is accoring to ALSA definition of 'FramePeriod'. Knowing this firmware can safely copy large/irregular chunks of data (like data comming from i.e draining task) without the risk of buffer overflow. Signed-off-by: Marcin Rajwa Signed-off-by: Keyon Jie Reviewed-by: Ranjani Sridharan ---  include/sound/sof/stream.h | 4 ++--  1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sound/sof/stream.h b/include/sound/sof/stream.h index 643f175cb479..06af4ecb2584 100644 --- a/include/sound/sof/stream.h +++ b/include/sound/sof/stream.h @@ -83,10 +83,10 @@ struct sof_ipc_stream_params {      uint16_t sample_valid_bytes;      uint16_t sample_container_bytes; -    /* for notifying host period has completed - 0 means no period IRQ */      uint32_t host_period_bytes; +    uint16_t no_stream_position; /* 1 means no IPC for position update */ -    uint32_t reserved[2]; +    uint16_t reserved[3];      uint16_t chmap[SOF_IPC_MAX_CHANNELS];    /**< channel map - SOF_CHMAP_ */  } __packed; From patchwork Tue Jul 30 10:22:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Rajwa, Marcin" X-Patchwork-Id: 11065531 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 1EB96112C for ; Tue, 30 Jul 2019 10:24:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F683287A1 for ; Tue, 30 Jul 2019 10:24:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03B8A287AF; Tue, 30 Jul 2019 10:24:00 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 534EA287A1 for ; Tue, 30 Jul 2019 10:23:59 +0000 (UTC) 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 8F38117C2; Tue, 30 Jul 2019 12:23:07 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8F38117C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1564482237; bh=WVmowaix8UzgIeNj12/F0As/iZAecfzuYUrSQ/9lD6g=; h=References:To:From:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SJy8Q8oxTVXS6VAHxFtaNgwzmfsg2xN7q3eINerw91HdAT9tjP0T2qzb99Z7HFhdR 9GcDSG7S6K2t3A54CrmPU0mE1osd0ekYb63SDnu7wS3m/QjdjSpnjV5Bw3DHEOzw64 DqStoZ7XVjc1Gkciw39dhz/ANOcvYeSQ5vyLP5Wo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 54F25F800AB; Tue, 30 Jul 2019 12:22:45 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1DA1AF804FD; Tue, 30 Jul 2019 12:22:44 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 04618F800AB for ; Tue, 30 Jul 2019 12:22:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 04618F800AB X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jul 2019 03:22:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,326,1559545200"; d="scan'208";a="370903133" Received: from mrajwa-mobl.ger.corp.intel.com (HELO [10.237.142.227]) ([10.237.142.227]) by fmsmga005.fm.intel.com with ESMTP; 30 Jul 2019 03:22:37 -0700 References: <9d92551a-fa10-4ecd-47f1-5b3b67824a12@linux.intel.com> To: alsa-devel@alsa-project.org, Keyon Jie , ranjani.sridharan@linux.intel.com, Pierre-Louis Bossart , marcin.rajwa@intel.com, kai.vehmanen@linux.intel.com From: "Rajwa, Marcin" X-Forwarded-Message-Id: <9d92551a-fa10-4ecd-47f1-5b3b67824a12@linux.intel.com> Message-ID: Date: Tue, 30 Jul 2019 12:22:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <9d92551a-fa10-4ecd-47f1-5b3b67824a12@linux.intel.com> Content-Language: en-US Subject: [alsa-devel] [PATCH v4 2/2] ASoC: SOF: Intel: fix reset of host_period_bytes 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marcin Rajwa This patch prevents the reset of host period bytes and uses no_stream_position to record requests for stream position. Signed-off-by: Marcin Rajwa Signed-off-by: Keyon Jie Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen ---  sound/soc/sof/intel/hda-pcm.c | 4 ++--  1 file changed, 2 insertions(+), 2 deletions(-) Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c index 9b730f183529..956407cf59ea 100644 --- a/sound/soc/sof/intel/hda-pcm.c +++ b/sound/soc/sof/intel/hda-pcm.c @@ -116,9 +116,9 @@ int hda_dsp_pcm_hw_params(struct snd_sof_dev *sdev,      /* disable SPIB, to enable buffer wrap for stream */      hda_dsp_stream_spib_config(sdev, stream, HDA_DSP_SPIB_DISABLE, 0); -    /* set host_period_bytes to 0 if no IPC position */ +    /* update no_stream_position flag for ipc params */      if (hda && hda->no_ipc_position) -        ipc_params->host_period_bytes = 0; +        ipc_params->no_stream_position = 1;      ipc_params->stream_tag = hstream->stream_tag; _______________________________________________