From patchwork Tue Jan 17 12:13:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 13104561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id EDD1BC63797 for ; Tue, 17 Jan 2023 12:14:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8E4AE60F8; Tue, 17 Jan 2023 13:14:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8E4AE60F8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673957691; bh=rGZDowB938FY5rEc62uxZubb2Ip5dpb68llWewfB7pQ=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=I0m2j+kcslw1s1vwFVmtnwMaNg/1eE+DKLe4X4uy14HhimyyokacUaqgsLI5PkT1k rtfTU020gs2lKudj0sHlqkqwr9sccXeuXgnJnjC7hRkUAy7Mma4BS6o1rmzEF0MRIV 0oDFFp0CPuQB66aARty3f7eHf52GArBwHqjgEgiY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9D1A6F80506; Tue, 17 Jan 2023 13:13:35 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 65E75F80506; Tue, 17 Jan 2023 13:13:33 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) (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 933FFF80083 for ; Tue, 17 Jan 2023 13:13:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 933FFF80083 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=dTeElcvp ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DbEtft/YaSHLAaGnolOgbg70T8Yxo0e2AZJbTYGDF+nEwdci750GvbBW1eHY3EypDKTEWu44K91O6En4cMYFMYC4WYmWcRJco86XC6/fxrF2rPBFd8H3JHY8pG1yQXyiwVnafzSQ5HtL3d+YeIsVAbC1GyunbN+wPbVv7c2YUYKJduVuCi0sKkcDugys0+WP3tVrMjJsEFlM0rCqP5vr8WTIjTfzRbNYk4hZe/QsOhVFzsfcg9P3dPQK2loomE6pbH0kKzes0eGphCA3zit6/HOljt8ty/azN5uUKdfCLWRZWhws5zriToHzgdUAtWkZ1/Ij4PwdhMlJz2R1jKx90g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QQFoR14869BPDFAV3d4Dnf4aqmzatPC7m64G6ndoUCA=; b=Y1hcn036saBlkstiPdFU1DxaRzTy0QQz3lhKZi50qRqv5OTfcM8f6lkur4qyzLZQc6yOfgWXDFYGZGSLq04/y7DvAK+JAiPeP1dQR/qHL9kdOF9S9aGiRS2dTvcTNkLUYlbR3YlCb2einYEj/525pFUczxPrC6OC3IdeJxeTxStWfWeI9WlEM+7mKbvhN92G6HyQCIr2LC/VXcqgC5y05oyZeix9iCE5hDvRcaV2zaTYjYH6i3HlujwIE/gwatmRBP9Hj9gISwmr6PYM7TPcS4r4GlDuaXNdYNWNr7WavJmb6Dh0+99Flqp2V08tQws2dN3ONlKQp9mIG8hoDGxUeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QQFoR14869BPDFAV3d4Dnf4aqmzatPC7m64G6ndoUCA=; b=dTeElcvpjRpVZOMXX6MlahOyce9pqvqVKORFunPR2QzG/mteE3dcuGQeefGUH2xnz6K9a/58UmH5+yIdOL3IOns3QJ7XqOeKKVAZeSEBqJu2tXm97gqSYeBUt3RAyybQ7n7CDGqYHByU10t6reddZH0otFyfUg7xV7fovi1BQ0Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by PAXPR04MB9373.eurprd04.prod.outlook.com (2603:10a6:102:2b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 12:13:25 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226%4]) with mapi id 15.20.6002.013; Tue, 17 Jan 2023 12:13:25 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 1/4] ASoC: SOF: Prepare ipc_msg_data to be used with compress API Date: Tue, 17 Jan 2023 14:13:04 +0200 Message-Id: <20230117121307.200183-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> References: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::9) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5151:EE_|PAXPR04MB9373:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d71e718-acc8-4325-6a26-08daf8843be0 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r0upXdcoeqosPJSXXfuOC/bKs8yrarx1Sg2yMH3cowG30Xv55s2w0W5eGSBdd3Gsv4x7TGU4++DCREm5/XO/GXzcFShF1HHWVrTiZlKwu1Tt1roYEbkDDZYeYvYUsLfmpjRYeEq2Ayuhti1Xxa6w5QnRujeYbEQvWYVlDgPiEXyqUWFhZlCQ2auaiYhvrMUBi/Vom8oV/2VLkTdFPad4zWV7inyTVnTHtwbPGxweUHHG6MDMc4mEkUPsOxbFQj7OUPYAIm1ulSE1I53OwnTQs6V4i9Z6phW5AEIf59yIu0M8yOHnQPGXDXN7oH84uUORzzAPXnf6CnG5aNJKKhzTuoCxqEVXzM8BY863gCkYh6tj9zMoafkTzuFZ6rw/agdMvJlOoq9w34BxKkR1ACXmAJ/EMQQRJvmef9Y3VT/gGXn5VNCIG58gNlnzAfmJ/62CzF38DPV4uZJw+hmuHEIkNFj0OPQzp25a9FvkSXSGnpzKqhPyNMB5JkARB7XyjZnAYQQW5bbqiiKQgfVrdRV5Ex4JI/xMwZqa9cVoBtpDhGshTl46fuonySOmCPkj1VPwXXwvtyVes/0cF9lwn6XpSd4B6S1t6Xf8fS7pWTbXASORE/xSAFyeq/Fhc46XFs2OTVSu//0B5895JRrnUUSqOJrhipWYjOEcjEzBtprtn9tmm1s+j3M5T1KOEYLokAvv3GCWxQbmxPz0yXTdUoDa7Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5151.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(366004)(346002)(451199015)(316002)(83380400001)(6916009)(8936002)(5660300002)(66556008)(66476007)(4326008)(41300700001)(66946007)(8676002)(2616005)(38350700002)(1076003)(38100700002)(86362001)(6512007)(6506007)(26005)(186003)(52116002)(6666004)(6486002)(478600001)(2906002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aur81q+syCvUB3B0DDky/EEjpPduTit5F8dydbJ/tIf4Ibkjgba7mL8EPFuwwUoPYm3/9RpkwtngrBeMIrgPNu7lzXVKkKib6hhUy/mr6chRNdhtkYfaRVFVTfzrRCK2Mc3DjmihwFo48f8k5xUDa84QRMOnTBKqTrjtt1JCZi5ndGEcN69V/m5Cri1u14WQMXGvQg2nAOzLIx6U3m5VCa3EADxKh1/mxCdNnqyaeSp3RkrhGJrxPv8PFs6Q3DXdFG5AbVU0qvZpx/4R2aMGLk6IsDjUmcKNSF6ra1UgWG5Wq3RoGgVMHkyNLm/H4tthQ3n2DHms2m5Etl6GAL7/sStVYuEt32hsgaS3ep11cZ15J+ywDN6+xNcB5EAbsI2qWJ9EbeG4lBpcZA/nUfsadrJ73gs7N5x3ouPv7F7/6uKstiW8L3q3AJR2IFT7xWCEHymwL2rnO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1bZFCAyCLTuYIhKx4QPvPcO9mJHuMPa/He7gC60s8aUwcVs5kcYN6ZV1+r0fFwS X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4d71e718-acc8-4325-6a26-08daf8843be0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 12:13:25.3405 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xW5LLAnth/1Bl78JClgBIMSxuraD/+4LCWI0QHEd+MAYcWdpKFip4893HsZjvJcim9hMLSH3Gy78CbZmWP9lhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9373 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org, Allen-KH.Cheng@mediatek.com, AjitKumar.Pandey@amd.com, lgirdwood@gmail.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta Make second parameter of ipc_msg_data generic in order to be able to support compressed streams. This patch doesn't hold any functional change. With this case we can use ipc_msg_data, to retrieve information from DSP for both PCM/Compress API. Reviewed-by: Paul Olaru Reviewed-by: Iuliana Prodan Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Daniel Baluta --- sound/soc/sof/amd/acp-ipc.c | 5 +++-- sound/soc/sof/amd/acp.h | 3 ++- sound/soc/sof/intel/hda-ipc.c | 5 +++-- sound/soc/sof/intel/hda.h | 2 +- sound/soc/sof/ipc3.c | 4 ++-- sound/soc/sof/mediatek/mt8186/mt8186.c | 2 +- sound/soc/sof/mediatek/mt8195/mt8195.c | 2 +- sound/soc/sof/ops.h | 4 ++-- sound/soc/sof/sof-priv.h | 6 ++++-- sound/soc/sof/stream-ipc.c | 6 ++++-- 10 files changed, 23 insertions(+), 16 deletions(-) diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c index 5a02753c4610..1f614eff2a68 100644 --- a/sound/soc/sof/amd/acp-ipc.c +++ b/sound/soc/sof/amd/acp-ipc.c @@ -200,14 +200,15 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context) } EXPORT_SYMBOL_NS(acp_sof_ipc_irq_thread, SND_SOC_SOF_AMD_COMMON); -int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, +int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, void *p, size_t sz) { unsigned int offset = sdev->dsp_box.offset; - if (!substream || !sdev->stream_box.size) { + if (!sps || !sdev->stream_box.size) { acp_mailbox_read(sdev, offset, p, sz); } else { + struct snd_pcm_substream *substream = sps->substream; struct acp_dsp_stream *stream = substream->runtime->private_data; if (!stream) diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index 4314094a97fd..d8cc2a92f1c0 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -12,6 +12,7 @@ #define __SOF_AMD_ACP_H #include "../sof-priv.h" +#include "../sof-audio.h" #define ACP_MAX_STREAM 8 @@ -211,7 +212,7 @@ int acp_dsp_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_ty /* IPC callbacks */ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context); -int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, +int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, void *p, size_t sz); int acp_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index a7c454e03952..5705279d0707 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -361,12 +361,13 @@ int hda_dsp_ipc_get_window_offset(struct snd_sof_dev *sdev, u32 id) } int hda_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz) { - if (!substream || !sdev->stream_box.size) { + if (!sps || !sdev->stream_box.size) { sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); } else { + struct snd_pcm_substream *substream = sps->substream; struct hdac_stream *hstream = substream->runtime->private_data; struct sof_intel_hda_stream *hda_stream; diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index caccaf8fba9c..e6f1ff591332 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -656,7 +656,7 @@ int hda_dsp_stream_spib_config(struct snd_sof_dev *sdev, int enable, u32 size); int hda_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz); int hda_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c index 1fef4dcc0936..8e936353c1c0 100644 --- a/sound/soc/sof/ipc3.c +++ b/sound/soc/sof/ipc3.c @@ -847,7 +847,7 @@ static void ipc3_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id) } stream = &spcm->stream[direction]; - ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn)); + ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn)); if (ret < 0) { dev_warn(sdev->dev, "failed to read stream position: %d\n", ret); return; @@ -882,7 +882,7 @@ static void ipc3_xrun(struct snd_sof_dev *sdev, u32 msg_id) } stream = &spcm->stream[direction]; - ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn)); + ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn)); if (ret < 0) { dev_warn(sdev->dev, "failed to read overrun position: %d\n", ret); return; diff --git a/sound/soc/sof/mediatek/mt8186/mt8186.c b/sound/soc/sof/mediatek/mt8186/mt8186.c index dbea604ebc04..597cb4476acb 100644 --- a/sound/soc/sof/mediatek/mt8186/mt8186.c +++ b/sound/soc/sof/mediatek/mt8186/mt8186.c @@ -494,7 +494,7 @@ static snd_pcm_uframes_t mt8186_pcm_pointer(struct snd_sof_dev *sdev, } stream = &spcm->stream[substream->stream]; - ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn)); + ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn)); if (ret < 0) { dev_warn(sdev->dev, "failed to read stream position: %d\n", ret); return 0; diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 5b04fec9c9c9..42bae574c87a 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -520,7 +520,7 @@ static snd_pcm_uframes_t mt8195_pcm_pointer(struct snd_sof_dev *sdev, } stream = &spcm->stream[substream->stream]; - ret = snd_sof_ipc_msg_data(sdev, stream->substream, &posn, sizeof(posn)); + ret = snd_sof_ipc_msg_data(sdev, stream, &posn, sizeof(posn)); if (ret < 0) { dev_warn(sdev->dev, "failed to read stream position: %d\n", ret); return 0; diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index c52752250565..db92cd338467 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -472,10 +472,10 @@ static inline int snd_sof_load_firmware(struct snd_sof_dev *sdev) /* host DSP message data */ static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz) { - return sof_ops(sdev)->ipc_msg_data(sdev, substream, p, sz); + return sof_ops(sdev)->ipc_msg_data(sdev, sps, p, sz); } /* host side configuration of the stream's data offset in stream mailbox area */ static inline int diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 752bf46c7bc9..39b015c59168 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -20,6 +20,8 @@ #include #include +struct snd_sof_pcm_stream; + /* Flag definitions used in sof_core_debug (sof_debug module parameter) */ #define SOF_DBG_ENABLE_TRACE BIT(0) #define SOF_DBG_RETAIN_CTX BIT(1) /* prevent DSP D3 on FW exception */ @@ -247,7 +249,7 @@ struct snd_sof_dsp_ops { /* host read DSP stream data */ int (*ipc_msg_data)(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz); /* mandatory */ /* host side configuration of the stream's data offset in stream mailbox area */ @@ -761,7 +763,7 @@ int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type, u32 offset, void *dest, size_t size); int sof_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz); int sof_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, diff --git a/sound/soc/sof/stream-ipc.c b/sound/soc/sof/stream-ipc.c index 5f1ceeea893a..13e44501d442 100644 --- a/sound/soc/sof/stream-ipc.c +++ b/sound/soc/sof/stream-ipc.c @@ -19,6 +19,7 @@ #include "ops.h" #include "sof-priv.h" +#include "sof-audio.h" struct sof_stream { size_t posn_offset; @@ -26,12 +27,13 @@ struct sof_stream { /* Mailbox-based Generic IPC implementation */ int sof_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, void *p, size_t sz) { - if (!substream || !sdev->stream_box.size) { + if (!sps || !sdev->stream_box.size) { snd_sof_dsp_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); } else { + struct snd_pcm_substream *substream = sps->substream; struct sof_stream *stream = substream->runtime->private_data; /* The stream might already be closed */ From patchwork Tue Jan 17 12:13:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 13104564 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 00116C3DA78 for ; Tue, 17 Jan 2023 12:15:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B54AD5F53; Tue, 17 Jan 2023 13:14:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B54AD5F53 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673957737; bh=3dYIBo2YhVKETSxboSicoL7ymV4MLLiyACpr3dY4+i8=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=t7TVNJv5w9B4jb6UKmqWui1B7dQNsm8qZeHThgGnm/WxuFVMjt0NNeLjVGWXSbiTH CxjlyeKlUUeIPfLCQN57P+CeR+a3okx8HZb1yY4TbQcLGI3WJs/BpMe1g0t3btfCkk p2tP8uKmmkJTMSxSTBdGPiPz+K7zDOzcVRMpDHq0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3C006F8055C; Tue, 17 Jan 2023 13:13:39 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B55FAF804E6; Tue, 17 Jan 2023 13:13:36 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) (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 D6513F804E6 for ; Tue, 17 Jan 2023 13:13:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D6513F804E6 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=VrpuXv7n ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aMmDMtHc2yFnUdnP0XQ1ZI2mVrYReM3+DUXE0Oo8ihynbl4SpLoRjdfD488CVf+YgKxllwGXJHebzQZ+0R829VHdaxaNJIplu/kfy9C31UhLD57espgB4/XZ+9HmYXTH5jtGQgAiRfnDoJaEQTbHRcwoNspCs1lwba2TLI6szPJelzlQHRYAFkoPOluedlBDR2ZuqLkU9SRfkPiNcMZJwjsgGBWqd0+zSBXLkmF3L4JLAkN2pm4Jk1iXX63AH/VNPz4CkEEPpl8SSYRPNpiAkvD6ree7wlOjACxYBaChuIPmIXlGnHF3/SkE81WmiaXktWzDV4oEN+DoX2vf4QSa+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=dlZ0D3uPJ8Li+tdjDdPmIc98pNQcO1XVPWTj8bralP4=; b=WaUmjtGFpehq7sLGbmYc+fc3tMvtgCeptyvjo978Upg124WLunV28VJD6sIfzEIjMJ7rlIuxtNv/3d689Vk/rf97HdNdFH6RQA3s/BBFqj0cDgMIOy9OtoaR3XfVThtflZ2/y3sUCe31bmgx5XItQCGmJgcaGmXd5X4obbhJTUCd/PulhK9DGSEgL5Xwnc5oLWNtzKrsaTTTad4aoKu8EYDbImzD0cjpGSXMDtUtq1Xs5RpOomXTUu/1yPXdhWgGsdbhTZYNlqsPv78ZdgrlsIs5XfMkHvAGFkRlZEj9jE3EKGsqzBtgC8sL3cIGGAwo0ug6MRecSEnHRHt1ZAwKxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dlZ0D3uPJ8Li+tdjDdPmIc98pNQcO1XVPWTj8bralP4=; b=VrpuXv7nwxvnyp+Ij9CxrgMuq4q1SiAv8aV/ntjwnS/eU/Pga06jqGsOqiSBGhWwqVBU1UzMskMccsWh5E3dzs3+E2r5QftOLKpgTrIFCZPpmivH7Y5LkPQ7d7skhECUcKaAaGcK0W14NeVe1SarA3UkvY7d1dfr7l557dQzabg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by PAXPR04MB9373.eurprd04.prod.outlook.com (2603:10a6:102:2b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 12:13:26 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226%4]) with mapi id 15.20.6002.013; Tue, 17 Jan 2023 12:13:26 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 2/4] ASoC: SOF: Prepare set_stream_data_offset for compress API Date: Tue, 17 Jan 2023 14:13:05 +0200 Message-Id: <20230117121307.200183-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> References: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::9) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5151:EE_|PAXPR04MB9373:EE_ X-MS-Office365-Filtering-Correlation-Id: cc77ef84-71fe-4868-8541-08daf8843ca1 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a7oQ1tDNEsYp+RZEsjohKMbsx9yZ68mqos0uq90LUoOXxK7jNph60WhPwzejDfJFf5Q6q0frQT1VdRUa2EN+zFvXBnoeDMjrj9I1BUv1M6nAD3QlxbxNAuafSikVpBQQYz5Qu7QEB+3PlWkpvAwQNb8yZGf4aiGrEcGGHctuqiUtVFoAFFe6k18MicVFoYSI6rGfsBuj8Rxr59CKENjDC9YRfQhyRYkJ7Ue0Eb8x4XhsE6Q1WWsZxNNN/cfwQpgo0XfXf4ODNdsNFiTVJoLuKy97ZGbOA7j45Cjb3Cc08bFhI9TIA2SBLRdCVZlzMvcvinDDRKjaoqTNBc/r4kRSUIwKWqC10K3aipgvBeTa44X1OuKpwqalPFIY8LKLUO3jito/By5xpnwN3e6Dad7lzn+/WyiOCZZKcjjKkG9qZ9906AMyiTwk5wbfowlimf5YImW4/mCLL4V0QqHtyHfVq4WMqmAIl8jLSuFPE+ltHikxBYhYckXukIj/9r4AJQ2ZdspYlTKcyv5cUGI0T0v35MoICy3Q+S2VGyOWk4+OmTM4B0B2n8fiwCfqhV7opYK7L9lLRbrvNpgU/mrEMZzf9rPrAcfexn4YoUe/oj8f6seBtvX4HxDdmrQMmY185o8mWREm4AvLa0TD41446LxkdmkbicNZdgE1zzj9bXyTW0pUAGEeQ6VLTQdkDIi3VQiomz+Pqfm9eV2AmQVq3f4HRg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5151.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(366004)(346002)(451199015)(316002)(83380400001)(6916009)(8936002)(5660300002)(66556008)(66476007)(4326008)(41300700001)(66946007)(8676002)(2616005)(38350700002)(1076003)(38100700002)(86362001)(6512007)(6506007)(26005)(186003)(52116002)(6666004)(6486002)(478600001)(2906002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: phnO8zpZDzyvD/bu2wkSgFotzPsQFhz8s4ho1k67yiE3PBMcIB32Dqu/ASOtHoN3l4Q9xrpfF3SL2i1+y7yzF6yFZpoVQvgUbiZCyE3oz1t16yN8849Oii9aGjQxaLo3sNEqXnpSysNzujokZJNJopvINf+iyICTXTCSVotgBPyshnMPGW1jsNCIp8N7mcFQhITRDsIXoiBci44GGyLWpixactDBp5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40iQajhWHyCIg9K7nYGLcuEhObIjK/dopkR9Me/7YYhNn8bSRPsGK8bi76Q04UZabr8gqcUJ/POpqlSSGqnGYNWcpI6RiNO6ZGIHkvPwAXCY3heZKw/85ksWfd5jxhjbT+2zEXkiMx+xSq1JRQ+52KEhpXV8RIL+WLI/nzvueoAUWH26UC7+cqCMpO7YP0BVHKwtxyXYz10PTCRmdjNaoJL4DI7ok2gaoqZqG30JLrpiP0ZAuH0ecbJUFAsDRNPXGiu4lB7ALIJ3oPB3Jhb2J6ONjaXFdzzDZ7KQTKo+ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc77ef84-71fe-4868-8541-08daf8843ca1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 12:13:26.5123 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pSU2tHnSH8ANt3nHCrLHLm9+q02RaZZzqBbGshPlhAtObISUy30QOmHt3bE+cJQSFou3D5oMqAZh2CGNQmxpow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9373 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org, Allen-KH.Cheng@mediatek.com, AjitKumar.Pandey@amd.com, lgirdwood@gmail.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta Make second parameter of set_stream_data_offset generic in order to be used for both PCM and compress streams. Current patch doesn't introduce any functional change, just prepare the code for compress support. Reviewed-by: Paul Olaru Reviewed-by: Iuliana Prodan Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Daniel Baluta --- sound/soc/sof/amd/acp-ipc.c | 3 ++- sound/soc/sof/amd/acp.h | 2 +- sound/soc/sof/intel/hda-ipc.c | 3 ++- sound/soc/sof/intel/hda.h | 2 +- sound/soc/sof/ipc3-pcm.c | 3 ++- sound/soc/sof/ops.h | 4 ++-- sound/soc/sof/sof-priv.h | 4 ++-- sound/soc/sof/stream-ipc.c | 3 ++- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/sound/soc/sof/amd/acp-ipc.c b/sound/soc/sof/amd/acp-ipc.c index 1f614eff2a68..4e0c48a36159 100644 --- a/sound/soc/sof/amd/acp-ipc.c +++ b/sound/soc/sof/amd/acp-ipc.c @@ -222,9 +222,10 @@ int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sp EXPORT_SYMBOL_NS(acp_sof_ipc_msg_data, SND_SOC_SOF_AMD_COMMON); int acp_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset) { + struct snd_pcm_substream *substream = sps->substream; struct acp_dsp_stream *stream = substream->runtime->private_data; /* check for unaligned offset or overflow */ diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index d8cc2a92f1c0..39165ebf684b 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -215,7 +215,7 @@ irqreturn_t acp_sof_ipc_irq_thread(int irq, void *context); int acp_sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, void *p, size_t sz); int acp_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset); int acp_sof_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg); diff --git a/sound/soc/sof/intel/hda-ipc.c b/sound/soc/sof/intel/hda-ipc.c index 5705279d0707..d7e16e6b6f52 100644 --- a/sound/soc/sof/intel/hda-ipc.c +++ b/sound/soc/sof/intel/hda-ipc.c @@ -386,9 +386,10 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev, } int hda_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset) { + struct snd_pcm_substream *substream = sps->substream; struct hdac_stream *hstream = substream->runtime->private_data; struct sof_intel_hda_stream *hda_stream; diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h index e6f1ff591332..b3080b82ca25 100644 --- a/sound/soc/sof/intel/hda.h +++ b/sound/soc/sof/intel/hda.h @@ -659,7 +659,7 @@ int hda_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, void *p, size_t sz); int hda_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset); /* diff --git a/sound/soc/sof/ipc3-pcm.c b/sound/soc/sof/ipc3-pcm.c index f10bfc9bd5cb..b29d93e0d216 100644 --- a/sound/soc/sof/ipc3-pcm.c +++ b/sound/soc/sof/ipc3-pcm.c @@ -129,7 +129,8 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component, return ret; } - ret = snd_sof_set_stream_data_offset(sdev, substream, ipc_params_reply.posn_offset); + ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[substream->stream], + ipc_params_reply.posn_offset); if (ret < 0) { dev_err(component->dev, "%s: invalid stream data offset for PCM %d\n", __func__, spcm->pcm.pcm_id); diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index db92cd338467..febe318b9427 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -480,11 +480,11 @@ static inline int snd_sof_ipc_msg_data(struct snd_sof_dev *sdev, /* host side configuration of the stream's data offset in stream mailbox area */ static inline int snd_sof_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset) { if (sof_ops(sdev) && sof_ops(sdev)->set_stream_data_offset) - return sof_ops(sdev)->set_stream_data_offset(sdev, substream, + return sof_ops(sdev)->set_stream_data_offset(sdev, sps, posn_offset); return 0; diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 39b015c59168..95a6b301da49 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -254,7 +254,7 @@ struct snd_sof_dsp_ops { /* host side configuration of the stream's data offset in stream mailbox area */ int (*set_stream_data_offset)(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset); /* optional */ /* pre/post firmware run */ @@ -766,7 +766,7 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, void *p, size_t sz); int sof_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset); int sof_stream_pcm_open(struct snd_sof_dev *sdev, diff --git a/sound/soc/sof/stream-ipc.c b/sound/soc/sof/stream-ipc.c index 13e44501d442..872a49550672 100644 --- a/sound/soc/sof/stream-ipc.c +++ b/sound/soc/sof/stream-ipc.c @@ -48,9 +48,10 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev, EXPORT_SYMBOL(sof_ipc_msg_data); int sof_set_stream_data_offset(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, + struct snd_sof_pcm_stream *sps, size_t posn_offset) { + struct snd_pcm_substream *substream = sps->substream; struct sof_stream *stream = substream->runtime->private_data; /* check if offset is overflow or it is not aligned */ From patchwork Tue Jan 17 12:13:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 13104562 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D1DFAC3DA78 for ; Tue, 17 Jan 2023 12:15:15 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E5E7A63EC; Tue, 17 Jan 2023 13:14:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E5E7A63EC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673957714; bh=r6oCh/ir4X+5F1PQ3w3dI9znniEmwXNhV9hUfc5WL3k=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=nHDUbvyXdscvzk/BiBC57tButzRDpPG88uo+OR3lKnxHp0sdwCAayaVDbnxTCdBnZ 78RqZDsbjm7/mh4jWKfFNFXi42MDyYQcov8S19hbljtHXkK/TL8RL1WhGJTqiEeAQZ emOvdOdnrRZOh7M/dM8Aanwq22G0ln1sL5LQ22vo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BB8FAF80549; Tue, 17 Jan 2023 13:13:37 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3B9FF8053C; Tue, 17 Jan 2023 13:13:34 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) (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 44CB5F8026D for ; Tue, 17 Jan 2023 13:13:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 44CB5F8026D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=FB4QA8LI ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Dp7+2pfEmceQbbiv8OVk8ybL9JBjBo+Hx7GNMrOY0+olypBrd2rVGwmcbRyewOB3Yisa2Qqk/HXph6LHuwetmGnQ8o1rxf+Gyb4VQ3wPKOYjiHXMXwR/7vbQYmTmt2FNZzK3YxWnvvQ36ncTCA4KcUOAZSLmsHihbb1JUNo3DcYmj3R069G8sLDrJF05e/YVkQPN0B6JfGCZEr+Py3/KqdurT6LbAfSo8vN0XrrwhEvh3Qe+93pZVPjj8e387mNrNKmdSKdD+kKg0qSNx25/IawNpbsntVvdAns91wVraRR0vRud69fdb+AbcR432Lcqb/n+Agd/PWe70h3QSYk5WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oFBkJNu6zyKt1vYhb2aturuZ18OYnhjzeVueMXVKk/U=; b=gh/G8T5u5TFaK9xPgrkOhhSgzFtkFBDWpuQb9DH8g8dOF5PNyte4OiL2d+fz8J1Ip7WlzE8AU3LCg5oEJQqRQIgwM2T/QM2K+uqmsOpv17xybRslls/T+FxVsKmEUkStnuacFqCjCTjGxLDoDuXMk8TPZ3a9TTAbVtI9LnhT6m14C8MFupqwNCDzbUi29zDQM4RvtU+/HPL5t1dbq5Rob7IvDhBM7hXb9WN1f898zYmWFM2zoktDoNnhCYcjfE2RFMTHh48TypxoNfPF+HqbLninf2J/BPZAMJqxcuDEO1l2vzpxBtcg1LvYA8FikMhKILfiDs30unIBVGpRbaxKfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oFBkJNu6zyKt1vYhb2aturuZ18OYnhjzeVueMXVKk/U=; b=FB4QA8LIB2t604w5GIRQnq1XR2kwUFC2tyeyXDqni1P/d/lpql0fJvhZseNvpvBOU8t1G0XicYrs/1y2Sgg/YU0xTWx1QdMg4SlVmkQZgEpDxQSExpoNjfwGDni1Wst2St7n8pJBOmNZ0gsFRvjH846A85x/HVvH8ZvbqNu34GU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by PAXPR04MB9373.eurprd04.prod.outlook.com (2603:10a6:102:2b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 12:13:28 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226%4]) with mapi id 15.20.6002.013; Tue, 17 Jan 2023 12:13:27 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 3/4] ASoC: SOF: Add support for compress API for stream data/offset Date: Tue, 17 Jan 2023 14:13:06 +0200 Message-Id: <20230117121307.200183-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> References: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::9) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5151:EE_|PAXPR04MB9373:EE_ X-MS-Office365-Filtering-Correlation-Id: 54a05b0d-d761-4ef1-5297-08daf8843d54 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +a+ccYNEXahaB9jyq3RelcYnhwzCYcEtQPVUl7jRz5g2ML25kGaoNA3VYGvn5PvsJaxl4Jg399+7FzKB5atD0uOOr5hbHPefYN5zVX4Tk4BRfNXH3ZW8wacZCjUG/6mLJo7BiPAb5HCp30ff8mi+788ioI7ITNL1U6LjODNCEB2gJy4MWHdxFQ3k88AiDYEeu2VEV29yCn9iGZ8vzsiOgU3t6R0r8o4z5g2eTidEpIGrK6Ww7fyX0BE+s9S3lYvglwphVq7hMwZuy6ZO+PiAOyXgYKdsLL8Q4esn4bPJMv87M6WX4pHG0ZpHy6cFtuEOVS9mEBppvM1CxbJbt1CDOS5nCGIDIpy1Pd6nNnp2ZX3423itO1dV7jtjww41r1w+Jxs/+ML/do33G2uVHR2Ex/P0/AiWiOFlzXvrxS3wUZvL8XkdO4ey9lBqoJuSrAFSM7US+C0KMJaRNlAPB0lE/a/XLsX3ruS7z6HwAhBm08csZJrqspyTJZ9iMWFGMKpKtXyTOurZRidnk7T+AW7K/aw0Wmzjt7Hjpzoldg09wjCqaaIy9z5kkaXLkxoX2HFHK5uYC/JBFFbtyP1u/v06hIq3C3a2VudScJntPz+q3Mo2lDxWxYmiC3k6AZZvAZIqj4PjI0V6NjiQvrscyvXsS7O7w8vZezVerZb6I/sg8yxbnVShrlCvqlNO43LEh5z0eotkWPEDovFEub0S0Djr/Q== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5151.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(366004)(346002)(451199015)(316002)(83380400001)(6916009)(8936002)(5660300002)(66556008)(66476007)(4326008)(41300700001)(66946007)(8676002)(2616005)(38350700002)(1076003)(38100700002)(86362001)(6512007)(6506007)(26005)(186003)(52116002)(6666004)(6486002)(478600001)(66899015)(2906002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5fR3EuPll+8KAXwk5yT9xe5ck/GNUhqYvGU07pkr0G15p4sNt+O//mO5hYRrQQG5+85SyFybRpLrkSzNF2xk+aSntooGRs22d1FSAG6Qi4YOVIw3ERvMCW/aUIdQq2AClzFo4Cz5hJNQw/12vWvbiR30VDZmXVlalvP7iQvRmd+TZUIdMI/flgBFr0zqgnA62CgsInltYTy1GS7LW9ESv8FdY8XWxBD3TAGRBooO3b4VsQTG9g2Uq1cikhY7M1Ln6MZunHs7mYF/cNOrmN4ZfUHFi3z8nmm5SPr6kV48iyz20nn8yDGWASpne39rBFSrvTf9ou2wJDabeCJaXqElfTGR+d934tK0szOY9yOcRBAQzRVLFbzRojFqqpVvipeUW9i/UAxNH54jrVcxX3MlxT0NjSIHc45ffntyEjqkFmUtWMoUmZ7X9yEa8yzluza99ATYsVmyEoxeS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f5/n1S0Bd/GG00rmDeFjrqMlhIRTvJW6rBzR685Z1Q1+GHgrvYMUukoCUQyaDnj3mi1 X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 54a05b0d-d761-4ef1-5297-08daf8843d54 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 12:13:27.6841 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jhLUU7XHVpP7fCMaopXXK2lN8DC0Dta4sTFrX/hxeJysbkwcB2tNecHa0MnSw0Kw+AZMAfZx9xmfAkCDW5xYDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9373 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org, Allen-KH.Cheng@mediatek.com, AjitKumar.Pandey@amd.com, lgirdwood@gmail.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta snd_sof_pcm_stream keeps information about both PCM (snd_pcm_substream) and Compress (snd_compr_stream) streams. When PCM substream pointer is NULL this means we are dealing with a compress stream. Reviewed-by: Paul Olaru Reviewed-by: Iuliana Prodan Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Daniel Baluta --- sound/soc/sof/sof-priv.h | 1 + sound/soc/sof/stream-ipc.c | 48 ++++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 95a6b301da49..86fc5c6a9c39 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -115,6 +115,7 @@ struct sof_compr_stream { u32 sampling_rate; u16 channels; u16 sample_container_bytes; + size_t posn_offset; }; struct snd_sof_dev; diff --git a/sound/soc/sof/stream-ipc.c b/sound/soc/sof/stream-ipc.c index 872a49550672..216b454f6b94 100644 --- a/sound/soc/sof/stream-ipc.c +++ b/sound/soc/sof/stream-ipc.c @@ -33,14 +33,27 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev, if (!sps || !sdev->stream_box.size) { snd_sof_dsp_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); } else { - struct snd_pcm_substream *substream = sps->substream; - struct sof_stream *stream = substream->runtime->private_data; + size_t posn_offset; - /* The stream might already be closed */ - if (!stream) - return -ESTRPIPE; + if (sps->substream) { + struct sof_stream *stream = sps->substream->runtime->private_data; - snd_sof_dsp_mailbox_read(sdev, stream->posn_offset, p, sz); + /* The stream might already be closed */ + if (!stream) + return -ESTRPIPE; + + posn_offset = stream->posn_offset; + } else { + + struct sof_compr_stream *sstream = sps->cstream->runtime->private_data; + + if (!sstream) + return -ESTRPIPE; + + posn_offset = sstream->posn_offset; + } + + snd_sof_dsp_mailbox_read(sdev, posn_offset, p, sz); } return 0; @@ -51,18 +64,29 @@ int sof_set_stream_data_offset(struct snd_sof_dev *sdev, struct snd_sof_pcm_stream *sps, size_t posn_offset) { - struct snd_pcm_substream *substream = sps->substream; - struct sof_stream *stream = substream->runtime->private_data; - /* check if offset is overflow or it is not aligned */ if (posn_offset > sdev->stream_box.size || posn_offset % sizeof(struct sof_ipc_stream_posn) != 0) return -EINVAL; - stream->posn_offset = sdev->stream_box.offset + posn_offset; + posn_offset += sdev->stream_box.offset; + + if (sps->substream) { + struct sof_stream *stream = sps->substream->runtime->private_data; + + stream->posn_offset = posn_offset; + dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is %zu", + sps->substream->stream, posn_offset); + } else if (sps->cstream) { + struct sof_compr_stream *sstream = sps->cstream->runtime->private_data; - dev_dbg(sdev->dev, "pcm: stream dir %d, posn mailbox offset is %zu", - substream->stream, stream->posn_offset); + sstream->posn_offset = posn_offset; + dev_dbg(sdev->dev, "compr: stream dir %d, posn mailbox offset is %zu", + sps->cstream->direction, posn_offset); + } else { + dev_err(sdev->dev, "No stream opened"); + return -EINVAL; + } return 0; } From patchwork Tue Jan 17 12:13:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 13104563 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id BB5DDC63797 for ; Tue, 17 Jan 2023 12:15:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EDD0D65A3; Tue, 17 Jan 2023 13:14:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EDD0D65A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673957719; bh=e3YiIqDNbBLO03V++UckrLt7B+BfRoBiVjs5zE8n/Aw=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=g2HAURQwvH5iukpPcR3HbCiYTfuQK/NHqIeaSKbS0QQU5bbz9lPOZMpizoAx4aBLX 5inNe0hafzEBfsBX1SfVAVibQGGqKaLYkF6NIJo9M2aFJ+dCLj8MwHMd/bRPO4ujMQ m+wWjVWf+hwFr3aApgm+4VNbCZBJIMktbWCxJW9Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 51DDEF80557; Tue, 17 Jan 2023 13:13:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D3262F80542; Tue, 17 Jan 2023 13:13:35 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) (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 7FB96F804F2 for ; Tue, 17 Jan 2023 13:13:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7FB96F804F2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-NXP1-onmicrosoft-com header.b=M7RSvmXd ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KSc4ihnfbI/l1u9fzq2cTrEI0vi4Ro6NWNk5qFDrv8fOFj688D04XIogHNH9vQ2iL/bUbSJpPNJOzKHAGEwpCpalGppg9cTiD98+kSM2umNAULXqcOhb91Heh7LO7nfrCF/l5izL5ur9HSXp1Bo1ZCrlNq8l1WflRQW8+AeI+kXQ/NB29qg7JlKX3gMG3yGnKjqAc2+pbnMH0CtA7jf0cXy2R+KvsCnsbVuBf7f5Yb+0oZMGNGn6moAR7ZB9S3PqaDAc7caqiW8kXyijTpJNCfT6Kpp5LvZ35tTog8TPzHM+Migi5TRLccQSk9emjo+U3x1z+UhrC1ZJXE0tsRIrhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7gpTCKh3Rvhd6Nd1QsnAm9CASys8tE8d6PdvqhMfvlo=; b=WmpSiO1A4N7n+37kssoLYpCpszVcxyManahclOEcx1mJvrqrLXb3tV0eLhmw5Y/ovo1l2FOL5CodiscsK3xd3lz6kbo3wabPJe2sXLqdfuk+qqA4pDw0zr9YU35wm/Xw46vd1PrK/GSNliCU9pLktCQ7tT/sHPBpT+Rn6FL7D8EwQlAFi/pTzKhD3CqVD18Q8gpVJyj6++jS2Q9kSMPfSUKNXGXair14/hcLAPzAohik73YS2pPl4IyLoRUodKsrGCBpGaBAIpyex/uV3fZib2hzJtFXmi3s0PK0fhZs/s3JzZojJ0M1LSqgb1RW9PGM3VGhaNOzTVTGN54Igl7CBg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7gpTCKh3Rvhd6Nd1QsnAm9CASys8tE8d6PdvqhMfvlo=; b=M7RSvmXdzR82e0yXzESzmlkH9T16AuEsIN8ljNih/BYohSooLrlyx8P4P+opgvtpxUD6LDo3mVEsZ64CzWjtgNldQMK2fKQ+aI7qtde5r90ojgRLB7BbVft+kz3+t7OlHFx4dMFYfDUUcNbNnApw76V6GOZSwVO989adtCxtfpM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by PAXPR04MB9373.eurprd04.prod.outlook.com (2603:10a6:102:2b5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 12:13:28 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::b6f0:fe1d:5509:c226%4]) with mapi id 15.20.6002.013; Tue, 17 Jan 2023 12:13:28 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 4/4] ASoC: SOF: compress: Set compress data offset Date: Tue, 17 Jan 2023 14:13:07 +0200 Message-Id: <20230117121307.200183-5-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> References: <20230117121307.200183-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AS4P189CA0040.EURP189.PROD.OUTLOOK.COM (2603:10a6:20b:5dd::9) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5151:EE_|PAXPR04MB9373:EE_ X-MS-Office365-Filtering-Correlation-Id: 98805bfa-fd45-4857-5b36-08daf8843e02 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KyDLMyXFoMEQEJj6h6hOkY1JspqaEaZukcHtAPlnbi7HuSJ1sMQ9/NZGk3fdf+wdgmrEX3kv0q+tMqhXEyfeIFxNwiAmTFyIG9YEP8NHlYyuQiiPvFONJpwS6NHwMSMvmSiaunKWjrGi0IN4B5gpM0ylI1CizGX2MSrMpZQg5p5Oe79660gmt9qowrvZkmpDmH3I3rTj5zmR6I4V/NFiQqtcpUKIyqsQpsOoqBvP58grX1IKfVP0GYfk2yM7QWlY+ptSqqGai14SRET+MO0jySnhWcpemSaIeKcHut7edBxZTzrd5ZvteeNhJEbLBaUB7nWJJvNEYZq1jYlCJJ3pADH/cu7+ocjtMePqj2UYVwncW2o/mYpwprbYWsG4hESV4upN2ipMSzRFr9L5jjjMevR6glYyQUhwW4XkjhWJYYkuQsS+IVEljR42/qVjf5DYwTYeCHX5fap4fy91BNIjw3crDAdJvHa7Y+A+xrEKe4Xzh8kgGojwFw1kM21zyrOQA/Ck46O7TQqhf0o/QimnDzD0P56Z3/UWPl3IJq12mt1GLzPqF1uFpuvV2AT7t2or57m+GxLYwCpNIL11qAutqAfldUCE5Ng81xs/0J9nCpDO6JJBFunHQLqYRnjw/pBZvqmhV/lfb8ql1p/2CFWGx0RphTynt7wp3xectbtFqWqHP56E6aoIjh0DaU1F8vbIgfQiW42e6hFxXQrHqZxGlA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5151.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(366004)(346002)(451199015)(316002)(6916009)(8936002)(5660300002)(66556008)(66476007)(4326008)(41300700001)(66946007)(8676002)(2616005)(38350700002)(1076003)(38100700002)(86362001)(6512007)(6506007)(26005)(186003)(52116002)(6666004)(6486002)(478600001)(2906002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6kMuhlCWZliV0pu16K6Sk2TV6acbX0A0kmf1+O0qEFaJZyhynFKQkGlYbKuPHMelidiP+GPpPhHc6sWXFLOkB5xyEZw6FsrediyH/zJdS5OrDLUSBz2VUfJD82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YhR5FPh4q1zmjFlb6/smTh7N+MzmqVAhusG1x9Nd682DjueUmrtd9l26V3gHPYtOr+j51eGp5g8ZiLY3nZiV1eG2c2VKff0FtXmB6Xe2Rhc3w39ka9R2qkscmkEgyTQN2wQRiHNepmC6/HNVZmMNa3QPpRhSBbsw7XshaLcGJy/iCclBEc0CMnwnkhTP4aQBYi174WO+UCOnlbva7/XsHnkd5Fxx/7IsSuZheHVvBTWiwNruLFJ5hp50h4JYfPk7YFQO34oYNIqipqV8zKPAVh7Ig9kEjDzJILCQrWL4OORXcdYmfaH/lOJPVAgD/YxXjsgnrlqIw82PVI7ZJoUk+1BKVLjLsEEZaM5quaI+R775APzGt88O8CyfxLiYDYDU3gs66iEp/gJ X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 98805bfa-fd45-4857-5b36-08daf8843e02 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 12:13:28.8090 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4x0IKCyn57n/JsyB8O3vQhxSEPtSNEhef5f5nlBzHA0yrGApqkedU4Dn8aBC+6aoj7sVF8gct8H5u+yN6Sr+5w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9373 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org, Allen-KH.Cheng@mediatek.com, AjitKumar.Pandey@amd.com, lgirdwood@gmail.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, angelogioacchino.delregno@collabora.com Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta Because now snd_sof_set_stream_data_offset has compress support we use it to set posn_offset for compress stream. Reviewed-by: Paul Olaru Reviewed-by: Iuliana Prodan Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Signed-off-by: Daniel Baluta --- sound/soc/sof/compress.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index 8e1a9ba111ad..8d205eb16d2f 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -10,6 +10,7 @@ #include "sof-audio.h" #include "sof-priv.h" #include "sof-utils.h" +#include "ops.h" static void sof_set_transferred_bytes(struct sof_compr_stream *sstream, u64 host_pos, u64 buffer_size) @@ -237,6 +238,14 @@ static int sof_compr_set_params(struct snd_soc_component *component, goto out; } + ret = snd_sof_set_stream_data_offset(sdev, &spcm->stream[cstream->direction], + ipc_params_reply.posn_offset); + if (ret < 0) { + dev_err(component->dev, "Invalid stream data offset for Compr %d\n", + spcm->pcm.pcm_id); + goto out; + } + sstream->sampling_rate = params->codec.sample_rate; sstream->channels = params->codec.ch_out; sstream->sample_container_bytes = pcm->params.sample_container_bytes;