From patchwork Mon Oct 4 15:21:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12534291 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C018FC433EF for ; Mon, 4 Oct 2021 15:24:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4564F6139E for ; Mon, 4 Oct 2021 15:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4564F6139E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7695A1694; Mon, 4 Oct 2021 17:23:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7695A1694 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633361050; bh=GfEKgbKDIn9HTMKMneabF8HZ0MhPeLdk4JJ5aVK+IYc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=VV3FhcZ4uz6gxeWPj4V1BPHz1zNsHNQWXYGRPSQlo8cfTUkRii70Xu+43GbMAjF18 RocA4cdR0zV6ZNWXFiEunn5Vx5LixRfjmwRzhG67/46LQWEuHlxdiEE1hvk3E0M45H +xuZQR5veb8KXu8Qm+OysEWTCLiWU8I91y2j7tEQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 954EFF804EB; Mon, 4 Oct 2021 17:22:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1F07DF802D2; Mon, 4 Oct 2021 17:22:27 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130041.outbound.protection.outlook.com [40.107.13.41]) (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 ADA55F80240; Mon, 4 Oct 2021 17:22:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ADA55F80240 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="ZR0OilMY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZZViova8Li+LKkr0LeOp6GnlmnPxVyN551fmnfVz5r/r3AWQZfRg/8yWbQl8mlnTxD78M/VcXR7WXGpF7q4gnFyolxjfYV1pJPowRzWLNTdVmUy9kVCDiEeIX8LPbfVSUzxIFQBBRYO9i0nJhUk+KHQJYz9VIdwQPsC/Y2rURDodwzPbFXFbgXxLFNvj1jZEEXCWC93wEPhavTa3O4XIxYDFdZgj6mBnWvPSiTUGu7Iv7CTMCpuU1+oxEfEJSqNW5RcHXGV4bRk08JufWZQFdnkSBdFfPQ3ZYFswRUC+yeaXEz2QbUiSzDBQXkHvbH6TNvL2jfgQo9EveNOdO92wBg== 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=JVNIshrTpY/QQaECK8nJII10AIO2AOlJOEZxsSDMo8E=; b=dr9fMCw4rwRH3hdPDyaDlww6j/Oi+fPnda9vHSs2k3/RgzhFxccKcCdMyDfTpCAHDEIFm9XjGcl1j3mjbYJDYdAytumNacQyHXJnnwqhamLc6WDD0WoKFwyZEMm18WA720/Lvf7A3CdObxGtJu7QXnW43sRpDIR/DMa7xjnwIpSymAgPaAB3tVl2a6+r2vPaAP7FnuwSJf31jOIX2lhzjimGKDZGZxSEX+VnfL0cmxmuT4IhVsRO+w5BAhRq/UOPDK5TJlnEN1b51KIObKlT2RazGDPfGyewIVbuf4+D7xoP7t/zhxfH+hRqVvx5DzFmKAQvhzQwoNISJZziPGWMcg== 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=JVNIshrTpY/QQaECK8nJII10AIO2AOlJOEZxsSDMo8E=; b=ZR0OilMYoiygaEyQKOYBdOKvS3Z7zVKaNSxMTtRDb+8yT7KIKu9H8E1I78YOvvMWx06pNInnc48hF7N2nkN/mV2HgSrDYHQt2iLUE1Hoz0bM3NFYVvxE4iabpbD61CJTYvWChY8BxkH7+AeKGTekydAKaX7rlkJlBtCSAOiLLWg= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Mon, 4 Oct 2021 15:22:15 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4%7]) with mapi id 15.20.4544.026; Mon, 4 Oct 2021 15:22:15 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 1/4] ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write callbacks Date: Mon, 4 Oct 2021 18:21:44 +0300 Message-Id: <20211004152147.1268978-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> References: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (5.12.247.65) by VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13 via Frontend Transport; Mon, 4 Oct 2021 15:22:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ea2f8e40-ed8e-4c6d-368a-08d9874abf1e X-MS-TrafficTypeDiagnostic: VI1PR04MB7069: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1443; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Ww2wsDfyPbyWHdOP8ZHw4/bolWUSvtiVKgwjaIJCiec5iCOak1qu3r29O0li+Zo/qchc7v1CNiFnmqAudBAY99PW/wium8utdAKW7igsiYHs6L7bZn1uJSdotk9O6FiGkPnwFtU2EmtW1ao1cdU+RZ2b4kbZBCfG3r5FDnmOjDbosy4prRP79l7b3MslzgkA65DYpDDikadfLgIPSckFME5ZFqd0r1v2a6KWK7gDE2ZtyR7SjOypTBQXl6PMA1RVRcWotKU3Mw18jNA+vmyuzhi8W3uZipRO4FFFTpIkNx4hP33SD2ZADDDUs7w9xXMM+bqnsRRMVnKrbjXYt9G+ST8pQwsuVqx/QtLqQF8o+GIuJcOEaV/0i9m1TMSH08ZbZm7HPiAVtwsyLzAFBnfZmLou9PT8QwhDPt8caHe3jJu5kuikvqrCzBEiROg+lryDhWytKWCSPfWE3pp7PimG+Il4GLhD/kX8jZniLsQdVgc23WZGKcB8ywYNGGdLXKS8CdGOCtrxQFPMlTRTM+XvknuuIA6M9CdSaI4mp3HU7CpcNC2rNSF7vhbeJ7Iu0o932lNLzmKht6zaKNH8oDBRKr5O60koyfWY8ay3Ns+SBiXmIKjqY5jxuFjG145RAXo9FSSKHxpP0SvDFFqF8Nsf5pAUQ+5dEpHoIJBp5JyA4i8+zo5fMW0Eo+k6GR1wViAtAdlax/JIOqWIQRY1ecboQ== 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:(4636009)(366004)(1076003)(186003)(8936002)(38350700002)(86362001)(38100700002)(5660300002)(2616005)(8676002)(956004)(2906002)(508600001)(26005)(6486002)(66476007)(52116002)(7416002)(66946007)(6512007)(6506007)(6916009)(44832011)(83380400001)(316002)(4326008)(66574015)(66556008)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?JX18O1BGu4kiptw5/BE87xzp/81Y?= =?utf-8?q?yIXvCTQJ7FMRZBf4UxXG1hr5keA9DwpS3f5ZYoXq+RSLFoYTrVhjifgi49q6d9yRz?= =?utf-8?q?C9vnK/MVetO0yjt66k7D9vYuYk6YERj/q7njKhmazY8MVN6CuBmSJOWV22MFdGqju?= =?utf-8?q?Ww7CU1emmUd+Jbau23rsmItD21gNrVxrK0UFH3KG2p/5mh14Xz3DBsfhTpkgtBgyy?= =?utf-8?q?SdSFkYO2CJJ8fT4xif2hHN2XOikFEdIEAUpBGo9/j0pe4ox6aibb7YqEZOJDmiu5J?= =?utf-8?q?vySTixkzQIrPVeZxUulXvy3CSVGUljrNfDhX1ref98bedETP4z5M/z4zPv5+orCPz?= =?utf-8?q?mBNNuv9WFNWuOHXLRW+FyhPgGMwe5MG8KM2U6uIiFpqjArzoEEsvxhLbGJ9L1jLH1?= =?utf-8?q?MRnnKjWK9HwLRN4+G7RSTEVK/Ox1RAV0ALcF+lC4mAwID9KcnkGOLw+GqzObJZG59?= =?utf-8?q?jQ2bcNI3QezncYpqNw9FGL18a3xBTX65JXqzdN2YzmVvxx+46FDjZ/47sgH2y8BiZ?= =?utf-8?q?lBR56QdhviiE9v9SI4o1jmOJbkuXRpJDJJqi9oEN3++YMRwv10K45DBVi6stocslU?= =?utf-8?q?IgEBsw39DSTwAZoqpG72AyilWrez5+wznHhUoXMF+G0iGWhus3XbE6NRdQaEK/X4W?= =?utf-8?q?uaP5+Mdnhq/toLD9VpRXeRoMJ9N7+J3mULxjxKYOe38CPJUaCWKHNA9NkBT+NH/oe?= =?utf-8?q?GSq+rfMpcRRZTGOrnW1ughaY770W//XG9xn29i8QNkAJxK5Fl/zQvv9LxvYjeab7J?= =?utf-8?q?U/h2vn4Nh7ZtcFmwMFVYMBOnAlFwzU67SRBzWqhvrTSUrsNINyL3LU2OX0+bfPGgc?= =?utf-8?q?m5Cx03tdHRSfE9xvyzyT2zBn1c7rPzryMgXvs0GzGnys32gV6laKfpAQSs/kgMtpB?= =?utf-8?q?4hhEtPV5o6+MFwld4HANEdq3VeT+LJlaVQ3FLWQmqczV95HldFsmYunh6MXXOnA2J?= =?utf-8?q?n25fK6xIkGwcfJAHokdiuIYin6wkYktm2m5HKJ0ix0xlaVbaqoIkXFigbHtU7y9BT?= =?utf-8?q?vdBg9Qc9Tlzd4Mpz8+DIcIJ31B2HGEaq0AYHGaW6eD1SPVLWNnjYVbphzj1UaIu8s?= =?utf-8?q?plSg4qK1VrzqYMI8h8tPXpMVr4MaJRnszp96MONJO9kQovmNJ6kxjblQCUniCKNtG?= =?utf-8?q?cgs42TSPOJziTa/uh/1Ji7LeiuqPF0OGIKElVn/V0YA4IUWOedmFKVd9Je/57h8GX?= =?utf-8?q?axQU5sP+FvAqeUkzDJOuOAeL0ptb254rcEG+VbSbrv+E8vsPU/1Ncn1EUCJ8a4eYt?= =?utf-8?q?q6MkYwuRPDhLB5Vb?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea2f8e40-ed8e-4c6d-368a-08d9874abf1e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 15:22:15.4842 (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: xyFuyKhm/6N/aXex5U7LVeY6+0snMGHBxuGul82lD7oLyqj3NpD5d6FqfZdEuegmpj+qyUAsTON9i76NonqEJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Cc: Daniel Baluta , guennadi.liakhovetski@linux.intel.com, alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, budliviu@gmail.com, yang.jie@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta We need to introduce snd_sof_mailbox_{read/write} in order to provide a generic way for mailbox access. These routines are optional, each platform can implement their own specific routines. So far, all platforms use mmapped I/O thus they can use custom made routines sof_mailbox_read / sof_mailbox_write that use MMIO. Signed-off-by: Daniel Baluta Signed-off-by: Bud Liviu-Alexandru Reviewed-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi --- sound/soc/sof/imx/imx8.c | 8 ++++++++ sound/soc/sof/imx/imx8m.c | 4 ++++ sound/soc/sof/intel/apl.c | 4 ++++ sound/soc/sof/intel/bdw.c | 4 ++++ sound/soc/sof/intel/byt.c | 8 ++++++++ sound/soc/sof/intel/cnl.c | 4 ++++ sound/soc/sof/intel/icl.c | 4 ++++ sound/soc/sof/intel/pci-tng.c | 4 ++++ sound/soc/sof/intel/tgl.c | 4 ++++ sound/soc/sof/ops.h | 15 +++++++++++++++ sound/soc/sof/sof-priv.h | 8 ++++++++ 11 files changed, 67 insertions(+) diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index 0247806be8d7..75baa5209a89 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -428,6 +428,10 @@ struct snd_sof_dsp_ops sof_imx8_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* ipc */ .send_msg = imx8_send_msg, .fw_ready = sof_fw_ready, @@ -475,6 +479,10 @@ struct snd_sof_dsp_ops sof_imx8x_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* ipc */ .send_msg = imx8_send_msg, .fw_ready = sof_fw_ready, diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c index 08d29f095d51..c7d3d898d5a4 100644 --- a/sound/soc/sof/imx/imx8m.c +++ b/sound/soc/sof/imx/imx8m.c @@ -291,6 +291,10 @@ struct snd_sof_dsp_ops sof_imx8m_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* ipc */ .send_msg = imx8m_send_msg, .fw_ready = sof_fw_ready, diff --git a/sound/soc/sof/intel/apl.c b/sound/soc/sof/intel/apl.c index e6a1f6532547..917f78cf6daf 100644 --- a/sound/soc/sof/intel/apl.c +++ b/sound/soc/sof/intel/apl.c @@ -42,6 +42,10 @@ const struct snd_sof_dsp_ops sof_apl_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_thread = hda_dsp_ipc_irq_thread, diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index d09275417749..9c06b92fcb5e 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -616,6 +616,10 @@ static const struct snd_sof_dsp_ops sof_bdw_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* ipc */ .send_msg = bdw_send_msg, .fw_ready = sof_fw_ready, diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 8f60c72fee7e..8c500a83babc 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -226,6 +226,10 @@ static const struct snd_sof_dsp_ops sof_byt_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_handler = atom_irq_handler, .irq_thread = atom_irq_thread, @@ -304,6 +308,10 @@ static const struct snd_sof_dsp_ops sof_cht_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_handler = atom_irq_handler, .irq_thread = atom_irq_thread, diff --git a/sound/soc/sof/intel/cnl.c b/sound/soc/sof/intel/cnl.c index 430a268e6b26..3957e2b3db32 100644 --- a/sound/soc/sof/intel/cnl.c +++ b/sound/soc/sof/intel/cnl.c @@ -247,6 +247,10 @@ const struct snd_sof_dsp_ops sof_cnl_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_thread = cnl_ipc_irq_thread, diff --git a/sound/soc/sof/intel/icl.c b/sound/soc/sof/intel/icl.c index 38a40c03c9da..0b2cc331d55b 100644 --- a/sound/soc/sof/intel/icl.c +++ b/sound/soc/sof/intel/icl.c @@ -41,6 +41,10 @@ const struct snd_sof_dsp_ops sof_icl_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_thread = cnl_ipc_irq_thread, diff --git a/sound/soc/sof/intel/pci-tng.c b/sound/soc/sof/intel/pci-tng.c index 3d6d013844d7..8042ac76ec15 100644 --- a/sound/soc/sof/intel/pci-tng.c +++ b/sound/soc/sof/intel/pci-tng.c @@ -142,6 +142,10 @@ const struct snd_sof_dsp_ops sof_tng_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_handler = atom_irq_handler, .irq_thread = atom_irq_thread, diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c index 664a11aaada2..48da8e7a67bc 100644 --- a/sound/soc/sof/intel/tgl.c +++ b/sound/soc/sof/intel/tgl.c @@ -37,6 +37,10 @@ const struct snd_sof_dsp_ops sof_tgl_ops = { .block_read = sof_block_read, .block_write = sof_block_write, + /* Mailbox IO */ + .mailbox_read = sof_mailbox_read, + .mailbox_write = sof_mailbox_write, + /* doorbell */ .irq_thread = cnl_ipc_irq_thread, diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h index a93aa5b943b2..1a5cc8ad4aca 100644 --- a/sound/soc/sof/ops.h +++ b/sound/soc/sof/ops.h @@ -322,6 +322,21 @@ static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev, return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes); } +/* mailbox IO */ +static inline void snd_sof_dsp_mailbox_read(struct snd_sof_dev *sdev, + u32 offset, void *dest, size_t bytes) +{ + if (sof_ops(sdev)->mailbox_read) + sof_ops(sdev)->mailbox_read(sdev, offset, dest, bytes); +} + +static inline void snd_sof_dsp_mailbox_write(struct snd_sof_dev *sdev, + u32 offset, void *src, size_t bytes) +{ + if (sof_ops(sdev)->mailbox_write) + sof_ops(sdev)->mailbox_write(sdev, offset, src, bytes); +} + /* ipc */ static inline int snd_sof_dsp_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 1289e2efeb62..388e71bcacf8 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -145,6 +145,14 @@ struct snd_sof_dsp_ops { enum snd_sof_fw_blk_type type, u32 offset, void *src, size_t size); /* mandatory */ + /* Mailbox IO */ + void (*mailbox_read)(struct snd_sof_dev *sof_dev, + u32 offset, void *dest, + size_t size); /* optional */ + void (*mailbox_write)(struct snd_sof_dev *sof_dev, + u32 offset, void *src, + size_t size); /* optional */ + /* doorbell */ irqreturn_t (*irq_handler)(int irq, void *context); /* optional */ irqreturn_t (*irq_thread)(int irq, void *context); /* optional */ From patchwork Mon Oct 4 15:21:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12534293 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFE78C433EF for ; Mon, 4 Oct 2021 15:24:21 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F1B66139E for ; Mon, 4 Oct 2021 15:24:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3F1B66139E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B3E781693; Mon, 4 Oct 2021 17:23:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B3E781693 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633361059; bh=VZUxSOkU4y0xvCTljgNWI0B19EWKJt5G6DU676fgvK4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eOSDMOjrWoWxs1VEOFa0FpkQIGtlZPSgHDNyP3TzmuqeDSpzAvPb8IHnZAwyjQgl9 udb/R5bjz1YDyN8UFTZNtc/6Go4rfuz+wnvjhHrjQhcUc5rivTG8yNbKsKq6jtFZlS zJi8G/Rp+66oFXBmuKsoqtwUm3pW0pBJqS2ZX2Hg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BC4B8F804FA; Mon, 4 Oct 2021 17:22:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE5FDF804AC; Mon, 4 Oct 2021 17:22:29 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130041.outbound.protection.outlook.com [40.107.13.41]) (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 EAA24F80249; Mon, 4 Oct 2021 17:22:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EAA24F80249 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="KoyKs7Q/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nAxZW7bl5T6TpJLMfWUAFZlwd2liAV5IBF3MBPwrlU5edTjTHxfqRuIiMujw6I0Zgo8MLhFEOgoDU8GhSfGJx0nwpo7irZpCVDSE5Dh2aASWBuEdOFijy4q32rrKv6gbTnKOXiWZRb0vkyo8OlGfyOht3Vi7PUSw1W2fWD9DVl8tUq3ChN/QotYJmzFKzElUV9K9nDzYZEcNEU5wuHxA2VdmQ85dgtqpXwmyngBC8jxF9GUP6srR6Xp6QVCTqy4P8KP4TaXQ+mF2NN04cvXR4s1knvtivQzesbvZ06u1kxIa6puB5hWe6MwqpwpHMMO+cOEM+mRxhpOCAvhzv+bp9Q== 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=1evrSSMpE3QGDZWh2leyYpyQmz5qlGwZ8UTocQ3twA8=; b=A1pA65D5IXiD2HnhI7iZhMBQOtR4okM+raYBQKx49IhSZcRu7NX3vl7ynHhXlf7tTbBb9oif5JlPdqDLvc1cFsQtTVZhnCvjC9ahqtPHzYQJAyVF6iZSFOwRdstqkCyGZxgl0d3zXGwV0I42SD/MVxjcqbwH3nCuKS/pHsLwhHISw7vW0yMC55ZJGXhiaEBCiL/R+/n6pGEImy3kejAm8sRy5Kr3QPAScTJFOWLpDtc995WN9tuM9fGaTxjxBBmwFn7nH4BuObfc/9O5M0YQaBg6aJG87BFwMwetKcvmI13uWJZL3A2L0l09wdSy66aMLbz1phA191N0BlwnWRUQWA== 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=1evrSSMpE3QGDZWh2leyYpyQmz5qlGwZ8UTocQ3twA8=; b=KoyKs7Q/ANMRp8HJkQ5f5RjaTBwZgKNKJBkT23e/+vau95EuNbDlSBQYtNp/b/asiCZEHOClCvs2M3MDH3atszRsFvefaIVq/UfUSZRR4X2Z2wnJ0/pfQbPf3vUAL3h5UTcKjBYHbuTdwNjE+gmCbF9l+r9Th/ts0GIs9yLJYxk= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Mon, 4 Oct 2021 15:22:17 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4%7]) with mapi id 15.20.4544.026; Mon, 4 Oct 2021 15:22:17 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 2/4] ASoC: SOF: Make Intel IPC stream ops generic Date: Mon, 4 Oct 2021 18:21:45 +0300 Message-Id: <20211004152147.1268978-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> References: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (5.12.247.65) by VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13 via Frontend Transport; Mon, 4 Oct 2021 15:22:15 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5a1b1ad-3b2f-41c6-9431-08d9874abfb4 X-MS-TrafficTypeDiagnostic: VI1PR04MB7069: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dn346YTo3Sch0JORbha3cCzsUdVby9sr21WkKuQOrIg522TTAG98OYbzlZAJBVVqXF9Yy+EwPOJmZ1whUXIWzm7uhFUVWlmyxpzo7+6m9LO2FhmpnIQb7sr0u8iItRcpa3HPKUHM0STgf1jnivta8QhJFpx1Y38TQm/FctuSwASLIpMraPlNh8C5XA9992CkkFUG3I2anxGMxODfi1wG5mvDXXF9b1e1dfR5vMHeugcxnR4T012ajcDLEg0j/V8Q6tu0Ag6er3WJrMHTrHpF4TyAS52bQ+vnOaWaDxvhUC4hdB2XNHHXPJT+ODiQetQjk3+d/rjOYJObpzoyE9Q8+CK9oQShvr2vuRAb9S9F+YXwyXBZaE6YFGKcOCA44Tk6YigeeKdxYpearnjodUSv/gp07SCRuI4vGqEG1MhkkbSY8bEzTeMl4P6YmoVZVq716JbfJPO+X8LnU/sEq8dBJ+NMcWtI44v64/vDeXllfljCfZdcoXv1nHXqXy1xckv2OuxOM7jNMpMznwYR65r1hQ39YOgy1MuTiZUeF+JPbzcn+kHIxBhbwmJikvo9x2cZnSnQbs6vnvYl9QnCTRc/go9qbewqsUBymLZqPJTdknp76qLMSAh6Qm1YoItyei2DkmzbFbYO9Fw+xNW/duTBTlCHa521zDdSmzJbzqx82uMW0nUtj2DlE/AY3+n817fhOqq9asIkK+m4Cfbc0U9UrASBcyJ9aDYBWq2NKJ7cutI= 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:(4636009)(366004)(1076003)(186003)(8936002)(38350700002)(86362001)(38100700002)(5660300002)(2616005)(8676002)(956004)(2906002)(508600001)(26005)(6486002)(66476007)(52116002)(7416002)(66946007)(6512007)(30864003)(6506007)(6916009)(44832011)(83380400001)(316002)(4326008)(66574015)(66556008)(54906003)(6666004)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?diLc+1hFETrneVGF5aQTF32NyuLg?= =?utf-8?q?65AgH675NxxDhWiymycm1WptXkLc8NXcUR+KR6x+CrvnIABipZKT8vvl/Tu4w1btz?= =?utf-8?q?7toP/1NDQkzcVQms34aSjHlZPGbHthq01CGdb11ee/b/sqPIznIfSmd18YzMs7Ftb?= =?utf-8?q?VY5C5M7ZL0GYCAPnHGCOBlLw9y6uLmS8XWwkgTR2uQlkW3NB2fqzdKxivWHE0PRqo?= =?utf-8?q?mbPSt/bsqXZfWOoHLXuDaN869npVysWBVYUqQRfSRusoOeGX/gRERUYWHpGW+Mhid?= =?utf-8?q?s7isCSj8V521EMsEKqi3XWTfggb53H+IoRuwqENK4AW4bIMHiHoPnvlwQBZpqbmQI?= =?utf-8?q?G7B+HT70vPxOAYAJzHKMBHPsNWcMYglKi3++FbWQ2X2xCaNR1n392oqSBULH/nY7A?= =?utf-8?q?zYhw0+/IYXg65qnnu6/w/HXWuyco7pmmVWexfQvOZukAB2T9ZXg3gRtPAyby97FIc?= =?utf-8?q?lkQZr2BkMpY4frtxJug8JPyF2ulpaFzY7H2nX71cGD4KfpN7VF26DVdew8oOrdJb/?= =?utf-8?q?aMwkMt5g8wOoV+SQEGuTo7oGwjO9Qc+g1Y8iOuHjUZjUMUyh5begLHJoFGDYM9I9b?= =?utf-8?q?Jc1hkXdLddDDbPYf3iqb/ehNFh6hz0AEkx8tQsR48dpwti5NDrVbgcQ/6/OC/4QPQ?= =?utf-8?q?qML30GcXClyZBRQMPILtWSLRe0lOm/An1wVkLy7GEZFHmJSNRUbpXnxg1yTmQiPk0?= =?utf-8?q?6r/nA4sjwpcjXOsfvnZrkbhbhOaH+SpkUvCCnH8vHJyHpR0wGP0Y0gQAnx0cQGZ2H?= =?utf-8?q?2YPBQF5oN2m4Qa6/WqMtyz+8fjjXTqYDMN+I6hUNi7YVff2uxHyHq+d0MyVMNbPjc?= =?utf-8?q?cOAlR12Y7yCE12bQNffebfKiC8zGwNwEBKllzYjoFTsWmczPwfuLFOVjHkdidUmOt?= =?utf-8?q?BO7w1cKAiCsCESIrj6F2PJpaJByJyR2CvbRhFiMLEPRWFhbepMAgydsGdQ9hbx48j?= =?utf-8?q?qUZ0MHnhvx1t9o+U6/XtAerR76MgLByOg1ZxffUPwbRuUh4BT1dMcrJUIb1kOup71?= =?utf-8?q?7YBgsea7H0QCXYNAKhNdDlwHOAL+WMWC7koRWUPf15Zv5J7gC7CTNrGXzBbSK9sAv?= =?utf-8?q?3hz0BEqTC6xi22XOnixxSpoP+GF/ylIM+nFO7syCNwmcuY7yBxCxUDxTjphvokCTs?= =?utf-8?q?7ebMbbbr8QGOmmJv31oJpU1ROOmMKUc3+z8KFlnTeXYtRXE8LK7DYUXDF+TaeijJ5?= =?utf-8?q?J+ibDpCQZTxeTbRwXEQLMdENm50QeMJXOmYZdqkLkXfoxuvP4pyfy7PNujaocTjpx?= =?utf-8?q?Cu8kkT1F8Rgo+IB3?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5a1b1ad-3b2f-41c6-9431-08d9874abfb4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 15:22:16.5406 (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: 5ZsaEyW5cMDk5TgUG15KF0JrHrM9p4Rf391nBswjZx6dd0+WEQh6I0wfU6MviyvDmCSvaccuXDmNLTzeTcQMEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Cc: Daniel Baluta , guennadi.liakhovetski@linux.intel.com, alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, budliviu@gmail.com, yang.jie@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, Daniel Baluta , peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Bud Liviu-Alexandru This operations should be generic as there is nothing Intel specific. This works well for NXP i.MX8 stream IPC ops. We start by moving sof/intel/intel-ipc.c into sof/stream-ipc.c and rename the functions to be generic. Notice that we use newly introduced snd_sof_dsp_mailbox_read instead of sof_mailbox_read, to make sure that we are not bound to existing MMIO memory access, and we allow platform to implement their own memory access routines. Signed-off-by: Daniel Baluta Signed-off-by: Bud Liviu-Alexandru Reviewed-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Reviewed-by: Péter Ujfalusi --- sound/soc/sof/Makefile | 2 +- sound/soc/sof/intel/Makefile | 3 -- sound/soc/sof/intel/bdw.c | 8 +-- sound/soc/sof/intel/byt.c | 16 +++--- sound/soc/sof/intel/pci-tng.c | 8 +-- sound/soc/sof/sof-priv.h | 20 ++++---- .../sof/{intel/intel-ipc.c => stream-ipc.c} | 50 +++++++++---------- 7 files changed, 52 insertions(+), 55 deletions(-) rename sound/soc/sof/{intel/intel-ipc.c => stream-ipc.c} (58%) diff --git a/sound/soc/sof/Makefile b/sound/soc/sof/Makefile index bdea0faac117..c5b97c66a9f1 100644 --- a/sound/soc/sof/Makefile +++ b/sound/soc/sof/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ - control.o trace.o utils.o sof-audio.o + control.o trace.o utils.o sof-audio.o stream-ipc.o snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += sof-probes.o diff --git a/sound/soc/sof/intel/Makefile b/sound/soc/sof/intel/Makefile index 9635dd47a17d..1f473d4d8416 100644 --- a/sound/soc/sof/intel/Makefile +++ b/sound/soc/sof/intel/Makefile @@ -3,8 +3,6 @@ snd-sof-acpi-intel-byt-objs := byt.o snd-sof-acpi-intel-bdw-objs := bdw.o -snd-sof-intel-ipc-objs := intel-ipc.o - snd-sof-intel-hda-common-objs := hda.o hda-loader.o hda-stream.o hda-trace.o \ hda-dsp.o hda-ipc.o hda-ctrl.o hda-pcm.o \ hda-dai.o hda-bus.o \ @@ -18,7 +16,6 @@ snd-sof-intel-atom-objs := atom.o obj-$(CONFIG_SND_SOC_SOF_INTEL_ATOM_HIFI_EP) += snd-sof-intel-atom.o obj-$(CONFIG_SND_SOC_SOF_BAYTRAIL) += snd-sof-acpi-intel-byt.o obj-$(CONFIG_SND_SOC_SOF_BROADWELL) += snd-sof-acpi-intel-bdw.o -obj-$(CONFIG_SND_SOC_SOF_INTEL_HIFI_EP_IPC) += snd-sof-intel-ipc.o obj-$(CONFIG_SND_SOC_SOF_HDA_COMMON) += snd-sof-intel-hda-common.o obj-$(CONFIG_SND_SOC_SOF_HDA) += snd-sof-intel-hda.o diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index 9c06b92fcb5e..2c09a523288e 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -626,8 +626,8 @@ static const struct snd_sof_dsp_ops sof_bdw_ops = { .get_mailbox_offset = bdw_get_mailbox_offset, .get_window_offset = bdw_get_window_offset, - .ipc_msg_data = intel_ipc_msg_data, - .ipc_pcm_params = intel_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* machine driver */ .machine_select = bdw_machine_select, @@ -642,8 +642,8 @@ static const struct snd_sof_dsp_ops sof_bdw_ops = { .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, /* stream callbacks */ - .pcm_open = intel_pcm_open, - .pcm_close = intel_pcm_close, + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, /* Module loading */ .load_module = snd_sof_parse_module_memcpy, diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 8c500a83babc..e2fa08f1ae74 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -240,8 +240,8 @@ static const struct snd_sof_dsp_ops sof_byt_ops = { .get_mailbox_offset = atom_get_mailbox_offset, .get_window_offset = atom_get_window_offset, - .ipc_msg_data = intel_ipc_msg_data, - .ipc_pcm_params = intel_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* machine driver */ .machine_select = atom_machine_select, @@ -256,8 +256,8 @@ static const struct snd_sof_dsp_ops sof_byt_ops = { .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, /* stream callbacks */ - .pcm_open = intel_pcm_open, - .pcm_close = intel_pcm_close, + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, /* module loading */ .load_module = snd_sof_parse_module_memcpy, @@ -322,8 +322,8 @@ static const struct snd_sof_dsp_ops sof_cht_ops = { .get_mailbox_offset = atom_get_mailbox_offset, .get_window_offset = atom_get_window_offset, - .ipc_msg_data = intel_ipc_msg_data, - .ipc_pcm_params = intel_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* machine driver */ .machine_select = atom_machine_select, @@ -338,8 +338,8 @@ static const struct snd_sof_dsp_ops sof_cht_ops = { .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, /* stream callbacks */ - .pcm_open = intel_pcm_open, - .pcm_close = intel_pcm_close, + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, /* module loading */ .load_module = snd_sof_parse_module_memcpy, diff --git a/sound/soc/sof/intel/pci-tng.c b/sound/soc/sof/intel/pci-tng.c index 8042ac76ec15..18eb41b8a8f4 100644 --- a/sound/soc/sof/intel/pci-tng.c +++ b/sound/soc/sof/intel/pci-tng.c @@ -156,8 +156,8 @@ const struct snd_sof_dsp_ops sof_tng_ops = { .get_mailbox_offset = atom_get_mailbox_offset, .get_window_offset = atom_get_window_offset, - .ipc_msg_data = intel_ipc_msg_data, - .ipc_pcm_params = intel_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* machine driver */ .machine_select = atom_machine_select, @@ -172,8 +172,8 @@ const struct snd_sof_dsp_ops sof_tng_ops = { .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, /* stream callbacks */ - .pcm_open = intel_pcm_open, - .pcm_close = intel_pcm_close, + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, /* module loading */ .load_module = snd_sof_parse_module_memcpy, diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 388e71bcacf8..3927015c8a96 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -576,17 +576,17 @@ int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type, int sof_fw_ready(struct snd_sof_dev *sdev, u32 msg_id); -int intel_ipc_msg_data(struct snd_sof_dev *sdev, +int sof_ipc_msg_data(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream, + void *p, size_t sz); +int sof_ipc_pcm_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream, - void *p, size_t sz); -int intel_ipc_pcm_params(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - const struct sof_ipc_pcm_params_reply *reply); - -int intel_pcm_open(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream); -int intel_pcm_close(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream); + const struct sof_ipc_pcm_params_reply *reply); + +int sof_stream_pcm_open(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream); +int sof_stream_pcm_close(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream); int sof_machine_check(struct snd_sof_dev *sdev); diff --git a/sound/soc/sof/intel/intel-ipc.c b/sound/soc/sof/stream-ipc.c similarity index 58% rename from sound/soc/sof/intel/intel-ipc.c rename to sound/soc/sof/stream-ipc.c index df37187c8427..15a55851faeb 100644 --- a/sound/soc/sof/intel/intel-ipc.c +++ b/sound/soc/sof/stream-ipc.c @@ -7,7 +7,7 @@ // // Authors: Guennadi Liakhovetski -/* Intel-specific SOF IPC code */ +/* Generic SOF IPC code */ #include #include @@ -17,39 +17,39 @@ #include #include -#include "../ops.h" -#include "../sof-priv.h" +#include "ops.h" +#include "sof-priv.h" -struct intel_stream { +struct sof_stream { size_t posn_offset; }; -/* Mailbox-based Intel IPC implementation */ -int intel_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - void *p, size_t sz) +/* Mailbox-based Generic IPC implementation */ +int sof_ipc_msg_data(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream, + void *p, size_t sz) { if (!substream || !sdev->stream_box.size) { - sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); + snd_sof_dsp_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); } else { - struct intel_stream *stream = substream->runtime->private_data; + struct sof_stream *stream = substream->runtime->private_data; /* The stream might already be closed */ if (!stream) return -ESTRPIPE; - sof_mailbox_read(sdev, stream->posn_offset, p, sz); + snd_sof_dsp_mailbox_read(sdev, stream->posn_offset, p, sz); } return 0; } -EXPORT_SYMBOL_NS(intel_ipc_msg_data, SND_SOC_SOF_INTEL_HIFI_EP_IPC); +EXPORT_SYMBOL(sof_ipc_msg_data); -int intel_ipc_pcm_params(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - const struct sof_ipc_pcm_params_reply *reply) +int sof_ipc_pcm_params(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream, + const struct sof_ipc_pcm_params_reply *reply) { - struct intel_stream *stream = substream->runtime->private_data; + struct sof_stream *stream = substream->runtime->private_data; size_t posn_offset = reply->posn_offset; /* check if offset is overflow or it is not aligned */ @@ -64,12 +64,12 @@ int intel_ipc_pcm_params(struct snd_sof_dev *sdev, return 0; } -EXPORT_SYMBOL_NS(intel_ipc_pcm_params, SND_SOC_SOF_INTEL_HIFI_EP_IPC); +EXPORT_SYMBOL(sof_ipc_pcm_params); -int intel_pcm_open(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream) +int sof_stream_pcm_open(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream) { - struct intel_stream *stream = kmalloc(sizeof(*stream), GFP_KERNEL); + struct sof_stream *stream = kmalloc(sizeof(*stream), GFP_KERNEL); if (!stream) return -ENOMEM; @@ -86,18 +86,18 @@ int intel_pcm_open(struct snd_sof_dev *sdev, return 0; } -EXPORT_SYMBOL_NS(intel_pcm_open, SND_SOC_SOF_INTEL_HIFI_EP_IPC); +EXPORT_SYMBOL(sof_stream_pcm_open); -int intel_pcm_close(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream) +int sof_stream_pcm_close(struct snd_sof_dev *sdev, + struct snd_pcm_substream *substream) { - struct intel_stream *stream = substream->runtime->private_data; + struct sof_stream *stream = substream->runtime->private_data; substream->runtime->private_data = NULL; kfree(stream); return 0; } -EXPORT_SYMBOL_NS(intel_pcm_close, SND_SOC_SOF_INTEL_HIFI_EP_IPC); +EXPORT_SYMBOL(sof_stream_pcm_close); MODULE_LICENSE("Dual BSD/GPL"); From patchwork Mon Oct 4 15:21:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12534295 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B192C433F5 for ; Mon, 4 Oct 2021 15:25:08 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F3B66139E for ; Mon, 4 Oct 2021 15:25:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7F3B66139E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 135501670; Mon, 4 Oct 2021 17:24:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 135501670 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633361106; bh=s0LjQpFBtfzzO5rJhiocxBv5A7thuHwG3CliUsFmdlY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=UEAP61TK2Uj8lqpJiQA684I5Z/E12BsVoXXvgA9CarLfuH4jHP2E9TvMfH40lOU1h 6yUG4xb1E7xobuf3+btnoKBzgz+xo3bzXy+HDapToKZYrZSnfMTpsVPpA32nnefaC0 7uGmKr4yHzBW9/azj1Q1WKTBqyrWVQFNj1CSBwg0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 0BEAFF80515; Mon, 4 Oct 2021 17:22:36 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3D78DF804F1; Mon, 4 Oct 2021 17:22:32 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130041.outbound.protection.outlook.com [40.107.13.41]) (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 37879F80229; Mon, 4 Oct 2021 17:22:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 37879F80229 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="KuFw7bH2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DgLZlrL9z542j3e17TCea7fXTzX7GE1moO8ph/mxXjNItiJh8/od/Ia1lTKZK2bv7ANQecZAKyYe1GAxDIVijuOpjoYYT6qOKR9BkEV5KXL7gEzlO4k6mL+xKD4zGMiO2fc2OgMj9bF21n3l7cdBJONT9hUeW5SKKCb7RjI8/5ZZvCR78grffaAEViSMkguqyQIKU5M+CquTrIdRLe8J8NFT3cGnXVkql51VXLmNau4l63/S5GdpaE0yoaw1XaMVwmyZYWuhZ+XcmSTOvfQ4XD3OfO9Mh0UtlFEHHBKTHVJtR/+9KPM/TitstxRTwXel7x8/BQM+Hz9/brJ1o3Hy8A== 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=z5R7jA1eGPzE4fzA4UUe8mybDZMXJChRLgA7/f3GPrI=; b=W4Hl83z/FlgcR0Ps8U+95Mn+tv1YhZk7J1hoyk2r8IbuyQi4xRAKrjr1pfNGglils27S802uWYAXzqaU9C9cdR1BSwFvdgPFShuOK1Sfh3N7qxl1P6zJYMl/5UmgX+rY+MDAXswEAKRmWKS7FSN3ycOzTowdknGCXdm3agBrXaUE8Zxi0/iEFJXn+57ElxZw4NbXSHxQ8ly0m2M7Gk6EUI9qLd+1A0QHhcil0gsoC/stuD8MXqP3mw2cIcaeVZXb30famG79L8oTSRLmdLHON+nvivfZNTw0+davF+cqs9YWqZbiSbxHeCaGhFmG/ApXnHMd3m4yvi4JJDUUWuImaQ== 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=z5R7jA1eGPzE4fzA4UUe8mybDZMXJChRLgA7/f3GPrI=; b=KuFw7bH2vgFsw7Vamvi7PiHg2blCCgqPcjJ3E6khLM8LOlzdePUkzzo6pcqW0DXMmkJZEAj3emhkcWShAKO7uto3E8nZ09PCmeEgl+CQihu+6aWyixqklGRkh5aiTD2mTqAZszsGXXUM152dldsXosnN011HxZd3t6wnf1jRyXM= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Mon, 4 Oct 2021 15:22:17 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4%7]) with mapi id 15.20.4544.026; Mon, 4 Oct 2021 15:22:17 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 3/4] ASoC: SOF: imx: Use newly introduced generic IPC stream ops Date: Mon, 4 Oct 2021 18:21:46 +0300 Message-Id: <20211004152147.1268978-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> References: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (5.12.247.65) by VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13 via Frontend Transport; Mon, 4 Oct 2021 15:22:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: af93107c-785f-428d-6c12-08d9874ac040 X-MS-TrafficTypeDiagnostic: VI1PR04MB7069: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:949; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tuW8maISv1dJCXu+TPSrvj5hcqQcVFWiz6d12sBpM2tfJeTGY7MWUdWRA9pkPQAuk9xm0jsHMsJ1uhpO+mWUK6irFMoSapNVnpE9sEZl13FSODlNvibgme1Ub5cjYZPaEB5id+8J73WgojkKBOtzSsE/M5peg66xSu2lW0K7I3HuVYG40p2kYEGXSOEZ+/QxEu5RAMHpVwxAiO2dnLhWdEGJxAJsaJdjGNjbELDXqrcJfkdcRGyM/Tc0ULjQQ+uZWhTggXqD9GbQB+5ojh1apVOn6opC/YlRw2ZneCH/nn7BbDDmPJ65ut15HXbC5J7vZYyWe0vsZUmpgzrbgbNkHOiVSmv1kxK2YyOthmlRvFrqWLGlg9sZi0W51nqhBryRB/eIa8ZWx1mG2nen5JyLake4nJD4myuJ6dri18dSMNirshVvGjkaXc72hihAWv7nBaFTcpBnh0Ey9GljMU+DR+NikshAL8WBCZD5cqqJCD/Bo4megWKi6wZJZDpVDkSk4wHTCcMW/iZLgxhB4PXOCvF6WX+k2ag4WoufDAIxZ+OVJwjdrxVscOYK/TfQlhIwozu0Vya27pqLfPvibsVY9uqBi0CxLrP8wrw168ITmVTpYV2epEBo79bkujYx/KJE24Iu3QKmKYGrOL2n/CPnY73HdgTH/Lmx3gGXp6w3sEQESel2LYj2Ld2XGKcVmQIWxOPi7nwRfsNKBMKzn/t9unSAeu8oEq+Cuoi5L/8FLJw= 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:(4636009)(366004)(1076003)(186003)(8936002)(38350700002)(86362001)(38100700002)(5660300002)(2616005)(8676002)(956004)(2906002)(508600001)(26005)(6486002)(66476007)(52116002)(7416002)(66946007)(6512007)(6506007)(6916009)(44832011)(83380400001)(316002)(4326008)(66574015)(66556008)(6666004)(41533002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?FPlmhtg/mjlJfQgdYit6xraWW2V2?= =?utf-8?q?JZ2HKPkrC4aBq5dagG0ElguZFGYDo8AvFln8hyQ4giwO7J38qcL3nF/VdQjOruv1+?= =?utf-8?q?53rS28GTZTHEEJlhlCHQxh+VOkXLnPw1HfzFQDMzMjjZFGmUnyMIGwvu3o53d8RsK?= =?utf-8?q?2ofxgs9y7833M2O+HmS2IY0EYIqsssYpkAfxjCW8sRJPiKHBBYJQTcKE8dSwuZVtn?= =?utf-8?q?y47zi4fHRRaUHP6Lewnoe1k9KHNWIk6KtZUAmsIbCgadcKcAlfMjZ8FDWuaQAXnWW?= =?utf-8?q?EuafPE9kHYIvWlZ9JWPBm/bGTiuLEMTJrRpWaq5CBP8c4V+E5MutR9sY8ifKnM0An?= =?utf-8?q?jcZ+YzzT59v0pArXh9wyr8jNRS+yggPLdxeCDpjwkaMzNoYsg2kwkGITHdSGAa90L?= =?utf-8?q?ovVkYR0bO6l5ODa+YeUeV76ShlQMaMlnDxsthY7S531lknxTMgD7fe0GKJACPv+KO?= =?utf-8?q?zOOsm/QTn2wy/yMEOvIdyLQBvPjXrq83J5yjmApgcYL/sDFUq9MzhYJytDTYmyLoL?= =?utf-8?q?nKII4ffZiilZXc5+0HE2DCEEm/SskQRInredAGx9ReYEHNJ030cC2aotZczivExpE?= =?utf-8?q?/RJnxpARSQRpOnMJAxeCJq0sgL7FpHf3kr6Zuty49imtxYHljZbTeX6ztPALiSM4V?= =?utf-8?q?A7a2KKVetgbjfOaF4lsdy4S4sAUF1wEyg3NcGbkis+MoknS+iq3e1hvsp9lPw0GoZ?= =?utf-8?q?uaG4K09M1lbD8Prg2Iy9S9TC4IDcfsTTn+39mZXFe4Vfkcvm/vWP3UQGzAis/YSxN?= =?utf-8?q?g6AUvSK4iaaK7PniNDKrUFSN4z3HcJ/tTXMXYxQ/61nRIGsi6AFcS1U4Lc+TssouW?= =?utf-8?q?Vy9S96G3M3ahnpfFYnq/LttYWxXhP6j/olBP0Bx/cCmU6A2o423Yyed+Luo24bD/x?= =?utf-8?q?R+tNk/Q3pmkJa+wtTol0jpsb8EECrPmqDp04L7IlghXFpiC+QUhnMVMfW1nLBfnpr?= =?utf-8?q?dml8ZeeAjMPd3dxFXV3EkEU75r8voJ6nw2J7V8kX/lICXYHuHGqWm+h/Gh/TRInvC?= =?utf-8?q?mKF9EmAbE2LSYR5WKBdV6n9nrh/F2Epx/ePd2LafAHBLa29iv3pAs/4aUdvs32KD7?= =?utf-8?q?1yOzL52Kp2lJa7l/w5jsvTdOClvTXNEPmIoIEXXPoLo90mlYqsdrN8o09FeaNkpaR?= =?utf-8?q?paL4ZJIAqpbKWL6rYS6mRYe6dGDlsXiK8SgQgkQLQ6HzhJNM9kTJXSPxVeX/EEa/R?= =?utf-8?q?1OkKsGZI0O39KdsyUNCE359NyeMHW1M2WU0G1NFcMjM+QV2uMMnXoEFEyq3FFb+v9?= =?utf-8?q?7B0AowlvXdSZtX4P?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: af93107c-785f-428d-6c12-08d9874ac040 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 15:22:17.4481 (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: 4OV7+ajkjv9eeOw0NCwB3DUuea9fa+30TD6IbpHb04leWnMPnXYpBY/Nk7vHnfi5ft+Mz9NLQzCsO2DL26j7Iw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Cc: Daniel Baluta , guennadi.liakhovetski@linux.intel.com, alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, budliviu@gmail.com, yang.jie@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta This makes IMX use the newly introduced generic IPC ops instead of imx specific ones, and removes the old IMX ipc ops, as they are no longer needed. Signed-off-by: Daniel Baluta Signed-off-by: Bud Liviu-Alexandru Reviewed-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi --- sound/soc/sof/imx/imx8.c | 31 ++++++++++++------------------- sound/soc/sof/imx/imx8m.c | 22 +++++----------------- 2 files changed, 17 insertions(+), 36 deletions(-) diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c index 75baa5209a89..dd59a74480d6 100644 --- a/sound/soc/sof/imx/imx8.c +++ b/sound/soc/sof/imx/imx8.c @@ -376,21 +376,6 @@ static int imx8_get_bar_index(struct snd_sof_dev *sdev, u32 type) } } -static int imx8_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - void *p, size_t sz) -{ - sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); - return 0; -} - -static int imx8_ipc_pcm_params(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - const struct sof_ipc_pcm_params_reply *reply) -{ - return 0; -} - static struct snd_soc_dai_driver imx8_dai[] = { { .name = "esai0", @@ -438,8 +423,8 @@ struct snd_sof_dsp_ops sof_imx8_ops = { .get_mailbox_offset = imx8_get_mailbox_offset, .get_window_offset = imx8_get_window_offset, - .ipc_msg_data = imx8_ipc_msg_data, - .ipc_pcm_params = imx8_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* module loading */ .load_module = snd_sof_parse_module_memcpy, @@ -451,6 +436,10 @@ struct snd_sof_dsp_ops sof_imx8_ops = { .dbg_dump = imx8_dump, .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, + /* stream callbacks */ + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, + /* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, @@ -489,8 +478,8 @@ struct snd_sof_dsp_ops sof_imx8x_ops = { .get_mailbox_offset = imx8_get_mailbox_offset, .get_window_offset = imx8_get_window_offset, - .ipc_msg_data = imx8_ipc_msg_data, - .ipc_pcm_params = imx8_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* module loading */ .load_module = snd_sof_parse_module_memcpy, @@ -502,6 +491,10 @@ struct snd_sof_dsp_ops sof_imx8x_ops = { .dbg_dump = imx8_dump, .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, + /* stream callbacks */ + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, + /* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, diff --git a/sound/soc/sof/imx/imx8m.c b/sound/soc/sof/imx/imx8m.c index c7d3d898d5a4..e4618980cf8b 100644 --- a/sound/soc/sof/imx/imx8m.c +++ b/sound/soc/sof/imx/imx8m.c @@ -239,21 +239,6 @@ static int imx8m_get_bar_index(struct snd_sof_dev *sdev, u32 type) } } -static int imx8m_ipc_msg_data(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - void *p, size_t sz) -{ - sof_mailbox_read(sdev, sdev->dsp_box.offset, p, sz); - return 0; -} - -static int imx8m_ipc_pcm_params(struct snd_sof_dev *sdev, - struct snd_pcm_substream *substream, - const struct sof_ipc_pcm_params_reply *reply) -{ - return 0; -} - static struct snd_soc_dai_driver imx8m_dai[] = { { .name = "sai1", @@ -301,8 +286,8 @@ struct snd_sof_dsp_ops sof_imx8m_ops = { .get_mailbox_offset = imx8m_get_mailbox_offset, .get_window_offset = imx8m_get_window_offset, - .ipc_msg_data = imx8m_ipc_msg_data, - .ipc_pcm_params = imx8m_ipc_pcm_params, + .ipc_msg_data = sof_ipc_msg_data, + .ipc_pcm_params = sof_ipc_pcm_params, /* module loading */ .load_module = snd_sof_parse_module_memcpy, @@ -314,6 +299,9 @@ struct snd_sof_dsp_ops sof_imx8m_ops = { .dbg_dump = imx8_dump, .debugfs_add_region_item = snd_sof_debugfs_add_region_item_iomem, + /* stream callbacks */ + .pcm_open = sof_stream_pcm_open, + .pcm_close = sof_stream_pcm_close, /* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, From patchwork Mon Oct 4 15:21:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12534297 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D3FDC433F5 for ; Mon, 4 Oct 2021 15:25:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 736586139E for ; Mon, 4 Oct 2021 15:25:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 736586139E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0C10116A3; Mon, 4 Oct 2021 17:24:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0C10116A3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1633361114; bh=STINnrrut8eDPfYPTWMApISfRSgE1O5c9Xruf4+fJPM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=swqwkslqRNsJ0aVdIGWrpJp2TBudbsxUEs7ns22T3KEeZdvMxkmPY/Zm3oDyYzkAw K/j7+5/bozeyXg5CiaheTNtaQQQLRfXSlVp9XIuYWKoqBSZwfOIIRwbu3zpJIyA8rb IbaPPpSgjaSxc3oHFVBhELr0TxK+6cg105sNir6k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4EC9DF8051C; Mon, 4 Oct 2021 17:22:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 731E4F80511; Mon, 4 Oct 2021 17:22:35 +0200 (CEST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130041.outbound.protection.outlook.com [40.107.13.41]) (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 80AC8F80171; Mon, 4 Oct 2021 17:22:26 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 80AC8F80171 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="UYQydg4g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTL2mIaZ7bGkyKMAOzEmHEJ6gFdC8iaXDYyAf2vY6Co1pPM/nudiRTRkFc9rJlfMmGZnum6YH1D9zSulEPQikA8YoHAbJH/ezoVI9zB/+h6UlTgyTYrTA9o7Xvkv1RRxaxEZRvLh/GH5J99kEpFVq706rkIsrlXmVxaSjMY+pFpOb7QZquONgTJWci1n2w6AXzEH3dt2jRGkO5/qCjkDbZ8heaGjP4TISvrs1/t5nWcBdoSJ9+mcWWC4j960N6fcmZEQR8T+p8EGbhtrC4TvMes0QIY26hs8jEJJsFfP7jJppSSzI5aUcF8slQiTXAuLDwnzm4AAcIhkQl3c4LKGOQ== 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=APVOE3kpIW7O/JU/PDptFUx6WJwkJ/iByM3ET1n+FNE=; b=GTZdQvjVFabg47uH+kCPGbOC1H3XAc0VckdY5LfKU7zPPXQqi7HZbdsQDuBhpYTJSuP9CJFXw7jNqUMJhNWukasUPUnZLMJsyEbGPt/RuMWeWTVeZk3+j0hOVejoMJbSkzNkpAHOVE5CcEx3kxV91vJytacV3klrhedRMK5JtlCn3IVJxTUGGVzHAvjhlyTJYNRPkFWovpfp418WunHJ7m0UAEYGvfIvViNyzpjFQpRr2HV6QnnxLRULHp53Gcjxqg3csvrzB/6MAhC4PN8inOB2DztZyhVPonRB65pMgGlQsiyDbTLZSU2IWBCeWshhiSUEstEYgAgHwHv8rjx8mw== 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=APVOE3kpIW7O/JU/PDptFUx6WJwkJ/iByM3ET1n+FNE=; b=UYQydg4gx04LGFW00UlDyk7Iggec1PWjxj4B1BVz7BnJHjhTKTcYDrVIhr+5vbDOWNUjkbv1sN1B8Cra714DfkzFKdXGHbq8ql1xoDsu5Sft2mUmrI37QpS5DPcghn0b0aUP9EHrzpxUI+LVxuq0DV96NV9NH5wvBjrSMoXB07o= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Mon, 4 Oct 2021 15:22:20 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::9968:6eca:45c5:8af4%7]) with mapi id 15.20.4544.026; Mon, 4 Oct 2021 15:22:20 +0000 From: Daniel Baluta To: broonie@kernel.org Subject: [PATCH 4/4] ASoC: SOF: Introduce fragment elapsed notification API Date: Mon, 4 Oct 2021 18:21:47 +0300 Message-Id: <20211004152147.1268978-5-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> References: <20211004152147.1268978-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (5.12.247.65) by VI1PR0801CA0068.eurprd08.prod.outlook.com (2603:10a6:800:7d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13 via Frontend Transport; Mon, 4 Oct 2021 15:22:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f2728263-af19-4f88-616c-08d9874ac0d9 X-MS-TrafficTypeDiagnostic: VI1PR04MB7069: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: amn2S082c0Vdv+GDE5n4r1w0vkcHW+WhYW7pmxXagrlM1yTSoMctR9PrW29rw6uqJizNn28i36tTMvmIw5ZxLBhyYfBpI1bWnIxMrjHLxPkvZ1TkBEj34LkMhfj/fIKF/Ifh1j+Cvgxw93pB07nWOfYwx0aOVtN3dwQT5k3GP789NqzKcFmeHamGE9DqZmmbPD64nXRi9jwCRadhAZshKMefgBjB2nBBcZArKwprSE1lRV8hKL8lvdEEK1fWPYXY/Fd5sfb/ZNo5CxeIthPVsIjDMDfgn1m1lzd/75debMO1vjgldGxKP+X5SndvG/E7TiNFNdaEwTECFE2I+BSRO22SmFz32MBdoHhNVvF0C5t+bwG4KHx0zleGfZQ5t+9DAdf/aP7PyJRzlMdd/kjXxUaBTJs+7kNBizPfcckUpSf/Qq2NSs1ySipNgSKGs5Q9O9dXCB9V4j0Dldm56xfssEWpXO01ygNBoEjFQnhzoLCjX8jAw1pmqNx7UsKitBd1MPSoy+c6y7VpXycoQ03bjp6+ldtlG1gztZhqKAanUXxK/3gDh18cMQMG9B8c6PCDhal7hLC3K3uiiqEwwnvvVfH3sv3Xm3fUJo2xnB7MmuUvo+FXmv7t/UVw9mSkgGhp/Hxjp+XFD/byJu6bOB5g5x66y7qhZ04gTtkkeYluwjbDgeitC/bDmHK/jk/kK2fgTKUkHFIOmUVAHtDu98fgJQ== 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:(4636009)(366004)(1076003)(186003)(8936002)(38350700002)(86362001)(38100700002)(5660300002)(2616005)(8676002)(956004)(2906002)(508600001)(26005)(6486002)(66476007)(52116002)(7416002)(66946007)(6512007)(6506007)(6916009)(44832011)(83380400001)(316002)(4326008)(66574015)(66556008)(54906003)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?SNFHtsNihLyDDoQnm90/Y5wMLHOg?= =?utf-8?q?vISP7ZCu4blFy9cwsTOoOLSSiHQXB23CB2VFHA8Rlb8ChogGiF+Y0pcLv8uWg9rfu?= =?utf-8?q?/Jfwn+n4TzHnWj4q9rQEISzMySmYoEDFF4a7JS6uDlwkA6LWhbp53U6qeSebjXXMm?= =?utf-8?q?5jJPsfbwANxhzFP/4RCIOuM8TWWEC0QTaq8wAsVc1kMbbIdhTsWxfWw0KrXrZ3KlX?= =?utf-8?q?31+NYpnodlDn92glNg5ncypr4gm5ZEBVsH8e70gnTiXwKwkvLuxlQHiZ07hJVL512?= =?utf-8?q?J5/CtKDjiDGJiX3RDDFm+HYDB8NLcaRtbDhGI+NpU71XEVg60nYAwiNOkFg/JeR3U?= =?utf-8?q?EG2fSrY0F7cl791tbmIJV+U77BCD+0TkeOEGKg4QfD5HmcALHC3h618jb4BTsFkeY?= =?utf-8?q?wwn3BwfsCoFaCR9+Ub18i4nfXUOcCl+wqOfuCY1Ex8ubV6CgGdOsRU+JTDuTnwtpm?= =?utf-8?q?oic1GFekSQwFbCbjp3C++x+awH9itbulSMdrf14mW0Q7ZAUWMvlKSMm2BGkdXLqFu?= =?utf-8?q?MSaXEDBRRfkBsu9OXcSk9DXBpLpEQ/+1PsWDpkUxwNr0na3zaoa+i3QO6HPIzQkdH?= =?utf-8?q?T/2oL0njIREjCtNJBpIfyEiqj63ybQz5VsJd6EhmaWiRzsqJRT1PVFUi2ztQmD97Z?= =?utf-8?q?izcCth808J/jZH0t/tepX6Xbn7ZY0RQh9wsSWUtGYFf0gIR3PjTzJuen4L8t2uhow?= =?utf-8?q?H8JZ0H1tuF6NP9a1fhYXPxfGV/7EQtwFcY0NIXbgVAzMjLkfAozwSckji9ORZfBvj?= =?utf-8?q?IR6MjwhzXj89GtSZKtpG0xzdS5/kFquWMHpAbPKUyof6mBXJeM1/XSL4zeDUwMt6t?= =?utf-8?q?HdUXk1oMFN18PtuNDRXm8c/4UIFqKqN6JiiAXqQ8rqQF0nsXApiwqO6QCH9+Wu+v0?= =?utf-8?q?yjsxrXuUDIuhN679vjGfYCslYnpaQl8MV4plYs2hFn/tUHe/XUMNTRrI/orpTNPBE?= =?utf-8?q?L9KbVVXT+Luk0+wJiDt9+w9pS/+2wbt+mpD5G8PcJTL1FnoVqM2nHKEYJ9bHtLq3j?= =?utf-8?q?AJD9W5ZhuBLi+M5M300NtRCU3XV+T0rmUeq/DdR2pH5OhhlHAc+kXkE4c+OWc60VP?= =?utf-8?q?6Y8KHyTQld0f1oBeerX2fC1pZcIsaObr2Bbspmf9C811dwzSWIMXtbVIvBhCD/S8r?= =?utf-8?q?1eE5WZ4RFCVopAM6lyCxfXtuNnSJsTFf28OGvTbMW7R1CeRcRbDrAICIXsRi97X6F?= =?utf-8?q?96rPy1j7qXyUsapQtcqEP1bHrSmg/RjI+iQtue8OuFaLGpNlLy3UPdgmtr4GanU/v?= =?utf-8?q?Eez/OaAr+h9SXagu?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f2728263-af19-4f88-616c-08d9874ac0d9 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2021 15:22:20.1826 (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: 9vTfEoY1pcIFe1Xq8qZJLfz0Ldw1CyqkWvZe+SdphBGtm0j95D7bbcYrlnuqyVno23bLCJbzcsOgufAjEBSZyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Cc: Daniel Baluta , guennadi.liakhovetski@linux.intel.com, alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com, budliviu@gmail.com, yang.jie@linux.intel.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, Paul Olaru , peter.ujfalusi@linux.intel.com, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Daniel Baluta This patch prepares the introduction of the compress API with SOF. After each fragment is accepted by the DSP we need to inform the userspace applications that they can send the next fragment. This is done via snd_compr_fragment_elapsed. Similar with the PCM case, in order to avoid sending an IPC before the previous IPC is handled we need to schedule a delayed work to call snd_compr_fragment_elapsed(). See snd_sof_pcm_period_elapsed. To sum up this patch offers the following API to SOF code: * snd_sof_compr_init_elapsed_work * snd_sof_compr_fragment_elapsed Note that implementation for compressed function is in a new file selected via CONFIG_SND_SOC_SOF_COMPRESS invisible config option. This option is automatically selected for platforms that support the compress interface. For now only i.MX8 platforms support this. For symmetry we introduce snd_sof_pcm_init_elapsed_work to setup the work struct for PCM case. Signed-off-by: Daniel Baluta Signed-off-by: Bud Liviu-Alexandru Reviewed-by: Pierre-Louis Bossart Reviewed-by: Paul Olaru Reviewed-by: Péter Ujfalusi --- sound/soc/sof/Kconfig | 4 +++ sound/soc/sof/Makefile | 1 + sound/soc/sof/compress.c | 51 +++++++++++++++++++++++++++++++++++++++ sound/soc/sof/imx/Kconfig | 2 ++ sound/soc/sof/ipc.c | 6 +++-- sound/soc/sof/pcm.c | 7 +++++- sound/soc/sof/sof-audio.h | 11 ++++++++- sound/soc/sof/topology.c | 6 +++-- 8 files changed, 82 insertions(+), 6 deletions(-) create mode 100644 sound/soc/sof/compress.c diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index 94d1a859fedc..6bb4db87af03 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -46,6 +46,10 @@ config SND_SOC_SOF_OF required to enable i.MX8 devices. Say Y if you need this option. If unsure select "N". +config SND_SOC_SOF_COMPRESS + tristate + select SND_SOC_COMPRESS + config SND_SOC_SOF_DEBUG_PROBES bool "SOF enable data probing" select SND_SOC_COMPRESS diff --git a/sound/soc/sof/Makefile b/sound/soc/sof/Makefile index c5b97c66a9f1..06e5f49f7ee8 100644 --- a/sound/soc/sof/Makefile +++ b/sound/soc/sof/Makefile @@ -4,6 +4,7 @@ snd-sof-objs := core.o ops.o loader.o ipc.o pcm.o pm.o debug.o topology.o\ control.o trace.o utils.o sof-audio.o stream-ipc.o snd-sof-$(CONFIG_SND_SOC_SOF_DEBUG_PROBES) += sof-probes.o +snd-sof-$(CONFIG_SND_SOC_SOF_COMPRESS) += compress.o snd-sof-pci-objs := sof-pci-dev.o snd-sof-acpi-objs := sof-acpi-dev.o diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c new file mode 100644 index 000000000000..01ca85f0b87f --- /dev/null +++ b/sound/soc/sof/compress.c @@ -0,0 +1,51 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// Copyright 2021 NXP +// +// Author: Daniel Baluta + +#include +#include +#include +#include "sof-audio.h" +#include "sof-priv.h" + +static void snd_sof_compr_fragment_elapsed_work(struct work_struct *work) +{ + struct snd_sof_pcm_stream *sps = + container_of(work, struct snd_sof_pcm_stream, + period_elapsed_work); + + snd_compr_fragment_elapsed(sps->cstream); +} + +void snd_sof_compr_init_elapsed_work(struct work_struct *work) +{ + INIT_WORK(work, snd_sof_compr_fragment_elapsed_work); +} + +/* + * sof compr fragment elapse, this could be called in irq thread context + */ +void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) +{ + struct snd_soc_component *component; + struct snd_soc_pcm_runtime *rtd; + struct snd_sof_pcm *spcm; + + if (!cstream) + return; + + rtd = cstream->private_data; + component = snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME); + + spcm = snd_sof_find_spcm_dai(component, rtd); + if (!spcm) { + dev_err(component->dev, + "fragment elapsed called for unknown stream!\n"); + return; + } + + /* use the same workqueue-based solution as for PCM, cf. snd_sof_pcm_elapsed */ + schedule_work(&spcm->stream[cstream->direction].period_elapsed_work); +} diff --git a/sound/soc/sof/imx/Kconfig b/sound/soc/sof/imx/Kconfig index 49d605cb09a5..34cf228c188f 100644 --- a/sound/soc/sof/imx/Kconfig +++ b/sound/soc/sof/imx/Kconfig @@ -38,6 +38,7 @@ config SND_SOC_SOF_IMX8 tristate select SND_SOC_SOF_IMX_COMMON select SND_SOC_SOF_XTENSA + select SND_SOC_SOF_COMPRESS help This option is not user-selectable but automagically handled by 'select' statements at a higher level. @@ -54,6 +55,7 @@ config SND_SOC_SOF_IMX8M tristate select SND_SOC_SOF_IMX_COMMON select SND_SOC_SOF_XTENSA + select SND_SOC_SOF_COMPRESS help This option is not user-selectable but automagically handled by 'select' statements at a higher level. diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 53593df95155..1efc2c395c54 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -539,8 +539,10 @@ static void ipc_period_elapsed(struct snd_sof_dev *sdev, u32 msg_id) memcpy(&stream->posn, &posn, sizeof(posn)); - /* only inform ALSA for period_wakeup mode */ - if (!stream->substream->runtime->no_period_wakeup) + if (spcm->pcm.compress) + snd_sof_compr_fragment_elapsed(stream->cstream); + else if (!stream->substream->runtime->no_period_wakeup) + /* only inform ALSA for period_wakeup mode */ snd_sof_pcm_period_elapsed(stream->substream); } diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 374df2dfa816..fa0bfcd2474e 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -57,7 +57,7 @@ static int sof_pcm_dsp_params(struct snd_sof_pcm *spcm, struct snd_pcm_substream /* * sof pcm period elapse work */ -void snd_sof_pcm_period_elapsed_work(struct work_struct *work) +static void snd_sof_pcm_period_elapsed_work(struct work_struct *work) { struct snd_sof_pcm_stream *sps = container_of(work, struct snd_sof_pcm_stream, @@ -66,6 +66,11 @@ void snd_sof_pcm_period_elapsed_work(struct work_struct *work) snd_pcm_period_elapsed(sps->substream); } +void snd_sof_pcm_init_elapsed_work(struct work_struct *work) +{ + INIT_WORK(work, snd_sof_pcm_period_elapsed_work); +} + /* * sof pcm period elapse, this could be called at irq thread context. */ diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 149b3dbcddd1..3f16611fbca7 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -36,6 +36,7 @@ struct snd_sof_pcm_stream { struct snd_dma_buffer page_table; struct sof_ipc_stream_posn posn; struct snd_pcm_substream *substream; + struct snd_compr_stream *cstream; struct work_struct period_elapsed_work; struct snd_soc_dapm_widget_list *list; /* list of connected DAPM widgets */ bool d0i3_compatible; /* DSP can be in D0I3 when this pcm is opened */ @@ -231,7 +232,15 @@ struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_soc_component *scomp, const struct sof_ipc_pipe_new *snd_sof_pipeline_find(struct snd_sof_dev *sdev, int pipeline_id); void snd_sof_pcm_period_elapsed(struct snd_pcm_substream *substream); -void snd_sof_pcm_period_elapsed_work(struct work_struct *work); +void snd_sof_pcm_init_elapsed_work(struct work_struct *work); + +#if IS_ENABLED(CONFIG_SND_SOC_SOF_COMPRESS) +void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream); +void snd_sof_compr_init_elapsed_work(struct work_struct *work); +#else +static inline void snd_sof_compr_fragment_elapsed(struct snd_compr_stream *cstream) { } +static inline void snd_sof_compr_init_elapsed_work(struct work_struct *work) { } +#endif /* * Mixer IPC diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 44d60081bc26..43bd2f18c1c2 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -2581,8 +2581,10 @@ static int sof_dai_load(struct snd_soc_component *scomp, int index, for_each_pcm_streams(stream) { spcm->stream[stream].comp_id = COMP_ID_UNASSIGNED; - INIT_WORK(&spcm->stream[stream].period_elapsed_work, - snd_sof_pcm_period_elapsed_work); + if (pcm->compress) + snd_sof_compr_init_elapsed_work(&spcm->stream[stream].period_elapsed_work); + else + snd_sof_pcm_init_elapsed_work(&spcm->stream[stream].period_elapsed_work); } spcm->pcm = *pcm;