From patchwork Tue Jan 17 12:25:30 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: 13104585 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 830ADC677F1 for ; Tue, 17 Jan 2023 12:27:22 +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 2AEA6674A; Tue, 17 Jan 2023 13:26:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2AEA6674A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673958440; bh=qG2JN10RLEnwggy6bj1Hh3Cv/1h2LjpfGQha5cO/EYc=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=p4tVc/+xkwtCN3RuICPfA0r07Czo/CGiTH3+//6uWwZy+DBSVdxXL7nK3FBLfnhIX kdgFOBzwqW1ehFPqRrpfMtweqvwaGAFmuseEUNZXmaUl8FvOTdRD5XMizrKFnn3Hp6 7nb/Z8QIrkiQtQSX+ryYS1hsIJk5aMTwiC2y7hRE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 73A9CF804EC; Tue, 17 Jan 2023 13:26:04 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46958F8047B; Tue, 17 Jan 2023 13:26:02 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) (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 23012F8023A for ; Tue, 17 Jan 2023 13:26:00 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 23012F8023A 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=CaM1EM01 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IBvTnQ4+PsR3ypRbBL8aemhp5w5fm403xwDudOWW/ulMA58QF4O/c+6P8xjWdPatP1fS3M0XMRetdxlPb23LLS5NuJnoptog6Vsh5RJYji2oZGf5eB3EUHQIoJgRGncxw8O8ejXZJxmAV5Pv2gKIxJ0WbQB7kzwEeC0fWC8hwc4UltBtAZ+YX80+wFULP/NWzYtOggDKHiPqka3YB9sBj7wKhQhuwGeKwx3rOwkFuln8cMQYHFHOBSDdfi5Ko27T9F/vYG+pTamzUvelKODptEmyPzGKVWcx2ZE2xWUoVFKcuuwAtXiMCEB936cnyba3e57qwkuFwJlRJoxbwHXRhg== 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=QIdISJzJISIW9gtCXwZ1cLhWL7FhAW7+e+xBRH/6suo=; b=HchXhmCK3juKnGzjkzLul2FeljnLWp3CCC+TBW1qLg+dYYPYTlS8lrfpav96tHj40s4gpCfjJSKYLtftK2dLod7MxbhvNaaF8KCcxV/wpzX3/cE/LEJKxT0fajgGsZkToI5EJqVK9sAmuNo+F2rTZJXVY8EhUqRn28Q0l0aTHHd5hsujBOCSlJdLTYzrFzxJNHRxNnYjEy2Z/wsoAExaYqIErM+yfJnrIL04Zthc6l+5FDG6pIwbz3OabBlK7h/+PU5RAxt0/eDvj3PHMsZ9q/VV0HB2R7G0hco4y0r1/IY3iarZo7bNoTsCpnD1RX95da0g3dGG4hzBAab6zzRESQ== 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=QIdISJzJISIW9gtCXwZ1cLhWL7FhAW7+e+xBRH/6suo=; b=CaM1EM01XDECaa1iN5lxDP4obiEq3uZRQ+yHMF+e9Lqwu8stk824raBvi6HGXakNin9IFiT9rTeO3G1X1wcuB4VtnI+RnoiiXaeLOOb3yhN/bHOdFREITvMWG+oZOuXhIcE/xc3MqyQJKEph2Bbc3y5mh5zS8qLT+V5tzgsgV+Y= 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 PAXPR04MB9595.eurprd04.prod.outlook.com (2603:10a6:102:23d::10) 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:25:56 +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:25:56 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 1/4 v2] ASoC: SOF: Prepare ipc_msg_data to be used with compress API Date: Tue, 17 Jan 2023 14:25:30 +0200 Message-Id: <20230117122533.201708-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> References: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0133.eurprd02.prod.outlook.com (2603:10a6:20b:28c::30) 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_|PAXPR04MB9595:EE_ X-MS-Office365-Filtering-Correlation-Id: f9ab3806-f304-44de-aa0f-08daf885fbae 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: 7cdRGirdoCuE2sr6DL1mSh+Hat8/7Ji3HqaZ8jo7wHPhyYwBxW8+djDxAmjKyP1Vvjl8qNmiXQUCqwiWNKX31wznt/lE/R+cSwdhpU3s6GzoVN7YFml5mK5p/CvlygqA+T5SsdBNFQR1zSGRUE9YIKulV9SUxJEwU4oVocQwXNU52eTyJ9Ikn3+DL0l5PTwWxmGoWGe/AEIErZCasT4noN10L8gCPOzrX4CWIC5WnO054S2uAtjamqAehSgZ3vb1qojDViJcBxYL645lSw8YE0cjqTZKPOyHZ3leGT1jqApEb3RSiTi+GzF2FNzfMMvJu+mU7iTyM8xmUKLnren4tMTUf8HMLYfA2DQgFjzXScWbeX/xLry96CmbEabWKGiqalpe0+uFZL9PugCxbOSFQie0eCJxermXnsu2qOAYZByJYnH6v/C21N8w52JlLMBnLt/PKsz6JHVlNrH1DWCEhTcXnPt4kCwgyXNNTRxba7mzM/JG3KmHw13e9UNPEb78mwUhZBGJc53rHUCnqotchVpnbnAEMvLaWpx1YMUUXnL5QlG60a90jK6G825k7ZlXQeJ7kUObNEoM2Zvkp/pqUX0EQXgU29zm8uUdD7tvg5oPzyIC/bI4FCaap+YNJrnQvYD7V6oCC35pdanIimWu/5h7e0oHz1ckSUiDm7mjKCxrctCunSM+6L/w3phCjP9KBiQhCtHms5Un3ri4vc1N4A== 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)(376002)(39860400002)(396003)(366004)(136003)(346002)(451199015)(66476007)(66946007)(66556008)(41300700001)(2616005)(8676002)(6512007)(26005)(6916009)(186003)(4326008)(86362001)(5660300002)(83380400001)(38350700002)(8936002)(6666004)(478600001)(38100700002)(52116002)(316002)(1076003)(6506007)(2906002)(7416002)(6486002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3A3P1EMdgfuPCTDUb40nsmvOL8vc5NI7eJMvlWVlsLgJtiGGdwXfS61GdBGiKDIpE7JpGOLUPMVGRN1mF2Lcmq1c+iIbEUvEsSwkZBR2ohu3CEDEH52LaBR1bdUFu+7n3GjnTpch1+9H87kPmt3g9B9VUb1opfGQ5yXUEm1iOBBbol8kxwylhNLnFRK+2YCTtLSr3Sf1dWuD4JtAVtzvD4ygxNEz4glP0Yki9iK3HAII93EVogpk0vHNoCeuV3OoWhfKO5C1dFG0gIbNGOGAQnq/Vc22mSSR5/yy7a9IymZ8S/RAs5aXTr785cBRIoVNy+dsNu65pYK5uPL+D+XcM46+YlvYXQvIwURjxW5IqCC0PYs50mQ+LvcQ94qfKfWd1cw8xtwaa6jZzfhk8qM3/hPa7iQcTPKFOdi1MpWyvE4kjl+4obKVpz8Zlo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E9ab9xG8fXh+VjES/bZ4GXXrbHuQd91Z9y/mpA6wvkqaJ1bP1eRA6ZJwXttvutdrwVX+65b X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9ab3806-f304-44de-aa0f-08daf885fbae 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:25:56.5400 (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: +L6DRGiIkHvUA4Jeh6WHYdB/V+hAKSrtvO5hKWPQe8gaL7cXYH1Qf9tH7j7JBhLRKrB4+IOf+VkF7BMXyKzTuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9595 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.come, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, peter.ujfalusi@linux.intel.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: Peter Ujfalusi 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:25:31 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: 13104586 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 53F7DC3DA78 for ; Tue, 17 Jan 2023 12:27:46 +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 DC6B06744; Tue, 17 Jan 2023 13:26:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DC6B06744 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673958463; bh=mtAo8zPws0VRYXGcw5BzRlqT7CP7e7Rl/41P5tk/IuU=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=CwdmNh638JY2jA/cWEkmxpRQvFLeJ5CUJ0fzC00cXmPcWFr+U2h4Tr5F40fFN6RHm yfkgEP3hZF+7nVcdaF6xu7dWmp3oXnBq8fl5zjoipzy/ey3NFC8r5huQvXdsFRmSie 2pg9bf0/YoD6qoMM17iMYvDeLW6sc8zPfrQKyF18= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1CB8EF8053C; Tue, 17 Jan 2023 13:26:05 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5A976F804F2; Tue, 17 Jan 2023 13:26:03 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) (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 64792F8023A for ; Tue, 17 Jan 2023 13:26:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 64792F8023A 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=Troqtwje ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVOcq+ACgHSoax6I7M0CXipWHiwybVrcgxr2IQ2KGJS1YWtQ95fiyk0UaZh28y9KATWe59wqbaXtf92JkJAw9L/qPiBuhJiprTpknsvBlFBZH8Tu+GOMhMjr1II2EEYAFUtPw7VT93UE7lPP8KyM/opp0EiWvMWpN9Z7+TY2EgPiHgo711KtZ392RkKvMPxmRORc1UvVsL8lL29mq8KbcZDZOhXdR9ITOacyBck9IN8iJ3/XYk5o5aT3/uCb8dyXJG3p5vF8rR2F7yE5jdyzZ3NDK/M2w2ll0Y+0OMHO0Aq/Og7UyImAdEPYySp8Sp+E+5JFA2t6fvXDck8HFXJEbg== 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=ZbFi+clgmN5VEedYv5rxv9lAICVnTHXqz/VvbTofA2c=; b=NZqeA4Hb4GC9uyJw3EuykaIN3UGHahGz2/gppLEuOswr3ZtaB3wBEhjFclLlAxGnvx403R5AKjURJ6aOZb1RctjCFsB/giC5VCqWzVcXuGgQEQ3bdKhKwnmCz5ayc9FEXWd+qu8d3UoBVInLjzADpObOmm0KeRN+zdWOaCpPjfpBF8cu4ZIxKi2YEzSlb/ZTlUD/uYW3ROMDbPtr4D0cYmb2U2wNaK6qNXVREle3Mdsa9vX4B/CPznNvyWC6V3NAlNVU+q099jHEChYcwQ+Y3mCdEN12u4ao8P6/XTaRbWarmbocky8+hIwlVnP6GHY/2cQQZ/7y1Ce5bIsNgIuyAg== 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=ZbFi+clgmN5VEedYv5rxv9lAICVnTHXqz/VvbTofA2c=; b=TroqtwjeMyfowVyo6c1VE7rcvp30bfLOQ3gD2yh66rBgIE55ejUKR+l1yfAOLpZIwIQVJHlpD05fbfGIY3hhFKwSzB8/7uDVKd0GXpoE1p9mjjIZq/9nwONH5/wmiETXTkk3BdnMisXy8p3XEnVWChQOyt9zH3nt4toyBe0zPmc= 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 PAXPR04MB9595.eurprd04.prod.outlook.com (2603:10a6:102:23d::10) 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:25:58 +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:25:57 +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:25:31 +0200 Message-Id: <20230117122533.201708-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> References: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0133.eurprd02.prod.outlook.com (2603:10a6:20b:28c::30) 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_|PAXPR04MB9595:EE_ X-MS-Office365-Filtering-Correlation-Id: 767bf056-7076-42de-ec2c-08daf885fc76 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: 8rEBx4SIev70PSElexcwckBzePKwC/xuThKxi/QBIrIBBG6CfwYTpoeGRTJAp6TBwcphwyuNhouy9BVb2c/IpgMR2l4rrpFaj2YD7e1eoqv+hbUI1ED9vfzyCEpa/kR4OhAuLQ6umTRF2c4/nvonppAMfVGiJhbZ6/lLb/RWcFscxbqmZMMu0BM5kJCN9R8I4egJ1+yykUw4delBnODlK+GteMimQkaXTkWvEq5jQgF5PcHzt55Z/9AhIY2xMggj007R0AomcXNnnSM3KxGslxt0/pT+4Hx+T1eyUBoMQhqmnTJVtuS5f8IXb+gMoBz4QapljsnvMlG7HK6r/7VHz01oKkWQNUVSCO4ORDmBHkp27Cy5rM4mqR234Fx5Q/n/c7RtAkeDbOZOHOutItVYSqgjG9Wa16nf5e6VRdFSho9yi/n5HFY+uUtwYsDFLZPqye3B8kyuwJxuVwDXNhBl1qEdp7TjaP98H+3c4GzSfy9D4IV4XKr6IyldJJC//HiWl8kcSrm2sRGOk/qJmG1AYcx8dPRy/z63loRoNsRcpT0/oAYJA/ma/yuAebxJjN0CSSKbK6D1Lwj0Jio0SzV8BEZs8TtfzRqiqp+1bu2J8P4d9D/wYI+YwV7+JohaX/QYGuau4TYGYoPk+hkBHxW1uMbBmmXiuOnSIfff0tNNUghl+UwsYwKVdxHAQ44tmJYHmyMG/iWpxNol6GLpPdUJTg== 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)(376002)(39860400002)(396003)(366004)(136003)(346002)(451199015)(66476007)(66946007)(66556008)(41300700001)(2616005)(8676002)(6512007)(26005)(6916009)(186003)(4326008)(86362001)(5660300002)(83380400001)(38350700002)(8936002)(6666004)(478600001)(38100700002)(52116002)(316002)(1076003)(6506007)(2906002)(7416002)(6486002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zIXFmXEKR1YsgaFLThjqqKmcRNohhBWO+WuFpn5kv5+p0/3yz3a9++DArIxfgZCce/HvtHMDkzjuopYOU2x9DteSKGS15ASIWoguu0OYNAB5FAJuzfKsIljMGrYv9quI902Ba4GHOcVKyyT/0CnVwpuM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Ci2aNKFQPiA+wer1obAJ+ZyZ4SFTZjd2GWE2PJbMFiw8Z+SXfZYV4a2imbM94Cmd0QCIKuccaOIWXRzEHUQscqdI1/CP40wLm7xICQza05oDOLkCQbOZCFrrMBsnosOHBcJ1Y6U4w5F8nDe46zAjpALnq4av2HDDUNy/TgEVOIoJypEmktkBA4An1F2XmrJaUorjhlNb3FutpPno15DLwkoitwfoz4gbMguyCmBNTM5P80Em+fn2zlpmKCxMGpxwU/ZicZOnesvo0mbL0eIDoI0KKcJfeK2mxweUFFqzhJC+/y4sPyaJZVpNVmlPf0qQKlNUmS5oYLbT7kOld7y4bazaMF2s5pbi0Bc9D2fgLMEdvVyGNG+Xq X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 767bf056-7076-42de-ec2c-08daf885fc76 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:25:57.8368 (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: 4WWyIEomHEwzfjF/Yb9y7Xi1qYIf+kjSFZ2wQFBpNDY70wqFIZ9yO/CGC4dh9nvhqLEmO5UNibKuJW7O0mOgWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9595 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.come, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, peter.ujfalusi@linux.intel.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: Peter Ujfalusi 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:25:32 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: 13104587 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 9D3DBC63797 for ; Tue, 17 Jan 2023 12:27:55 +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 9133E675B; Tue, 17 Jan 2023 13:27:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9133E675B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673958473; bh=AAbnl1gaYGy2y7P/BLlmQYUv185c26p9WsNTxQEGc+o=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=bFwJPAaE4nxTqsojHSwK1fBe/YxlDs+8aKK5HmEfXVjtyVrSyz9bVKBymKbQCzQB5 tqiv11Sbm7Pm603uVjE9rPKFqS8jkq9sdKGtjjeykmMU+Fjqt16ExhOSwkFgUsNYZQ 72I/aSkuQPFxp60/7ngj2e8bqGU15elhooPfAZYM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5F2DAF80557; Tue, 17 Jan 2023 13:26:08 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 61BD2F804F2; Tue, 17 Jan 2023 13:26:04 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2080.outbound.protection.outlook.com [40.107.21.80]) (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 8D564F8023A for ; Tue, 17 Jan 2023 13:26:02 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8D564F8023A 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=YuEkmi4u ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkPTWzt1RiO8q9TwEUfIfZtIbaxcdN3TLIrdnQG1A3BwU1/yssI54DENHZFA4StAYO9x6/Aiow9qfo0ex53JEqQ5YMt/xR9xX82NExlipoaH8wHIpTM9taIaigwr2qrLi8ToLunDFlaefIwE5BsQZqVQDqHhYAGCobBJKE1INWzgqyZFBPAyEsEhOJM86sY4Zq5KRmUscFmz/AgVCSriXi4PWxzHWpwz9b/2kH5ZsvBm6HwctBBwrPt5T49k0/AWhPK2q2vvATU+Sa1UxuqncIDsKm64N1PQ04tsany2sE0l5gcJgvrm9INfmxzxWY08rem23N65/2V1FtTqvRdJeQ== 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=KbHPp/rS6lumPMircyV/HG3lpj1fQNhESmcV4QqpE0A=; b=fxLwK91HJmQhvfRIyygN+w8+LlnxZrqOGDTHUV7vgTNNUbtUAUQsU7f8Ssa7/N+sZD3f4PDk5hOPhJ6P7uRwFIIB8VC1+QU8fBgM9Br13zb5FLvpabalwexF8RIDAZIbgcle+zjhtR1FPw7XzNntyjVqOPVTAVBUt6Nr+M349WQgwCkIk4n8jgDkv74/qrs+WFrzUW/YMcXkm54bstQNbLrXx5i5yPi1GDCtFH1Gi3ir9ioJhu0ZLl6hjumflTPgBM/tY5Yzrtep9bYLDu34r5cgKjJ7PCvBNT50uo8qrKMHj16pRN6tYNwk2H0G8f3jjlcIEoz12KCB50TtBhqAJA== 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=KbHPp/rS6lumPMircyV/HG3lpj1fQNhESmcV4QqpE0A=; b=YuEkmi4u4PiSaCAv4uK7myNpi8oDyG1V4o5CIuymn0VfsasqY8SUm/qnGSXO6CyU01/MAx+LEnrC/fp4rsUvN3bZWip0TvDjCp6/zplmNQI/tpQ4g+TK1VKa7m8LArO816vAQQ4N06wP2k+DKFZYlbTt4YMJTzi+pL3VVyzAFhU= 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 PAXPR04MB9595.eurprd04.prod.outlook.com (2603:10a6:102:23d::10) 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:25:59 +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:25:59 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 3/4 v2] ASoC: SOF: Add support for compress API for stream data/offset Date: Tue, 17 Jan 2023 14:25:32 +0200 Message-Id: <20230117122533.201708-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> References: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0133.eurprd02.prod.outlook.com (2603:10a6:20b:28c::30) 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_|PAXPR04MB9595:EE_ X-MS-Office365-Filtering-Correlation-Id: 5450cc9f-06e5-4c66-cbf3-08daf885fd3c 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: HGaPfgDrKdJA9swBHB2WAPO7pB6MNzW11GxRTTtM3TWDjbVxpW/N+O09PdrrSXD+JECnKKYrCKT7K+nq2+oOfVO5rCIYzmxQeTw4TINc1puktrxsV81IdMZ1tAeWsAEgDqQkXnLCtsTrmwjh/G12N7llik6gV7AJ+/Aw5BdU/vkG1lUFnRzUysK3NU57pugFl4F01h7jp6iJwOXwSFICZzLPiI1ceei2Srk27RPIHyQYJzdIk8GjfOkEJNDvdUYc4Nk9Gzl4Us+AwnzN9Vrv3fELZcwV7OQFpuagKZs3DVMP8SjDdHkPJTzN/KQguO+1xm4PI4VqgoWkG+2+0QjuxUfTF1tqxbqzDQYRUfUXn/D4/jZyKdbh0K31XHubpEA9EjjXZnHZEozPgJfXyVZnW9NoL859oBSMGqz3vEFTrf+bhtRxadiPJ+IxJoTZRZcRF/M5hpt1BaU4WCpR7/cUmGH47xHrr61ppz5AFhtdB7TWv0qmXqDG3XIqIgelVmLXfIN3Z83Qe1In964mXQX5g4uHHpBmQbKvzX5LvxAj2JL5dH9jMmCCb+f8sGoVI9hlKiRaF+ddSruBTt4ZGk1gsGOTqU3mHwqfrmhugEFcMa+C77Tn13Yayw9uxEmzhwIE2Q6x3iOD5kZzTJrSTmOkD328WAYBXnPNZ62nTYMzGEf/CzEiv//pHJKI6iX6DeVM0sootClcSAH+5vrMEx4zgA== 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)(376002)(39860400002)(396003)(366004)(136003)(346002)(451199015)(66899015)(66476007)(66946007)(66556008)(41300700001)(2616005)(8676002)(6512007)(26005)(6916009)(186003)(4326008)(86362001)(5660300002)(83380400001)(38350700002)(8936002)(6666004)(478600001)(38100700002)(52116002)(316002)(1076003)(6506007)(2906002)(7416002)(6486002)(44832011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JyG5+TtMlDw0lFEz3bRRL3n/LGEdOIeR2yk15v/o7ATQhAz7GTGkXEHdvjcZZKrciDzIxqRMFdS4O/tq9ExHY6BJgu1DaFBYHUH6ikswZgaOxW5lkB1lJ50Q41fuFtMbl7PUdJaa3nRhIQCfVsDHpl7UNY0vI6U03zk8suAVjynSHdLergoFpsU6dfs7v/auIoQwWpioyWP28fi3SaXfyvPeaVHK6yvDWISEUQK1V4/wPRVLzXnvN6MdcjitKgCEvqEC1qO53v2++WjK5vAo1XI80HNSJN3qWswPLlKFhPiqO1ZUDF1J1d2v7RLaKHkSkZS1pag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DKDe0p/dI3S4mUxCz+NGaYqmgmuUvf0x0NwjpngP19na68x+e7x8eRN9Tt5dwesgNB2Ipy8l5dE2KfA6qsCpXUd7dgcsH+5hCvUW6iSyJIaIFphQbeTJKmxmm+lVpYf2obwTp0nZHs8Q33rLUTlHqXPEEZm6fIu7/ie5f+H54uJXjL+fHCy06w3RY3mSYY3Dx3c X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5450cc9f-06e5-4c66-cbf3-08daf885fd3c 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:25:59.1492 (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: 3fqpaj1QtNP+wdTbcw24FjzHRnXcmI+Ki8/AN00cYxYuEChSngyJ/5fACWr5/1v3cSNnSbazX+Sb2K6oHxpyPw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9595 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.come, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, peter.ujfalusi@linux.intel.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: Peter Ujfalusi 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:25:33 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: 13104588 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 4B296C3DA78 for ; Tue, 17 Jan 2023 12:28:08 +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 3B2C76765; Tue, 17 Jan 2023 13:27:16 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3B2C76765 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1673958486; bh=fZJdJcp3X0Dh9qSD3/iS5OnHpcKSxcOE2IHgLPdt+dY=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=sr2V6QzyiJHy53MOpWmmlHaE8iH5D21Te1ZEuElErg8+/DMCFbjYVYLg5zUqJm6qF h5pCUDxCaS9BlVXupf9evvgVuQA3xnKjryyhhaCgHX64HlSo6FyLEXYpDUDVePqKxI L/A86d07WLJ8lD53vCReHC7/thFruqfZrz93rlow= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1D3F7F8055C; Tue, 17 Jan 2023 13:26:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 16C44F80563; Tue, 17 Jan 2023 13:26:10 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2083.outbound.protection.outlook.com [40.107.6.83]) (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 6EFADF804DE for ; Tue, 17 Jan 2023 13:26:04 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6EFADF804DE 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=UocqI3AU ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JBiwzx+mVSeYOvvObkVnaiVXVSQ8/K4BytMqH2WTYl59w4J+0leS65LeMBDZfNydAByBkEkFNRBpAUpPTqPaQBXFV6yWmWYmbyMAXWuZwyeTKnmXaIX9dHJCarSdk8dBARMOgm2fdPHAIJaThYuXVrb94GaauQqS/NIRfkvPhckd/pHmMpeV5hwpBp5/KMiflA+mPC4VQ7JBV3gT4KkDKUg9GWwir4lFDsFKaCuRyC+I+yYZFvKKKKklQFV5jX/PokIJXjWXQ5pd9X3hO3GHWVsuXPTptsNAsp1ES5xdZex9TGM1hxHEWUQy5bI0sMVLtHO4Sb/MfTL9lb5XN3qVHQ== 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=Y+DaoSxUIX2+lsSC2kZZuEkTeYNQ6OHDHZmZVrkchaU=; b=UM3DT2pKRFMfvkdR0GXh0r8t2VPcyaF9h5u2rIF+U/Z6lOTgN9kffRUcE2B4PeVaSi8oNtuhkTDm3P3/iC4xoUTNGB6GRvdA0IdYKQGgZrODkKyNN2IZw0g+P3dHK38TVNI/q+6aWoWAONgjdkWszRLGUQRU8ZP8XDZFiVAinDtD0gqGrjr+/0iZKpFrHUO4OstuUN87LAGzUbsuI7W7dHiR0VU+bw1x6rpJL7OIOZmbhHgTzHdIP5bKn6Q/8hfP5w5Pf+lLJr19yRsrDwS5LTE9u3DmkjRTlS+awMX6sA6wi4aiCRp+sE+8Cyjyy4ggCQbjyaNpjV8pv8xyc+nHSA== 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=Y+DaoSxUIX2+lsSC2kZZuEkTeYNQ6OHDHZmZVrkchaU=; b=UocqI3AUhoHzW1uOpj0ezXsjUoopjP/arY54kDMeRZXu0abTjrqGVcj4MVcjv+pGv32gKxAgSLU3zaMduLmdrEu1m222VMdvsK1hsx8SHeHUpt+H4heScHqepkh0u00Rqnj5KW3PO6hvVDwlZDy9A6L4T50KY2tsKS4DVLrkLz8= 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 DBAPR04MB7240.eurprd04.prod.outlook.com (2603:10a6:10:1af::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13; Tue, 17 Jan 2023 12:26:01 +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:26:00 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 4/4 v2] ASoC: SOF: compress: Set compress data offset Date: Tue, 17 Jan 2023 14:25:33 +0200 Message-Id: <20230117122533.201708-5-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> References: <20230117122533.201708-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM0PR02CA0133.eurprd02.prod.outlook.com (2603:10a6:20b:28c::30) 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_|DBAPR04MB7240:EE_ X-MS-Office365-Filtering-Correlation-Id: 383497cd-5ce4-4a6e-d2a2-08daf885fe09 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: 8SXBRQ0Cs64WzH+DEriEu32vhNqokiKgjfnrVnkp5OGMXtFwQRsxUJYOtbAoZJuRSbBicexzxQId1yfQg8nLOhdlzzKEuccvdiW+db4S0Jr7XwdUXL53PLf2XY9NiWQLm/qSO9EGm42Y8VW8E3ADTOsTgNHvvdBI4TwQ/d5tZUm4ggJDN/BMD5xTpKBORJiI/sO1a0VP8HMTp6olviOLGDlzKth8frzwTj3T+b+OCOCdCrJKFu80Zv74bKbdoR67PJcWa2zwvhmxB6tr/5hFkjL8mRa6MFYCu//3bAe/re2bbS30JqPiLSq9OK7IauVa5bVu1nhbz5TD1jbUXOVe4OQv33WuKXYrk1RmgUwAH+RVjYsWO2rgiAml/SXnfsAwJ2hrKosQFLRrAOvzgMO7fjOTlnvwACYStpro34GCxGAIWIwJHLVVoAPSMnImz7W1dLrDlbF6YaX7udC0t0a5JwNQw6neILkeAMogG1+tVR7o0cPeMTUSEzpgsbMFdUeZQYac7vtwfU//ZHS2xrAlQVIIjFhrKUpXxjKNWcQq8WDVhHdbJ+ASGTDgLNkOETovC4VsaIhm00JvQTOqKRRjEyZH6BfG7z6yIyvZQ+nPJgGrqmxG2TjhVFceyjMNQQd0hfNL/R+m78+JehVPEcwtkk33/BxulFjVEmtiOmkKKvG5DxP0DSeXS0VPaNvkqrSUh6SLJZMxecqHWaSwhCDRdQ== 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)(396003)(376002)(366004)(136003)(346002)(451199015)(38350700002)(38100700002)(5660300002)(7416002)(8676002)(2906002)(8936002)(4326008)(6916009)(66476007)(66946007)(44832011)(66556008)(41300700001)(6512007)(186003)(6506007)(26005)(2616005)(1076003)(6486002)(316002)(6666004)(52116002)(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aUEGNbr0cOPhqcfLsjFHzCURZ19vZFqkYaItb26y/tmC72bFg0+BIFB3SXXPGH3llro6T5n1Z6URlMSutDTiPsUgKG+ocsZNwHKNZvQw8cKQwOntzMipDmqq+un/JowN4SIjQV4+WB6aYeQiD6aB/PZhLOP/KU/IrQCO0mmzDoXJbYkGmByEOpS/Vn1cYPTfzAea8BW+/EZaNv88+jAu/Jhp0sTdxYOWqh+7sMPhB0MtF+3sL8Ory9kG363Smxpw6QN/hoIUPK6s7xZF6qUti6oEI+/6vG4H3f+UYJHryZswL92J6moIKOZGk+Vm1w6eVjqTzIuaN1gtAckXh+D0kZUm7OMt+C20BH2SBV57FVYCppkPGKpLJxTZMiImg/R1tbjgTgk4cQbGzX6I7qTFweHeir6WONYH/5SLbJfYc0G7lf/L7xMxM2Iu7dSe/dz7CNguRXNVn5Xw/qVPlC7n8z/iKLMpBd6562sZ4MBrk/THMl6+tGp0G1BALWix4AaZJB+HWjg9YzzFS49b+cgrfHznPx5K7ybYLI7h0pgEwNk89zQ1RuP2FRVjX8sQCaw8BaRSXhscW2/PwrXPfaRF6WP4aTQb X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 383497cd-5ce4-4a6e-d2a2-08daf885fe09 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:26:00.4773 (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: YTCZiUOcigYWnni/Eg4bGHm/yNhlu0UGcWPSWaP7WisiIdnDs5QqVfSEkp9VxTHXj7qM+8uZjNtPiM0Bw7gE0A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7240 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.come, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, linux-imx@nxp.com, yc.hung@mediatek.com, Vsujithkumar.Reddy@amd.com, peter.ujfalusi@linux.intel.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: Peter Ujfalusi 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;