From patchwork Thu Nov 18 10:07:42 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: 12626465 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 4A8C5C433EF for ; Thu, 18 Nov 2021 10:10:05 +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 74E0A6139F for ; Thu, 18 Nov 2021 10:10:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 74E0A6139F 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 D4D811899; Thu, 18 Nov 2021 11:09:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D4D811899 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230202; bh=R7QdvbemoHPxTVC3BAHaYtpmhOHWcWxkzyxaNftctrE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=iMptSWMiQZxXOpSrqxpDHlUUiN3k8XQBRR9UQag1chA6F4b45htR6naeY3Qps4i86 YVXp5RBYTWQjTzEe7URi+5vGvQL7eaz00s17/8fK/mADzFlc2cMh+VJuE+ozPiB834 MFldYXdWsK3MJJaTUKemc6GhFjQ0HDxLjCGMtVi4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EEF46F804EB; Thu, 18 Nov 2021 11:08:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5A89CF804EB; Thu, 18 Nov 2021 11:08:25 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 C502FF800FA for ; Thu, 18 Nov 2021 11:08:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C502FF800FA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="anS59bXq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=daJEghK/B1xdGVjo6xP2qMv3ujyu7bI69nCQ/EG9zW0PDp5+J2B3KgmdprhH8D0QP2icjRlys4t5eFfMHuW4SMo3iVuQHv7AY3AfMw9BJ+r8oMEQ3LIb54jd/RX2U2vnSY0ODacDrKa7zQRH5hJKkvzvmjlrC2CCaLTvyuaNbPn6fHBQt2Bx3kOmCV7tb7pH+PWUqFh9MB8JyIa1NyElvAdS0gD1lo00fqpYYXYcmbGIav2ukcISE7YThN78LCjHl3YnVPnX/Dpvoz/5lvqoqYtquvLgZs3hKMXy2neZ0GaJ3lVsjTxqHHRVl8Q0OOqBa6rmP9S4Czms4/5KNg8JxA== 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=tzBpeubrHaTfs7zw/gsEqVPBQvxYJ8CxPUEGkhsIObE=; b=MOWGKUyOCYNugvO+hbgHPJckuWy+5D5J5/GWpWHWSoNjyVdS15Pz90KHwah+pNuBvCxTaaQQ+jipKWz4Ro9COF41/aNvfQWZfNSB69u3Ulrr91WsIDE3D/QWSVPZ3kVooXxVi9epx8iUT+mumuQABZ3Ypoqh9XdU0otfSC7kBrkRNdmmHrwuVCyDeTBxQICl7kCNr0NV2mQ6dDBqguzBmT8/ZM4xMj/kRPSfF286sAd+2hlm09+gHMma4Bw9VlZbo7XobfhOo6gfXKWcGeUpJ3ybVTJLGpsDEPJOsrF6KMi8pFTwqGkQN3d8SZhWV5N4ZTWyAN1Ap1+4g5Yd9wwCxw== 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=tzBpeubrHaTfs7zw/gsEqVPBQvxYJ8CxPUEGkhsIObE=; b=anS59bXqsK/58S2OFATCVzrK8YnbK/N8FZapIDWvMftub6tw7ttk+ParG/oISKwK9mQzF8Mvbr+zELpJRVoD57aSvyjHqXSmpmsTbIsS9T1U+mR8OILKIXqOeWA1lJrqXMm9iIYljEfXp2DmxltGJ7Hka54r7GT4blqCjbIfLGo= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:10 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:10 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 1/8] ASoC: SOF: mediatek: Add mt8195 hardware support Date: Thu, 18 Nov 2021 12:07:42 +0200 Message-Id: <20211118100749.54628-2-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87604036-8ea0-48df-8d63-08d9aa7b5285 X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a5IH7dRKDCThjPHliOixhzsEAcluVMqTFFISFrFLf8FmmbDGgAZg7P9SV5MHNx6f4zdbe6Aqn/2EtgSLQk3DHhGZ7atK2fUKJCU21eHE8PnxgSVWpfBb4eSUUghXTZI/XofHXoLiShmuOdpj8Ba7BUI0maDaS6EVuik9R53uYRA6n+WvvS0yid5uYC5kYAkwuuC8TBX3fDDDrUdeSUs9NgZ7Ok7+Ob1SwCTIrPVgoAQHXDjHiVsZa2cSKRS2WMrj5U/K6TykPOAt+/qM1D/0h+mHCIoyvgrAX02j4l1R/NYpHb0cDHfrPFnPtKeIgKrfX1RYBmPLEODOXwTlDUTPQlvnL9EIgc+L8Ew5F4dPq/9a0bWUKktM86/Xvh69Q6vEXKNGu2l29nM9Jo5KHHIzkEJcC61XQ04MDcH3pIBx67vDY0xB/K7a6y3LemtBurImUseVRnVRNleE8e9Ra1S0Pl6lGXA6w6bx1HUT/KxwHsUWqHnoZWxX6BaLbKda4HqVVaHibC24JZtrgKVg/OUZja20+FAlIPjzn0w6iuCw0eb8TINUbbu+EO8gkMfj/GC6YA1FK61YoShxuIdoYha99uFsygi5/kSrhT2rozwTSBHy+LUNa6Li+SCsaWLM2OJ/8Q+u21uQcNTLauYafkOXqQ== 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)(186003)(30864003)(54906003)(8676002)(2616005)(4326008)(44832011)(86362001)(7416002)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(83380400001)(66946007)(66574015)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?RrSbFmp1fI/Bv00sqCiPlI5yabmg?= =?utf-8?q?TrO/puBN2Tk/9H8flfMXn5IEJf2s0lWsihAFLQrBRGpkSby+TDfeNn+pB9IWN18Lf?= =?utf-8?q?QTdurqjDHlQA61BPAUOAM5V84qu4/1FjiG6NN8QPa4cHBqqATuPGTrqr9Omye45Oz?= =?utf-8?q?5/bWkNdUbXctX3gAy2H3lp7tyh1QALOsKXCLJVwjLcBFFSeOsAZNnLXdX13hl3c11?= =?utf-8?q?E8q0fd0FUFZ+qv6CiQBoPM43AEukGKHPuNdGQuy6apRVXr4t/sPtG7WGH1sYBm2j+?= =?utf-8?q?COAZsck/k9EFQj7sRhZFDPoaXOpuFZW4WCk4HERMeM7CUPfwERmoY/sNy8FST32XR?= =?utf-8?q?BupxqkIHdnaJzA37v0sTMghAIZQa4lhn8Fwymbhl/HPdFbCIwWPKO0XeOWfnaiVzB?= =?utf-8?q?yx1NKQaz0EVE+KI4YoczFseK/mZlFKXUCBkaErgMsYn3lnXuDih5jgKS7PVvf8c6P?= =?utf-8?q?7QXTY7+ZtYiGfsdx988Uagzo15IBlMDlKH9AdsOvNjaGoWSL867stO6mW1XWgu4F/?= =?utf-8?q?oOkt0225C15NPGjPPOVrAUF2TGj++x3A9Jbg3/gUlq9jmPtc1AuYy1JvO9qtdDqVy?= =?utf-8?q?wGIjfJfx51+z/BIAsMobtRKFKYxW8Q3w4wkgFh+YxbDtdstmnaur/j9O6ntuVZgsa?= =?utf-8?q?h8WLPUTJTNYAg7OtYajDR/6YEmwd4uOv3qmTkDd8Es9gmhvYIqCZWPCZXn+Qi62sJ?= =?utf-8?q?NdzN5jOEIx/8/50bHuQKMyrwvNOoDnae64zk7VVvcfLkSeqWCvHaAgKPbYGkumWxR?= =?utf-8?q?XiIABIYgiqHz1n+vG492CGDRA3rCJPfXkAgJtmAuJXqWItCAf6JJd4Vs6r71DsuVH?= =?utf-8?q?M+Bu66OBK9ON146L8XID/eflhpwH9621Sqthm4BFxcayZtwxZLd0VMfNgkXR/KURF?= =?utf-8?q?iF7WFMEdRfKc6vMyZvSkmva5iqIry+Oj/kKlfRqDwqZTp1HDzLTTIVlWTfLroTHWc?= =?utf-8?q?gCLo2iW1AjsF0biTdk3n+0rx175v6acQFc6pnHNnqOt5Yt0/lojkUBXSZhIEpMGO4?= =?utf-8?q?Q1UOUCnH1wVvHEC0h50oaOISL6Sdker7tElYZ+ayKKRqpPMmpRrJir363E23nqWF7?= =?utf-8?q?nj8bG987cHrRBLOD+MhWocJdajwpcWrzuLmbtPe3g8PWzDi0hAm4IEH2XdjarXa5T?= =?utf-8?q?PBfktJDkwjGlnlT22QgVD+G58yWwzNVQg1cAVnzF1Auk4tnOuN13aNacdZ8Qq2PBi?= =?utf-8?q?CFUtOFu767fnzsVzohZnLzh1kFHKFqqL8NbvX2cyiMbP5sGKWFalpHvIeKUjYLCHh?= =?utf-8?q?HiVSToWQvB90vl3Oyr23xGF/uXH5OtsEP8qGMzzflKXhKBuggpkBeDvL8FUxm5aCD?= =?utf-8?q?YWyqowqzznipOTFXWgztuz9Ch47KDKb/CHz/5a+DvcJmcFV1e0AW7EIi9fZkexKNt?= =?utf-8?q?O/nLL5Pj2wyVCOSI5ZxFzQTnIZcjLebu6b5xKQ2yv4jnOjpCcC40M7rhtsct1XNSd?= =?utf-8?q?EHK3hlvwb2kCLfdw+PjxCj5guWV33+e8KmS7rqGiXZHOX1jRXmFEkkQBVKMXHPYHk?= =?utf-8?q?vDIrhkQzioAqIt77kXwGmy6Lv/s6EkCtH1WKBmugD1VQUWKC/FsUnDW+zviCe3KGd?= =?utf-8?q?JoN9wB1P3mDdFvs4R6igdYktyhjSZ6PsBQGatgj9jy81XapFEAsciw=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87604036-8ea0-48df-8d63-08d9aa7b5285 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:09.7616 (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: JcJuq/6FAMGrO8l1MfnHHROyTKW8gr8wjF7vKoBaylKJfl3HHsFsswihplezuH/Uaw8FZgtmw3OfVwmLn5V/8g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung This patch initialize to support SOF on Mediatek mt8195 platform. MT8195 has four Cortex A78 cores paired with four Cortex A55 cores. It also has Cadence HiFi-4 DSP single core. There are shared DRAM and mailbox interrupt between AP and DSP to use for IPC communication. Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/Kconfig | 1 + sound/soc/sof/Makefile | 1 + sound/soc/sof/mediatek/Kconfig | 33 +++ sound/soc/sof/mediatek/Makefile | 2 + sound/soc/sof/mediatek/adsp_helper.h | 49 ++++ sound/soc/sof/mediatek/mediatek-ops.h | 8 + sound/soc/sof/mediatek/mt8195/Makefile | 3 + sound/soc/sof/mediatek/mt8195/mt8195.c | 323 +++++++++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195.h | 155 ++++++++++++ 9 files changed, 575 insertions(+) create mode 100644 sound/soc/sof/mediatek/Kconfig create mode 100644 sound/soc/sof/mediatek/Makefile create mode 100644 sound/soc/sof/mediatek/adsp_helper.h create mode 100644 sound/soc/sof/mediatek/mediatek-ops.h create mode 100644 sound/soc/sof/mediatek/mt8195/Makefile create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195.h diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index 0e5473e899cd..b0cdabcfdde7 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -236,6 +236,7 @@ config SND_SOC_SOF_PROBE_WORK_QUEUE source "sound/soc/sof/amd/Kconfig" source "sound/soc/sof/imx/Kconfig" source "sound/soc/sof/intel/Kconfig" +source "sound/soc/sof/mediatek/Kconfig" source "sound/soc/sof/xtensa/Kconfig" endif diff --git a/sound/soc/sof/Makefile b/sound/soc/sof/Makefile index 81ad8cb666e3..964b429146be 100644 --- a/sound/soc/sof/Makefile +++ b/sound/soc/sof/Makefile @@ -24,3 +24,4 @@ obj-$(CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL) += intel/ obj-$(CONFIG_SND_SOC_SOF_IMX_TOPLEVEL) += imx/ obj-$(CONFIG_SND_SOC_SOF_AMD_TOPLEVEL) += amd/ obj-$(CONFIG_SND_SOC_SOF_XTENSA) += xtensa/ +obj-$(CONFIG_SND_SOC_SOF_MTK_TOPLEVEL) += mediatek/ diff --git a/sound/soc/sof/mediatek/Kconfig b/sound/soc/sof/mediatek/Kconfig new file mode 100644 index 000000000000..aeacf0e5bfbb --- /dev/null +++ b/sound/soc/sof/mediatek/Kconfig @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) + +config SND_SOC_SOF_MTK_TOPLEVEL + bool "SOF support for MTK audio DSPs" + depends on ARM64 || COMPILE_TEST + depends on SND_SOC_SOF_OF + help + This adds support for Sound Open Firmware for Mediatek platforms. + It is top level for all mediatek platforms. + Say Y if you have such a device. + If unsure select "N". + +if SND_SOC_SOF_MTK_TOPLEVEL +config SND_SOC_SOF_MTK_COMMON + tristate + select SND_SOC_SOF_OF_DEV + select SND_SOC_SOF + 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 + +config SND_SOC_SOF_MT8195 + tristate "SOF support for MT8195 audio DSP" + select SND_SOC_SOF_MTK_COMMON + help + This adds support for Sound Open Firmware for Mediatek platforms + using the mt8195 processors. + Say Y if you have such a device. + If unsure select "N". + +endif ## SND_SOC_SOF_MTK_TOPLEVEL diff --git a/sound/soc/sof/mediatek/Makefile b/sound/soc/sof/mediatek/Makefile new file mode 100644 index 000000000000..e8ec6da981de --- /dev/null +++ b/sound/soc/sof/mediatek/Makefile @@ -0,0 +1,2 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +obj-$(CONFIG_SND_SOC_SOF_MT8195) += mt8195/ diff --git a/sound/soc/sof/mediatek/adsp_helper.h b/sound/soc/sof/mediatek/adsp_helper.h new file mode 100644 index 000000000000..346953dd22db --- /dev/null +++ b/sound/soc/sof/mediatek/adsp_helper.h @@ -0,0 +1,49 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Copyright (c) 2021 MediaTek Corporation. All rights reserved. + */ + +#ifndef __MTK_ADSP_HELPER_H__ +#define __MTK_ADSP_HELPER_H__ + +/* + * Global important adsp data structure. + */ +#define DSP_MBOX_NUM 3 + +struct mtk_adsp_chip_info { + phys_addr_t pa_sram; + phys_addr_t pa_dram; /* adsp dram physical base */ + phys_addr_t pa_shared_dram; /* adsp dram physical base */ + phys_addr_t pa_cfgreg; + phys_addr_t pa_mboxreg[DSP_MBOX_NUM]; + u32 sramsize; + u32 dramsize; + u32 cfgregsize; + void __iomem *va_sram; /* corresponding to pa_sram */ + void __iomem *va_dram; /* corresponding to pa_dram */ + void __iomem *va_cfgreg; + void __iomem *va_mboxreg[DSP_MBOX_NUM]; + void __iomem *shared_sram; /* part of va_sram */ + void __iomem *shared_dram; /* part of va_dram */ + phys_addr_t adsp_bootup_addr; + int dram_offset; /*dram offset between system and dsp view*/ +}; + +struct adsp_priv { + struct device *dev; + struct snd_sof_dev *sdev; + + /* DSP IPC handler */ + struct mbox_controller *adsp_mbox; + + struct mtk_adsp_chip_info *adsp; + + u32 (*ap2adsp_addr)(u32 addr, void *data); + u32 (*adsp2ap_addr)(u32 addr, void *data); + + void *private_data; +}; + +#endif diff --git a/sound/soc/sof/mediatek/mediatek-ops.h b/sound/soc/sof/mediatek/mediatek-ops.h new file mode 100644 index 000000000000..e0ffa69ecb0c --- /dev/null +++ b/sound/soc/sof/mediatek/mediatek-ops.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ + +#ifndef __MEDIATEK_OPS_H__ +#define __MEDIATEK_OPS_H__ + +extern const struct snd_sof_dsp_ops sof_mt8195_ops; + +#endif diff --git a/sound/soc/sof/mediatek/mt8195/Makefile b/sound/soc/sof/mediatek/mt8195/Makefile new file mode 100644 index 000000000000..dd2b6e4affc9 --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +snd-sof-mt8195-objs := mt8195.o +obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c new file mode 100644 index 000000000000..966b8660e21c --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -0,0 +1,323 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// Copyright(c) 2021 Mediatek Inc. All rights reserved. +// +// Author: YC Hung +// + +/* + * Hardware interface for audio DSP on mt8195 + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include "../../ops.h" +#include "../../sof-audio.h" +#include "../adsp_helper.h" +#include "../mediatek-ops.h" +#include "mt8195.h" + +static int platform_parse_resource(struct platform_device *pdev, void *data) +{ + struct resource *mmio; + struct resource res; + struct device_node *mem_region; + struct device *dev = &pdev->dev; + struct mtk_adsp_chip_info *adsp = data; + int ret; + + mem_region = of_parse_phandle(dev->of_node, "memory-region", 0); + if (!mem_region) { + dev_err(dev, "no dma memory-region phandle\n"); + return -ENODEV; + } + + ret = of_address_to_resource(mem_region, 0, &res); + if (ret) { + dev_err(dev, "of_address_to_resource dma failed\n"); + return ret; + } + + dev_dbg(dev, "DMA pbase=0x%llx, size=0x%llx\n", + (phys_addr_t)res.start, resource_size(&res)); + + ret = of_reserved_mem_device_init(dev); + if (ret) { + dev_err(dev, "of_reserved_mem_device_init failed\n"); + return ret; + } + + mem_region = of_parse_phandle(dev->of_node, "memory-region", 1); + if (!mem_region) { + dev_err(dev, "no memory-region sysmem phandle\n"); + return -ENODEV; + } + + ret = of_address_to_resource(mem_region, 0, &res); + if (ret) { + dev_err(dev, "of_address_to_resource sysmem failed\n"); + return ret; + } + + adsp->pa_dram = (phys_addr_t)res.start; + adsp->dramsize = resource_size(&res); + if (adsp->pa_dram & DRAM_REMAP_MASK) { + dev_err(dev, "adsp memory(%#x) is not 4K-aligned\n", + (u32)adsp->pa_dram); + return -EINVAL; + } + + if (adsp->dramsize < TOTAL_SIZE_SHARED_DRAM_FROM_TAIL) { + dev_err(dev, "adsp memory(%#x) is not enough for share\n", + adsp->dramsize); + return -EINVAL; + } + + dev_dbg(dev, "dram pbase=%pa, dramsize=%#x\n", + &adsp->pa_dram, adsp->dramsize); + + /* Parse CFG base */ + mmio = platform_get_resource_byname(pdev, IORESOURCE_MEM, "cfg"); + if (!mmio) { + dev_err(dev, "no ADSP-CFG register resource\n"); + return -ENXIO; + } + /* remap for DSP register accessing */ + adsp->va_cfgreg = devm_ioremap_resource(dev, mmio); + if (IS_ERR(adsp->va_cfgreg)) + return PTR_ERR(adsp->va_cfgreg); + + adsp->pa_cfgreg = (phys_addr_t)mmio->start; + adsp->cfgregsize = resource_size(mmio); + + dev_dbg(dev, "cfgreg-vbase=%p, cfgregsize=%#x\n", + adsp->va_cfgreg, adsp->cfgregsize); + + /* Parse SRAM */ + mmio = platform_get_resource_byname(pdev, IORESOURCE_MEM, "sram"); + if (!mmio) { + dev_err(dev, "no SRAM resource\n"); + return -ENXIO; + } + + adsp->pa_sram = (phys_addr_t)mmio->start; + adsp->sramsize = resource_size(mmio); + if (adsp->sramsize < TOTAL_SIZE_SHARED_SRAM_FROM_TAIL) { + dev_err(dev, "adsp SRAM(%#x) is not enough for share\n", + adsp->sramsize); + return -EINVAL; + } + + dev_dbg(dev, "sram pbase=%pa,%#x\n", &adsp->pa_sram, adsp->sramsize); + + return ret; +} + +static int adsp_sram_power_on(struct device *dev, bool on) +{ + void __iomem *va_dspsysreg; + u32 srampool_con; + + va_dspsysreg = ioremap(ADSP_SRAM_POOL_CON, 0x4); + if (!va_dspsysreg) { + dev_err(dev, "failed to ioremap sram pool base %#x\n", + ADSP_SRAM_POOL_CON); + return -ENOMEM; + } + + srampool_con = readl(va_dspsysreg); + if (on) + writel(srampool_con & ~DSP_SRAM_POOL_PD_MASK, va_dspsysreg); + else + writel(srampool_con | DSP_SRAM_POOL_PD_MASK, va_dspsysreg); + + iounmap(va_dspsysreg); + return 0; +} + +/* Init the basic DSP DRAM address */ +static int adsp_memory_remap_init(struct device *dev, struct mtk_adsp_chip_info *adsp) +{ + void __iomem *vaddr_emi_map; + int offset; + + if (!adsp) + return -ENXIO; + + vaddr_emi_map = devm_ioremap(dev, DSP_EMI_MAP_ADDR, 0x4); + if (!vaddr_emi_map) { + dev_err(dev, "failed to ioremap emi map base %#x\n", + DSP_EMI_MAP_ADDR); + return -ENOMEM; + } + + offset = adsp->pa_dram - DRAM_PHYS_BASE_FROM_DSP_VIEW; + adsp->dram_offset = offset; + offset >>= DRAM_REMAP_SHIFT; + dev_dbg(dev, "adsp->pa_dram %llx, offset %#x\n", adsp->pa_dram, offset); + writel(offset, vaddr_emi_map); + if (offset != readl(vaddr_emi_map)) { + dev_err(dev, "write emi map fail : %#x\n", readl(vaddr_emi_map)); + return -EIO; + } + + return 0; +} + +static int adsp_shared_base_ioremap(struct platform_device *pdev, void *data) +{ + struct device *dev = &pdev->dev; + struct mtk_adsp_chip_info *adsp = data; + u32 shared_size; + + /* remap shared-dram base to be non-cachable */ + shared_size = TOTAL_SIZE_SHARED_DRAM_FROM_TAIL; + adsp->pa_shared_dram = adsp->pa_dram + adsp->dramsize - shared_size; + if (adsp->va_dram) { + adsp->shared_dram = adsp->va_dram + DSP_DRAM_SIZE - shared_size; + } else { + adsp->shared_dram = devm_ioremap(dev, adsp->pa_shared_dram, + shared_size); + if (!adsp->shared_dram) { + dev_err(dev, "ioremap failed for shared DRAM\n"); + return -ENOMEM; + } + } + dev_dbg(dev, "shared-dram vbase=%p, phy addr :%llx, size=%#x\n", + adsp->shared_dram, adsp->pa_shared_dram, shared_size); + + return 0; +} + +static int mt8195_dsp_probe(struct snd_sof_dev *sdev) +{ + struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); + struct adsp_priv *priv; + int ret; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + sdev->pdata->hw_pdata = priv; + priv->dev = sdev->dev; + priv->sdev = sdev; + + priv->adsp = devm_kzalloc(&pdev->dev, sizeof(struct mtk_adsp_chip_info), GFP_KERNEL); + if (!priv->adsp) + return -ENOMEM; + + ret = platform_parse_resource(pdev, priv->adsp); + if (ret) + return ret; + + ret = adsp_sram_power_on(sdev->dev, true); + if (ret) { + dev_err(sdev->dev, "adsp_sram_power_on fail!\n"); + return ret; + } + + ret = adsp_memory_remap_init(&pdev->dev, priv->adsp); + if (ret) { + dev_err(sdev->dev, "adsp_memory_remap_init fail!\n"); + goto err_adsp_sram_power_off; + } + + sdev->bar[SOF_FW_BLK_TYPE_IRAM] = devm_ioremap(sdev->dev, + priv->adsp->pa_sram, + priv->adsp->sramsize); + if (!sdev->bar[SOF_FW_BLK_TYPE_IRAM]) { + dev_err(sdev->dev, "failed to ioremap base %pa size %#x\n", + &priv->adsp->pa_sram, priv->adsp->sramsize); + ret = -EINVAL; + goto err_adsp_sram_power_off; + } + + sdev->bar[SOF_FW_BLK_TYPE_SRAM] = devm_ioremap_wc(sdev->dev, + priv->adsp->pa_dram, + priv->adsp->dramsize); + if (!sdev->bar[SOF_FW_BLK_TYPE_SRAM]) { + dev_err(sdev->dev, "failed to ioremap base %pa size %#x\n", + &priv->adsp->pa_dram, priv->adsp->dramsize); + ret = -EINVAL; + goto err_adsp_sram_power_off; + } + priv->adsp->va_dram = sdev->bar[SOF_FW_BLK_TYPE_SRAM]; + + ret = adsp_shared_base_ioremap(pdev, priv->adsp); + if (ret) { + dev_err(sdev->dev, "adsp_shared_base_ioremap fail!\n"); + goto err_adsp_sram_power_off; + } + + sdev->bar[DSP_REG_BAR] = priv->adsp->va_cfgreg; + sdev->bar[DSP_MBOX0_BAR] = priv->adsp->va_mboxreg[0]; + sdev->bar[DSP_MBOX1_BAR] = priv->adsp->va_mboxreg[1]; + sdev->bar[DSP_MBOX2_BAR] = priv->adsp->va_mboxreg[2]; + + sdev->mmio_bar = SOF_FW_BLK_TYPE_SRAM; + sdev->mailbox_bar = SOF_FW_BLK_TYPE_SRAM; + + return 0; + +err_adsp_sram_power_off: + adsp_sram_power_on(&pdev->dev, false); + + return ret; +} + +static int mt8195_dsp_remove(struct snd_sof_dev *sdev) +{ + struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); + + return adsp_sram_power_on(&pdev->dev, false); +} + +/* on mt8195 there is 1 to 1 match between type and BAR idx */ +static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type) +{ + return type; +} + +/* mt8195 ops */ +const struct snd_sof_dsp_ops sof_mt8195_ops = { + /* probe and remove */ + .probe = mt8195_dsp_probe, + .remove = mt8195_dsp_remove, + + /* Block IO */ + .block_read = sof_block_read, + .block_write = sof_block_write, + + /* Register IO */ + .write = sof_io_write, + .read = sof_io_read, + .write64 = sof_io_write64, + .read64 = sof_io_read64, + + /* misc */ + .get_bar_index = mt8195_get_bar_index, + + /* Firmware ops */ + .dsp_arch_ops = &sof_xtensa_arch_ops, + + /* ALSA HW info flags */ + .hw_info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_PAUSE | + SNDRV_PCM_INFO_NO_PERIOD_WAKEUP, +}; +EXPORT_SYMBOL(sof_mt8195_ops); + +MODULE_IMPORT_NS(SND_SOC_SOF_XTENSA); +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.h b/sound/soc/sof/mediatek/mt8195/mt8195.h new file mode 100644 index 000000000000..48cbbb5aacb5 --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/mt8195.h @@ -0,0 +1,155 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Copyright (c) 2021 MediaTek Corporation. All rights reserved. + * + * Header file for the mt8195 DSP register definition + */ + +#ifndef __MT8195_H +#define __MT8195_H + +struct mtk_adsp_chip_info; + +#define DSP_REG_BASE 0x10803000 +#define SCP_CFGREG_BASE 0x10724000 +#define DSP_SYSAO_BASE 0x1080C000 + +/***************************************************************************** + * R E G I S T E R TABLE + *****************************************************************************/ +#define DSP_JTAGMUX 0x0000 +#define DSP_ALTRESETVEC 0x0004 +#define DSP_PDEBUGDATA 0x0008 +#define DSP_PDEBUGBUS0 0x000c +#define PDEBUG_ENABLE BIT(0) +#define DSP_PDEBUGBUS1 0x0010 +#define DSP_PDEBUGINST 0x0014 +#define DSP_PDEBUGLS0STAT 0x0018 +#define DSP_PDEBUGLS1STAT 0x001c +#define DSP_PDEBUGPC 0x0020 +#define DSP_RESET_SW 0x0024 /*reset sw*/ +#define ADSP_BRESET_SW BIT(0) +#define ADSP_DRESET_SW BIT(1) +#define ADSP_RUNSTALL BIT(3) +#define STATVECTOR_SEL BIT(4) +#define DSP_PFAULTBUS 0x0028 +#define DSP_PFAULTINFO 0x002c +#define DSP_GPR00 0x0030 +#define DSP_GPR01 0x0034 +#define DSP_GPR02 0x0038 +#define DSP_GPR03 0x003c +#define DSP_GPR04 0x0040 +#define DSP_GPR05 0x0044 +#define DSP_GPR06 0x0048 +#define DSP_GPR07 0x004c +#define DSP_GPR08 0x0050 +#define DSP_GPR09 0x0054 +#define DSP_GPR0A 0x0058 +#define DSP_GPR0B 0x005c +#define DSP_GPR0C 0x0060 +#define DSP_GPR0D 0x0064 +#define DSP_GPR0E 0x0068 +#define DSP_GPR0F 0x006c +#define DSP_GPR10 0x0070 +#define DSP_GPR11 0x0074 +#define DSP_GPR12 0x0078 +#define DSP_GPR13 0x007c +#define DSP_GPR14 0x0080 +#define DSP_GPR15 0x0084 +#define DSP_GPR16 0x0088 +#define DSP_GPR17 0x008c +#define DSP_GPR18 0x0090 +#define DSP_GPR19 0x0094 +#define DSP_GPR1A 0x0098 +#define DSP_GPR1B 0x009c +#define DSP_GPR1C 0x00a0 +#define DSP_GPR1D 0x00a4 +#define DSP_GPR1E 0x00a8 +#define DSP_GPR1F 0x00ac +#define DSP_TCM_OFFSET 0x00b0 /* not used */ +#define DSP_DDR_OFFSET 0x00b4 /* not used */ +#define DSP_INTFDSP 0x00d0 +#define DSP_INTFDSP_CLR 0x00d4 +#define DSP_SRAM_PD_SW1 0x00d8 +#define DSP_SRAM_PD_SW2 0x00dc +#define DSP_OCD 0x00e0 +#define DSP_RG_DSP_IRQ_POL 0x00f0 /* not used */ +#define DSP_DSP_IRQ_EN 0x00f4 /* not used */ +#define DSP_DSP_IRQ_LEVEL 0x00f8 /* not used */ +#define DSP_DSP_IRQ_STATUS 0x00fc /* not used */ +#define DSP_RG_INT2CIRQ 0x0114 +#define DSP_RG_INT_POL_CTL0 0x0120 +#define DSP_RG_INT_EN_CTL0 0x0130 +#define DSP_RG_INT_LV_CTL0 0x0140 +#define DSP_RG_INT_STATUS0 0x0150 +#define DSP_PDEBUGSTATUS0 0x0200 +#define DSP_PDEBUGSTATUS1 0x0204 +#define DSP_PDEBUGSTATUS2 0x0208 +#define DSP_PDEBUGSTATUS3 0x020c +#define DSP_PDEBUGSTATUS4 0x0210 +#define DSP_PDEBUGSTATUS5 0x0214 +#define DSP_PDEBUGSTATUS6 0x0218 +#define DSP_PDEBUGSTATUS7 0x021c +#define DSP_DSP2PSRAM_PRIORITY 0x0220 /* not used */ +#define DSP_AUDIO_DSP2SPM_INT 0x0224 +#define DSP_AUDIO_DSP2SPM_INT_ACK 0x0228 +#define DSP_AUDIO_DSP_DEBUG_SEL 0x022C +#define DSP_AUDIO_DSP_EMI_BASE_ADDR 0x02E0 /* not used */ +#define DSP_AUDIO_DSP_SHARED_IRAM 0x02E4 +#define DSP_AUDIO_DSP_CKCTRL_P2P_CK_CON 0x02F0 +#define DSP_RG_SEMAPHORE00 0x0300 +#define DSP_RG_SEMAPHORE01 0x0304 +#define DSP_RG_SEMAPHORE02 0x0308 +#define DSP_RG_SEMAPHORE03 0x030C +#define DSP_RG_SEMAPHORE04 0x0310 +#define DSP_RG_SEMAPHORE05 0x0314 +#define DSP_RG_SEMAPHORE06 0x0318 +#define DSP_RG_SEMAPHORE07 0x031C +#define DSP_RESERVED_0 0x03F0 +#define DSP_RESERVED_1 0x03F4 + +/* dsp wdt */ +#define DSP_WDT_MODE 0x0400 + +/* dsp mbox */ +#define DSP_MBOX_IN_CMD 0x00 +#define DSP_MBOX_IN_CMD_CLR 0x04 +#define DSP_MBOX_OUT_CMD 0x1c +#define DSP_MBOX_OUT_CMD_CLR 0x20 +#define DSP_MBOX_IN_MSG0 0x08 +#define DSP_MBOX_IN_MSG1 0x0C +#define DSP_MBOX_OUT_MSG0 0x24 +#define DSP_MBOX_OUT_MSG1 0x28 + +/*dsp sys ao*/ +#define ADSP_SRAM_POOL_CON (DSP_SYSAO_BASE + 0x30) +#define DSP_SRAM_POOL_PD_MASK 0xf +#define DSP_EMI_MAP_ADDR (DSP_SYSAO_BASE + 0x81c) + +/* DSP memories */ +#define MBOX_OFFSET 0x800000 /* DRAM */ +#define MBOX_SIZE 0x1000 /* consistent with which in memory.h of sof fw */ +#define DSP_DRAM_SIZE 0x1000000 /* 16M */ + +#define DSP_REG_BAR 4 +#define DSP_MBOX0_BAR 5 +#define DSP_MBOX1_BAR 6 +#define DSP_MBOX2_BAR 7 + +#define TOTAL_SIZE_SHARED_SRAM_FROM_TAIL 0x0 + +#define SIZE_SHARED_DRAM_DL 0x40000 /*Shared buffer for Downlink*/ +#define SIZE_SHARED_DRAM_UL 0x40000 /*Shared buffer for Uplink*/ + +#define TOTAL_SIZE_SHARED_DRAM_FROM_TAIL \ + (SIZE_SHARED_DRAM_DL + SIZE_SHARED_DRAM_UL) + +#define SRAM_PHYS_BASE_FROM_DSP_VIEW 0x40000000 /* MT8195 DSP view */ +#define DRAM_PHYS_BASE_FROM_DSP_VIEW 0x60000000 /* MT8195 DSP view */ + +/*remap dram between AP and DSP view, 4KB aligned*/ +#define DRAM_REMAP_SHIFT 12 +#define DRAM_REMAP_MASK (BIT(DRAM_REMAP_SHIFT) - 1) + +#endif From patchwork Thu Nov 18 10:07:43 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: 12626467 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 07A91C433F5 for ; Thu, 18 Nov 2021 10:10:17 +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 4F03F6139F for ; Thu, 18 Nov 2021 10:10:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4F03F6139F 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 AED7018B2; Thu, 18 Nov 2021 11:09:24 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AED7018B2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230214; bh=n46SpkoqjGTyC9qvu/jXeUwAMeZ+dak52xc6LV7soec=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=n5+HofQHVcuPWkmC+8YCwjU7oRZzVJ1l5vcHvKTaegFQ5zVEyULNMzP/gzKwGHSls ew/vBsZRsxJGxnE+Rv99kTH5ptutelihQrb/VMtwMYxx47mPhBxY+Q712v0cslFlGz PPTC4pvotbOdOjycDqT8CPsPSt3AjOZIgTXsgbIY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A4AE0F802C4; Thu, 18 Nov 2021 11:08:32 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5B45EF804FF; Thu, 18 Nov 2021 11:08:31 +0100 (CET) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2040.outbound.protection.outlook.com [40.107.22.40]) (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 1AECCF8026D for ; Thu, 18 Nov 2021 11:08:13 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1AECCF8026D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="hJryKLPe" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O+cEOq8DznssYAFhioeGDWDr/AzR0C8ja+iqOY0NS6mj9U+BrOY0da6Fa5leaYgHSAlWtOsYxlBPaMHMT+eocRrl0XDEarCJv9tJjtEw+VR7lVvGZ1IVFeJVO5xcd88T3/3vD4opRhWLyG9HOiV8f4Ldom0sh1J1aGcM3l+1Qm8Z2iDXXPfK9QmHU7OOqqIMHp7/Hb4baO3cEA2bJlg7qbpYSbrPsywHTg/qNJXPLtT1urIBgyne3aYeEkj60rYMP/Asvu4UIokd/V0/5ayuPLza/sxO/2V3vjw23aEBCqOMyC0lwDJZZFuR5Jv2Dlgk/hCFUbiRTClilZmpubCO1A== 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=K/TcaXutvCfzOqQoZbUtGznDhLVWnllTNgKTJn+BGJg=; b=b6hgKOcg97CtyqlN57HtBkESq3iFCH8QQ4cjDB+E9XY/fONuqmNm+xrTt5iAnn0zrsKJ/hZ+Vzecjs+wKqW9ktoN/f9ICK9dwIPH8ww6lZ83wlz1pNfMK4AGzxZXf8n7PSbdrnNbKUHss0C5MJlv6I2ElPF8KocMRqMOsbMmei/8ZyLh2is5TqA2Dev2H02s8Uf/2BZARJMaeKyEkyp6LQrEDQb0EEMglMbjmOYLbE1YNjsbkiBQWUYK+qi7dhV6jLz+OFRwq2uvD1M+ipbWFWx7Mx4ZJxk+vinYVJGN1VLaeV4uTAI2FDpLH3FlARj/vMkjFrYe7OFKmdPQDSXrqA== 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=K/TcaXutvCfzOqQoZbUtGznDhLVWnllTNgKTJn+BGJg=; b=hJryKLPeBm2/vvtqCvXYyPJ5GRf/4i0dBJE1RlZPQl5vhn8Dhi0xvUD10S+JdC8Sg8x/KsCz/bph6U+pj6Zy1hCqVhLc86k9m95bVQRq5NVVEfJj0dryYRZXGcAO0Td17/G9kn8jf3SswDKTNHLlD6U3JJOjS1FMM71ki8c7UGk= 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 VI1PR0401MB2429.eurprd04.prod.outlook.com (2603:10a6:800:2c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.21; Thu, 18 Nov 2021 10:08:11 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:11 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 2/8] ASoC: SOF: tokens: add token for Mediatek AFE Date: Thu, 18 Nov 2021 12:07:43 +0200 Message-Id: <20211118100749.54628-3-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:10 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fd8090af-0a46-48df-afbc-08d9aa7b53c1 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2429: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2449; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5lX5Ki7YIKPVgjB1/Jue1MM7P+/SYl9cBDST0yD6zkxiBtI8eKV/ibzw5671k9xMnuRZGJWfUN3SyDR6CHvsILNE5+pjuXMEQqOh97BfFE/D6xERNHSmr+qBBB/XOqkuiWmXbr0xCylDPcqLNdTJPADYhixb30wM0bpFFFCGDT2+9IZN0eBcMutPKemYBXqi87BMHZHBKN/DEh6NZmhXt2raLjoLXC+/wLuraUEKNB24oo3R+zN4RgihIkG4PtoU6ZkXAE3mOYs0uYwLxw5K0ZuWCqwPoEAx9NyM3DY3vvCeVNBmXui98/fS4UxosvrrsivNk6fDowpEQFxwq7stFRnoiLdThK9Uz5qX/Am4zHXW+ZkRpCe6Qwd6ChqrNHd8/lO24/8LQBGAMoSmQ4S+VkApQGFxnC0MrioPaMJGjQ4yELU/5exG4EX9WnHiwr3koWDSdvAVZ0JdH7TgNiZQBnvhFsEmuFuHoi4X1cLfR3H0vl7XEg2rq7uX+xAl0boy01/eCmZG0Ua7GoaRa82YhI1YnYYPc0GKOcGDIl6xRwhbTmbEToAtwBDQVYbsF4+ghTxhFFacym8fyVc//B8OU4wbvT/4O3FAiodzrNIh7ooAChiw30EhKNTZSvL53xoUBq+BJKfZ8oTZjhA57d2dEA== 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)(5660300002)(54906003)(316002)(6666004)(7416002)(52116002)(6486002)(4326008)(1076003)(8676002)(38100700002)(2906002)(44832011)(186003)(508600001)(2616005)(66946007)(6506007)(66476007)(8936002)(6512007)(86362001)(66556008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Fma8r53+M0YrvRX7W7+vyyYIra7n?= =?utf-8?q?gRAraYt+FthKwG6Z6wOcjQyf+TUWLqeJvs2ZE7gBElQYCFGCUTVDHcV/A9SqSrEou?= =?utf-8?q?hhGapJUu/9rmmwEK5/K6scTyQUorJ4QuGivVEg7eQI1God+nUACkYMrdA64tNhiNV?= =?utf-8?q?cIZwJ0mmqNYMMH+qmnDgNYcgmb1zsI/MYftM9uI2kDjqVH3N0FvZIWJqy3iFe26L6?= =?utf-8?q?Rzi6H85XqxwAcAMGo1z5PMScILF2RWBHj4NjHd8+cFMtKjDI+wberut9W6Ysp6PFd?= =?utf-8?q?T0SETOvvcdjtX7Tz0gmf7d905YmF4nU8TAXmcQlieVqczTsoqw2nhRVjEBt1gfd6+?= =?utf-8?q?UPQyUrGbeTFOeQTif5Ncbq0WNrKBkt1VF5ZFtMCagTXJ3hoHgppd0fqvRBVb169RN?= =?utf-8?q?YhbjOEQMoKGZR/+VlXM5RE0yvPY7guehi7POTC4aCXCLtC+ksjjRCbLyYdd0/nsHF?= =?utf-8?q?algwVtHk9fPG+HAlVnwJTIWADNiwVpBEyhSa9M7/JvGzdSbYHA9cEtpGWTIC2GV8a?= =?utf-8?q?F3vJBc0IUKPLU4n60nOnu3a9LBaSdsZDTos/AiZnQFPrrr7/ZTEVTV/Ff39ayt3yC?= =?utf-8?q?b8rP9posjxRtw3LbELZCCv7Pt3ipuetTWB5wvCzCLIc3weoB4yhQGM0O3TGrcts0I?= =?utf-8?q?pHyQLxAnuCal10mX2zvRx5OWlTmr0ZqX01Zb9Q++itHbqulm+WSXuIaX4rx9oW/v1?= =?utf-8?q?vlFtfeiQnU2gy8ODUAApREawJAA0XIFDRbjAVIR58gXZwx/UCMKPYeElb07aUYOzb?= =?utf-8?q?QmEUNps+CdN34sEOsWY75yYAtBM9EnQApaosMCFyiKf5OEejdP2u/QKKC4lyeCGGP?= =?utf-8?q?UjxErA0i7oqV7IjDdnpIWVEhKhRGQmVi/E5zb9BO7ZTTP981d4HifthhYb1GBYgEv?= =?utf-8?q?8IB0S7mVm+SDgoZMs3F/I7rHle42ovD1/7uX7BAmUjlWfl2bgmaB5o2vH7N3GRRSV?= =?utf-8?q?y+hoRyHufgPYEIp1nsYNZpYZ9k0jgM+bcoACiz1HYQ9X/Gqn0KPx+qnX2kqkEMRTy?= =?utf-8?q?sVeZAapJdzxrRHijjExMWp5A8w8o9GAPtpdbevZFFTEDFa0/shMLIusfu3xhzEXvp?= =?utf-8?q?s+MayodIyi5WssgYOVA+lQcaMGgr38iQgZH2+BeztFvW6Zt1e2D44AwkI47c26cRP?= =?utf-8?q?MjvoLqzWgJdurx1cyEYQFXc0SLDd7Be4HxLpyWyB1eGN8EN+woIM/gbvqbYNHFwsX?= =?utf-8?q?RWSuTfk4djoaHE4csedVKa+HtsY8nUEP2mXAIvRXi4qIhpnHy3hB5yvujRKdSlf86?= =?utf-8?q?HQ0Xeg19p1CUlpEvP+d9KjcwEGLVD7IxSQ38qaVQ9kZNh/ywKQMWixrorl5RO122o?= =?utf-8?q?pMFNeTG3+bFs/+MsxyfC9QmU3R0yYK3wlQXg8HdZ0DFEcb9k9C3fDdSRdYud+VceJ?= =?utf-8?q?lnSF4Z1DkGelblyhLsOEuIqtMzDeTuSXa4JarSKMcR9ebF0rse9o9kSSD1FSsWUA0?= =?utf-8?q?yNp+ATa6zZWIJ29o2U1wRR0Ux0HnCdtP9tGF6OLousL6FBIHBLGLu/bA12Wrw+QEP?= =?utf-8?q?02D4uu56pHErLpfkL6akVgCEoQ29T59SLs/0TXWh3Ek+qZVNFD8iHCXx8T9sOHjWL?= =?utf-8?q?YicysQjIxf7Kz+eyoP0K1wnPm9Zv7LlyjBhkL1TYp3o4d3849uZ7Do=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd8090af-0a46-48df-afbc-08d9aa7b53c1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:11.4806 (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: 46HsWQxwmIy3KFKOmcdVN+rHKKCn7D7fUIoLMcRmGjUyUQ6OrVJGWS2yFkcU7WQagMeomVsaIZhcRW0a1E4Tyw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2429 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add the definition for Mediatek audio front end(AFE) tokens,include AFE sampling rate, channels, and format. Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- include/uapi/sound/sof/tokens.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/uapi/sound/sof/tokens.h b/include/uapi/sound/sof/tokens.h index 02b71a8deea4..b72fa385bebf 100644 --- a/include/uapi/sound/sof/tokens.h +++ b/include/uapi/sound/sof/tokens.h @@ -140,4 +140,9 @@ #define SOF_TKN_INTEL_HDA_RATE 1500 #define SOF_TKN_INTEL_HDA_CH 1501 +/* AFE */ +#define SOF_TKN_MEDIATEK_AFE_RATE 1600 +#define SOF_TKN_MEDIATEK_AFE_CH 1601 +#define SOF_TKN_MEDIATEK_AFE_FORMAT 1602 + #endif From patchwork Thu Nov 18 10:07: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: 12626471 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 03CE7C433F5 for ; Thu, 18 Nov 2021 10:11:00 +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 825B661B29 for ; Thu, 18 Nov 2021 10:10:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 825B661B29 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 E9CD318C1; Thu, 18 Nov 2021 11:10:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E9CD318C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230258; bh=s27WKQAzY76Gi67Cd9Uo7yOykv1oZbEFy7cbeF4S8B8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=rQ3/5adwl+LmoeX9ObgesZsYuBTtka8TBt2ODa9yAIOecKx7hlvd83/S04pppT892 6GY25uTDxgpNYtW5M3zmInj6YNUSokujfWjUfFZhvdm+XRUQj3KF9bEyAi1RDoLzJl URBki1NoEqsrIRgXpzMLr6erVypzllF65VOM1lhE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C9864F80506; Thu, 18 Nov 2021 11:08:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 088C0F804FE; Thu, 18 Nov 2021 11:08:32 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 0B139F80272 for ; Thu, 18 Nov 2021 11:08:20 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0B139F80272 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="iTkZuRmp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cKBCBPU0r/NTHkzP9DRyIB0XSFE8vXvkLVs2O9kfbnWAEHM1vsKHmKdRk8QemoUx9M58YdrXZ8LNqVmHZ3ltwRbQErvXLcm+5q0R43+THmWvcQYjFeoH2+wQYukjApeSSAlTmvGtBGozTguPQb2Qwhg17ekQiu1mAuNccMXH+1x+UyhfYyVAGRnhwI2DjD2EWAbjSiCnQfz0raI3ETm/iKgLd8CzpUAvZluE+oMENsqwQ8e55HylhHKnag051JL8jAmHX19n5idUQGQmOlbWkI7mA6X62W++FJNm4Ld+DyLfYK2aZW7yFtdQcc8gx48aIPd1TpSllw1Vx3DBuEWB/A== 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=lcbOQalXySIAbgXzXcklFelsLSCQ8XryxySoOXJvAdo=; b=B3dv/1mHTeJNt+XQuapJASGDbgCzZeSbXqzmHfD5PuI/eTCHIBwciuFsNnlH+x4oB2bFhZdce6HJvby6OSLsP8zkj4r8tPYorPc54mhO/FGbI2AcX1Ys+TFG1dKBBHMLBqAuLXT9pqugg8Ug3fu4Xq3Kx6XjdsOovTC9i9KygmgmXM/6+ktreL49DxoyBsNEvw056DE9fdeFsdHJq/dKpsFBNhAz4KNCNSji26+T654ZxldPDO6u8GW1Ek0D8mcjDfedLX+ucKZn1Lfx6J0M34dKn9oOj+i/D9hpv1Z+8iw11IaYjNkrwFB7DoQgB5Qx5ucp2hJfREEoq+/BBQhwrQ== 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=lcbOQalXySIAbgXzXcklFelsLSCQ8XryxySoOXJvAdo=; b=iTkZuRmpx0lH8YmuR2awohdmVz6mtnDduyQFkJDr4QeLljFldobpNqtv8I8Tk7YFXOL0uuI5yo98CzJZhr398tux54TDD5AaPJ1XA8H+FsByELQO9G0eKFr+Y7u520x3wmpaJCGG0xgtMX9RwGDkbSPjh2ojlq3PEdGBJarFz/M= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:13 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:13 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 3/8] ASoC: SOF: topology: Add support for Mediatek AFE DAI Date: Thu, 18 Nov 2021 12:07:44 +0200 Message-Id: <20211118100749.54628-4-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7d1d97e4-97f4-4dc8-329a-08d9aa7b54b0 X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:608; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aGD0ckE2eko+mChns2xRwfqscLNSXz1hDoRVt7zxxsNfkKRfDC5ae6MUSZzA+N+Ptl0GUhyE57wJrLtXH/iHAwH/Yw6H5r2t6iVhxhZCRVu/aPtDS7rTssI3yymf5vr/xk1ksMdBbybGqHAAQaev99bZTwnKR9HubDn4ggXWJOHJuOLdTGPlqlIllOtt32khaofzE/p+6OWXLdR96t40lRhpQ5WoWgSDQ7ZFiri+GXd3cADMspZk9Qmr9kesfimjVYFwIwdCrCgHxw8eRr7X8hWW3s5c2fYdH0Fa2enuGxVkubkrQ81QVAGX/kKOT2H6pkKP3Qv6icFlx0Uw/9e/DEcofeOOb22o1trNmRfaD4q0Q/4MvpVPWLcCX5NOHMdpLXmWq/m1Ehp4hji+tqOG6lGegv07vUHFUtKvTCa22bGsWWJLZFNqeRco6V+9IkovfGXsr0wh7nTKvfJne+OShnTw5r3aFL4c2/Ea0MhrpOFb0XVNU6EJsmltLT+vUr/sxuZ2GW1ighxZ+huozJFHlHXbqovSLD4t9eujbEXRcj/lWOoP+JRK/0LlHsNXyb+KdLHspzK6V9AiwkwXiPo6luEoTlA3wN76QYtFdANGCwLpxyXLGumyzF8H1F+Rbz1UnHnW/jrzvtsWumjaxGkfIA== 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)(186003)(54906003)(8676002)(2616005)(4326008)(44832011)(86362001)(7416002)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(66946007)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?UAfT8ZdyR2O7Vbj0wUwkLutRNtnH?= =?utf-8?q?i2RLyW/ntNdqgke6fn72RBK3/Ht9+OfRvNwufU5wYyjYbL5758YJMltYRPkVe2AWn?= =?utf-8?q?pOe441adJ1ig25i4WjU+w0oWxJXHqJY3rAW1ll75QgosnkUoSRfOths1LzXU84r07?= =?utf-8?q?0Aqte6fKl19KHHVkGl003TBNQb1uz7J1FhYWrmrY95xIXOAoFxA/RAI2G/9BEp9OL?= =?utf-8?q?7GLOSU8ysbxq4iuZoI10I53sOErQg1zYJH605YbGHd1IR7XEQleNZ/GMZ4vrVWFrb?= =?utf-8?q?Qdtj9NObjRd05JHr4aglhi9eZtA//ZDf2M99wjkz/v1Yv+5cLIxzRwWsWYEQyNi//?= =?utf-8?q?tDOT5JAgKBVd1Gcxcuwo/NDXpY7BOz6Y49XBOpCpvy2lV+LUr016UnATG+2BzgdFg?= =?utf-8?q?ZLChA4Ygbd2yl9WPvgrAHzZXa+z6X/cxh6k6uMuUmeyfNWTxij1PFoebr0/AjBnpi?= =?utf-8?q?/tmqDueZRyHsCMevL94DKnptnmjGAu9ilPERE5YZqZ4OWBWP7l6R6GtL8pDo7YTQ9?= =?utf-8?q?QmHaPHhX7j1ex/YsT3auSIADCh1BGgmmT1ISsxQ4qYXRwBBIXzGjLpJ7SQ/QjVYGm?= =?utf-8?q?w5EFRmlf0AkpARfz70KmCDS0+LB2MiNFnNvLJGTMjcU3AarqFMwpDU25KXLjrYBNC?= =?utf-8?q?BSsCdOmiyC9iKxpsXemIyIJOAkoLGtDI/jCbBUQP+FgA3xEty6UTgwp7GCgFhvhTs?= =?utf-8?q?U50uNd7FXl3NsxOx2nb0ZfMvZ5eLlAjVLw6+lZpOjVTOSH7HZWNztNaUen3HnhXDL?= =?utf-8?q?c6c1/f2FnzHXPAI2rTcNpDk/en5XD/Phgd8yKWhmkLc9AhDtN551eW1KlMOtuCg+K?= =?utf-8?q?DXp1Klc+YM07N9GnX2qpzQ86Iv/OGc11O22PA4RlTDp+vgPJoZk+x3GtjxMsD31zg?= =?utf-8?q?YVe38pgaAS+WCcssw/d8APM61aPQZk1FCBoQTIyEagfWy8MYK4oEIgz0jJBOjjZif?= =?utf-8?q?m+odVLKgGzuGVhJR2KzTGmGnUQe+zcMQpKV9/aZtnXzFXOvqvW4WZolOgim1Cl3ul?= =?utf-8?q?BPyBK4BfPkee7wS/xp+DHe6NuOh1Baiq0UnBHgVAuj+ZnnRU99QGD5tPgwjKtO4jF?= =?utf-8?q?pYM5afaE2XomtyjKkrC/IjvDbYzHEpJfWb2b5EG9kyOhkW1U7q4wFWWUsrm48H47N?= =?utf-8?q?2Y+HgzyVODdoj85FsLcoYaMXBJSVixv6lQIEB5RMDxrNufaTWSkSmxTk01OOID9jP?= =?utf-8?q?1xIvwFtgQXgGx1LMaiubhBWcNHpZ0Et1SheovRuAEnWIohXcIqMJrP9HCbI0cvUMT?= =?utf-8?q?OVeMKycBQ0vrpZU0Cp+X8vBhmw2T3fNwRXLKYG/h+ExROInsNptXQI9o6KNnjnXmU?= =?utf-8?q?39V7FAPgPuJEjCHqqxvghoK4SWnX5jun+5QSuN4I4ODITcadlYqwXwn1dktZqW83f?= =?utf-8?q?TX+yi/kFWZoGIMo+9j4ziYUPvRH0yPuo8oJQKHzi7m5hC41sll2cj3398twMcoV/Q?= =?utf-8?q?V4/31I+UH4v5W3OWgPta8Y26Hp/FFDTMqkqzyQA6e0IzKcbSLsm3t+Hn4zUBz9k+W?= =?utf-8?q?2U+jINmuTXykYe0pPNmGpol9aO1Ko/34onHrwrXmuJgil3PSFYCW/Oe3oIS0l6kHs?= =?utf-8?q?SuxpBuDKVSQtF1CI/Ppe0ddl0WcNhXFGVDypYE+rHWxpDsV6A7sP5E=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7d1d97e4-97f4-4dc8-329a-08d9aa7b54b0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:13.5764 (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: 64eiMknWr7u0SjoUbpDdOE4FsiArEX/tzl6l9CJXMjPpcvs9zL+rMdpCx2VVMGbccfmT3xWLTQsA/Swj/9T+lA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add new sof dai and config to pass topology file configuration to SOF firmware running on Mediatek platform DSP core. Add mediatek audio front end(AFE) to the list of supported sof_dais Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- include/sound/sof/dai-mediatek.h | 23 +++++++++++++ include/sound/sof/dai.h | 3 ++ sound/soc/sof/pcm.c | 12 +++++++ sound/soc/sof/topology.c | 59 ++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 include/sound/sof/dai-mediatek.h diff --git a/include/sound/sof/dai-mediatek.h b/include/sound/sof/dai-mediatek.h new file mode 100644 index 000000000000..62dd4720558d --- /dev/null +++ b/include/sound/sof/dai-mediatek.h @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* + * Copyright(c) 2021 Mediatek Corporation. All rights reserved. + * + * Author: Bo Pan + */ + +#ifndef __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__ +#define __INCLUDE_SOUND_SOF_DAI_MEDIATEK_H__ + +#include + +struct sof_ipc_dai_mtk_afe_params { + struct sof_ipc_hdr hdr; + u32 channels; + u32 rate; + u32 format; + u32 stream_id; + u32 reserved[4]; /* reserve for future */ +} __packed; + +#endif + diff --git a/include/sound/sof/dai.h b/include/sound/sof/dai.h index 3782127a7095..5132bc60f54b 100644 --- a/include/sound/sof/dai.h +++ b/include/sound/sof/dai.h @@ -13,6 +13,7 @@ #include #include #include +#include /* * DAI Configuration. @@ -70,6 +71,7 @@ enum sof_ipc_dai_type { SOF_DAI_AMD_BT, /**< AMD ACP BT*/ SOF_DAI_AMD_SP, /**< AMD ACP SP */ SOF_DAI_AMD_DMIC, /**< AMD ACP DMIC */ + SOF_DAI_MEDIATEK_AFE, /**< Mediatek AFE */ }; /* general purpose DAI configuration */ @@ -97,6 +99,7 @@ struct sof_ipc_dai_config { struct sof_ipc_dai_acp_params acpbt; struct sof_ipc_dai_acp_params acpsp; struct sof_ipc_dai_acp_params acpdmic; + struct sof_ipc_dai_mtk_afe_params afe; }; } __packed; diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 8d313c9862cb..31dd79b794f1 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -808,6 +808,18 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa channels->min = dai->dai_config->esai.tdm_slots; channels->max = dai->dai_config->esai.tdm_slots; + dev_dbg(component->dev, + "rate_min: %d rate_max: %d\n", rate->min, rate->max); + dev_dbg(component->dev, + "channels_min: %d channels_max: %d\n", + channels->min, channels->max); + break; + case SOF_DAI_MEDIATEK_AFE: + rate->min = dai->dai_config->afe.rate; + rate->max = dai->dai_config->afe.rate; + channels->min = dai->dai_config->afe.channels; + channels->max = dai->dai_config->afe.channels; + dev_dbg(component->dev, "rate_min: %d rate_max: %d\n", rate->min, rate->max); dev_dbg(component->dev, diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index 72e671c15a34..10caf2b1a33c 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -379,6 +379,7 @@ static const struct sof_dai_types sof_dais[] = { {"ACP", SOF_DAI_AMD_BT}, {"ACPSP", SOF_DAI_AMD_SP}, {"ACPDMIC", SOF_DAI_AMD_DMIC}, + {"AFE", SOF_DAI_MEDIATEK_AFE}, }; static enum sof_ipc_dai_type find_dai(const char *name) @@ -806,6 +807,19 @@ static const struct sof_topology_token led_tokens[] = { get_token_u32, offsetof(struct snd_sof_led_control, direction), 0}, }; +/* AFE */ +static const struct sof_topology_token afe_tokens[] = { + {SOF_TKN_MEDIATEK_AFE_RATE, + SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_mtk_afe_params, rate), 0}, + {SOF_TKN_MEDIATEK_AFE_CH, + SND_SOC_TPLG_TUPLE_TYPE_WORD, get_token_u32, + offsetof(struct sof_ipc_dai_mtk_afe_params, channels), 0}, + {SOF_TKN_MEDIATEK_AFE_FORMAT, + SND_SOC_TPLG_TUPLE_TYPE_STRING, get_token_comp_format, + offsetof(struct sof_ipc_dai_mtk_afe_params, format), 0}, +}; + static int sof_parse_uuid_tokens(struct snd_soc_component *scomp, void *object, const struct sof_topology_token *tokens, @@ -3091,6 +3105,48 @@ static int sof_link_acp_sp_load(struct snd_soc_component *scomp, int index, return ret; } +static int sof_link_afe_load(struct snd_soc_component *scomp, int index, + struct snd_soc_dai_link *link, + struct snd_soc_tplg_link_config *cfg, + struct snd_soc_tplg_hw_config *hw_config, + struct sof_ipc_dai_config *config) +{ + struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp); + struct snd_soc_tplg_private *private = &cfg->priv; + struct snd_soc_dai *dai; + u32 size = sizeof(*config); + int ret; + + config->hdr.size = size; + + /* get any bespoke DAI tokens */ + ret = sof_parse_tokens(scomp, &config->afe, afe_tokens, + ARRAY_SIZE(afe_tokens), private->array, + le32_to_cpu(private->size)); + if (ret != 0) { + dev_err(scomp->dev, "parse afe tokens failed %d\n", + le32_to_cpu(private->size)); + return ret; + } + + dev_dbg(scomp->dev, "AFE config rate %d channels %d format:%d\n", + config->afe.rate, config->afe.channels, config->afe.format); + + dai = snd_soc_find_dai(link->cpus); + if (!dai) { + dev_err(scomp->dev, "%s: failed to find dai %s", __func__, link->cpus->dai_name); + return -EINVAL; + } + + config->afe.stream_id = DMA_CHAN_INVALID; + + ret = sof_set_dai_config(sdev, size, link, config); + if (ret < 0) + dev_err(scomp->dev, "failed to process afe dai link %s", link->name); + + return ret; +} + static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, struct snd_soc_dai_link *link, struct snd_soc_tplg_link_config *cfg, @@ -3386,6 +3442,9 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, ret = sof_link_acp_dmic_load(scomp, index, link, cfg, hw_config + curr_conf, config); break; + case SOF_DAI_MEDIATEK_AFE: + ret = sof_link_afe_load(scomp, index, link, cfg, hw_config + curr_conf, config); + break; default: dev_err(scomp->dev, "error: invalid DAI type %d\n", common_config.type); ret = -EINVAL; From patchwork Thu Nov 18 10:07: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: 12626469 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 7D6A6C433EF for ; Thu, 18 Nov 2021 10:10:39 +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 F192861B04 for ; Thu, 18 Nov 2021 10:10:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F192861B04 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 5E71B18BD; Thu, 18 Nov 2021 11:09:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5E71B18BD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230237; bh=2QdkRpCXSOvLjy9qYWctd5aU1bLnryUw/8UeC/sulCk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hoWDYU2P/sEVEYKIPDS1BgVlIsZ/NYnvQTsFqvo4nSwpqRyxv2vw1YayEwvi2y6O7 B2zZYfI3cCQYiATfRcwp1bG0PyPdvtR0GnPU7tRxzxeQObhavZs+Wqi6yACEDHw10U vZXKnGQCNNEKob006aQp7NDKq0pdMuBUAt0Lb1SI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 089EDF804E7; Thu, 18 Nov 2021 11:08:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64281F804FD; Thu, 18 Nov 2021 11:08:31 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 3310AF802C4 for ; Thu, 18 Nov 2021 11:08:21 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3310AF802C4 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="XBNmYbat" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b1sDWguXVcB7Fa3Ojonzqw5sl6WDYcB/xmoDz9vCslq6XkHVxCsHQxHMd0QPMzFOgZUZoJMi54DmSkvhwtyau+vXBAmBFENpIaamvYspp3cf8eVFCRSh1s9f++vL2/jQtg2TsOjNWJt2a95HCwSbrN2fm2y351i4JA1T7qYFh6cTNf6v5vauZTJHvFm9mdrzeP5g09jteELvRtT2wnkdoOZz3td6axQ0UKJzkzhO0ug2KVoQDto7Ggj0HRergVRRbxTKceUbZH8mN+zWCbY5igoXXa5HztleuXoA9gc/aM9Fq+WF3tIS3i2Veh90z1swndQhpzBWnK1m16rSTNCaUQ== 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=rOwDMy3pCYOj2cKXYjxWmjMT9TIZXKzxthvh9HezVq4=; b=XpWT2jdqrjbFW8QM1F+ug3SwYerRMcp6Dlky1qgtNZnWJWTvoQSikeb91fdt+cDmf3pwlRTw+sJZgZ8ttJG8BaOPWggB+fmETdhCFCFt8rjnp0LTTcr4akxJNsvj5HQ5GagYPimzUO7zEwd5/flpuepHLIjml1TeWJvx14vn1dOaIM/9J9aRRZgQZreighVGccM3Wm1LAWxvB3DrMw6rMqOTDC6ZxwmKodlb1etxcDXmUzME0MqrgAMe2kSaZjHABEVoNxerfglbEoW6vcs8hvypBqQU8ZUYVfgcL4XxgmY+CAvtwEp5Xkjud6GLKYpya73VFyYXXBkgrxpyG3b+/w== 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=rOwDMy3pCYOj2cKXYjxWmjMT9TIZXKzxthvh9HezVq4=; b=XBNmYbat1SSNqAVhHgdEGOPiobLyfYlW95LFZw/wKnTR+gbMBfOG62XvTYW9y9uAQaB1BE25PCskVId4NWAmcsxKUL6le//ZwxkfgjdQICQWCeOJV2FaiNylrSQemZo3liVBdsfFnTFXwrNkdWuT0KTumJ4rYyuR32X9WAJu9uQ= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:16 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:16 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 4/8] ASoC: SOF: mediatek: Add fw loader and mt8195 dsp ops to load firmware Date: Thu, 18 Nov 2021 12:07:45 +0200 Message-Id: <20211118100749.54628-5-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1bb75a4a-b757-4e0b-f970-08d9aa7b55f1 X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 5+H3P4LzcZ0fASYmPQgjpzCOqo7gtx6LCzEHBL4jVoE4vN/W7r0pFN0ArWgugT9KXXfBBzuROAMtR8uAFd5ywODzwP+GDfEaDnfMoAljYOq3eFLXOH04o9NM5wcBC/EQ0Hf9H4t+xSsBhn0TQsJJqTf5cP05yJhKMrvngYpjGTaQdcW9Lrv6CoMHkO603xKGJsOfgj26OiHDh5575vPG3popYkVTveNxflWt1trqrxAgp/ayovfxXFUGfFdevZ1jVNVrDiZsD7EtFIyybiwuWkmdCZ6fqrRzwiymWYvVdAOD4MI0tingTXipArCW8ka2RRM7x4GSlbEfoEc3whT+055MgZNf5cG4WYTbKW2oT1NlMZC7JPT+Wb2913IW5y5rdknf9+/LZacH7o4MgKwFH4LWIEacFqagfHkD3JnJrCnRnaIC+CEvVNn+lW5J+5TSqtRl+3FjgHSJUsibzE50bDn+uLIqD8c5zYQHvYILZez+I6+o0NspnVTpPB2BlKVRcOmhzD4OSrtJgdCGE4LyYeln/6nIGItYyJ1SRgeofkrC/RHaP92hCnKYS56SmrjK4yQRUdg0v3y4EyPVoBv5NwLahatLbSUQL17rY77cghq9yMXZepRJlXgKcTR2bFz8qSJ5XjQf/ghTEhjkHQ5vNQ== 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)(186003)(54906003)(8676002)(2616005)(4326008)(44832011)(86362001)(7416002)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(83380400001)(66946007)(66574015)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?EDjLgNtzm0/J/jfCrjs4P/kipHuM?= =?utf-8?q?9uUQNYc9HnlBKxaVvEGpVpcxUPh8UCngKVS7l5bcoHabAV9zgvyXiB+V+SnDQlN68?= =?utf-8?q?zILLx3h2+T5o4ugqNRYz7A/GiLf6E9E/l0YX+HBOv6DoMsLTfyQzpQGjFyYLQu5E3?= =?utf-8?q?Tt+8atUO9PPn3DQQuJf91AuXyCuAa7jFJp1jHYq2dibNg1iqVL0wqlRZODyoHUU6j?= =?utf-8?q?y+aJ5b0wGsCu5n+j7NzRvO9JTqHTGQCVqXcjNvoVqClAwaKacx1i8kz7y45dBvr/9?= =?utf-8?q?6OnAaCpatWhzUW1czD0TKLT7TuQ8/VnI+CXDAEtvHOIMjzeDa2ka2UjHK3CYsZPXw?= =?utf-8?q?0o3UWNSVRieg/ZFoCcV5xKhWVf1kR7pnsFUHZukaBjN8B6gOO1uQYNLhC8AjmnJvE?= =?utf-8?q?gRUBT9mX9NCOvglWPFxJSGwxVxV8PocbY49TlTX2i1ftiHLw3BXaoVUETRhCNanvh?= =?utf-8?q?+eKuVft3RDG9FuYaiCaKdwEOED6+/pHiLri7AQ+RVVgcCxfjAZlDptDwzp95dZqjZ?= =?utf-8?q?TQz/YQ3sxFQemOJ+rGHPnigeXfr7j8fs5sMheVBNFWhWFu3mw+ownJVLabimh0BxV?= =?utf-8?q?Ktn/oAe/S9HDneKF2WS+uIKa9ndYvq5Altac7hF7vR3qyqZxpnDRBGe6Pf95TC6aP?= =?utf-8?q?iBwcSSJviYHK3332Ja8TT2caRIH87Ve/kbHtWxFgXP6kKih+nDelJlmLt/0xpagR+?= =?utf-8?q?9HmA9bi6XeCkgrDJSJmefpHJOrlEyUL/wqfsMcdUZu//hmEduoVfqMH4ZCQs1tn7u?= =?utf-8?q?DjX12+Kr8iGOYe9RYGsv5AnIA2jTkB/YyVZJn5JmxbG1qhQSHUpvhJnfZe5QXPvJC?= =?utf-8?q?4pRA5jG50SxHbz30SvYE6pkyNtqtdS1izuea1BaMYa2GVs1tfNQRVU1iNkH4jyZY7?= =?utf-8?q?yvWvSPk1DCnb/qgDcQZya5iq0hjrHWJb2FgUTFgXeAM6TV+SHSdJPA6Sh4mfykCUk?= =?utf-8?q?ta4ErU782oOcQjhQZnbBMafy+5qnqtw8A8WlRV42UDUoAAPLYtEo1rSkNVbf4wrEE?= =?utf-8?q?BmRy4XDaUCMQWBZXZRG/mOxD3kC0MQnEyGX8bRYuisG4bK4I8w/kuGGsshtW5LVox?= =?utf-8?q?9KCJdhiUIAY3xMoC6ICIOECjRJd5HqdhY4/dcwmWPHa6OWbpqiKhgyUiytSy+KD8/?= =?utf-8?q?Eq9vSRVTEcxKulC3fBKqKJIEcsJ/DxRXOyUEvYV7zNOA5cBvrvq03CX/mWvWkOfQu?= =?utf-8?q?InCSzpzMg019dO6ZA2N1fBMtwXux7obq/pKBIeHGG1FKjP7G2qA50DKAciUaQUjQ/?= =?utf-8?q?qxAxODzLjMOU4ZLwp7VSejnvnW35CsZmM7NKBduHHacLNz/Bxa8eMkGq6oK1S5ITm?= =?utf-8?q?EeK1K0bpodfrfbQXVTBUD4AAN1+ZOFWu446IBLEkaHhZOAPR+zuU7OrzOL4NGVIzw?= =?utf-8?q?KK0nBknj5H5fGAvyMpxIStzZmX8emnxkwpM967bHODJLHE1J394YMIUavUeY/F1kS?= =?utf-8?q?WHspMOzQsPrLoqKtKFakog5D+FpuqAY3jjf1aw6lQ9hOQ83VmtsmTaSuJLm6tmrsR?= =?utf-8?q?WwvLYi2z3aDBaqrEn7rc1Kcz8Yabbb1yQ49guNSF6LmG1nb6K7nW+whVdzzF1hElY?= =?utf-8?q?RIWByiThL7h6jlSYPiG1YrOg6PpgukDmpqlLDRa7fzfNDxfvqjhm0Y=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bb75a4a-b757-4e0b-f970-08d9aa7b55f1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:15.9910 (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: U1qCdBtU+0R9i/UufcCsvyE4Eg9KsYVfZ5OMCat0Mgm5cFdwQ9ydToLt5mEzIupE4Y4yUKukFhTogBPEG7sung== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add mt8195-loader module with ops callback to load and run firmware on mt8195 platform. Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/mediatek/mt8195/Makefile | 2 +- sound/soc/sof/mediatek/mt8195/mt8195-loader.c | 56 +++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195.c | 19 +++++++ sound/soc/sof/mediatek/mt8195/mt8195.h | 3 + 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-loader.c diff --git a/sound/soc/sof/mediatek/mt8195/Makefile b/sound/soc/sof/mediatek/mt8195/Makefile index dd2b6e4affc9..66cdc0e7bf3c 100644 --- a/sound/soc/sof/mediatek/mt8195/Makefile +++ b/sound/soc/sof/mediatek/mt8195/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8195-objs := mt8195.o +snd-sof-mt8195-objs := mt8195.o mt8195-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o diff --git a/sound/soc/sof/mediatek/mt8195/mt8195-loader.c b/sound/soc/sof/mediatek/mt8195/mt8195-loader.c new file mode 100644 index 000000000000..ed18d6379e92 --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/mt8195-loader.c @@ -0,0 +1,56 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// Copyright (c) 2021 Mediatek Corporation. All rights reserved. +// +// Author: YC Hung +// +// Hardware interface for mt8195 DSP code loader + +#include +#include "mt8195.h" +#include "../../ops.h" + +void sof_hifixdsp_boot_sequence(struct snd_sof_dev *sdev, u32 boot_addr) +{ + /* ADSP bootup base */ + snd_sof_dsp_write(sdev, DSP_REG_BAR, DSP_ALTRESETVEC, boot_addr); + + /* pull high RunStall (set bit3 to 1) */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + ADSP_RUNSTALL, ADSP_RUNSTALL); + + /* pull high StatVectorSel to use AltResetVec (set bit4 to 1) */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + DSP_RESET_SW, DSP_RESET_SW); + + /* toggle DReset & BReset */ + /* pull high DReset & BReset */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + ADSP_BRESET_SW | ADSP_DRESET_SW, + ADSP_BRESET_SW | ADSP_DRESET_SW); + + /* pull low DReset & BReset */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + ADSP_BRESET_SW | ADSP_DRESET_SW, + 0); + + /* Enable PDebug */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_PDEBUGBUS0, + PDEBUG_ENABLE, + PDEBUG_ENABLE); + + /* release RunStall (set bit3 to 0) */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + ADSP_RUNSTALL, 0); +} + +void sof_hifixdsp_shutdown(struct snd_sof_dev *sdev) +{ + /* Clear to 0 firstly */ + snd_sof_dsp_write(sdev, DSP_REG_BAR, DSP_RESET_SW, 0x0); + + /* RUN_STALL pull high again to reset */ + snd_sof_dsp_update_bits(sdev, DSP_REG_BAR, DSP_RESET_SW, + ADSP_RUNSTALL, ADSP_RUNSTALL); +} + diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 966b8660e21c..88da6c2de070 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -198,6 +198,17 @@ static int adsp_shared_base_ioremap(struct platform_device *pdev, void *data) return 0; } +static int mt8195_run(struct snd_sof_dev *sdev) +{ + u32 adsp_bootup_addr; + + adsp_bootup_addr = SRAM_PHYS_BASE_FROM_DSP_VIEW; + dev_dbg(sdev->dev, "HIFIxDSP boot from base : 0x%08X\n", adsp_bootup_addr); + sof_hifixdsp_boot_sequence(sdev, adsp_bootup_addr); + + return 0; +} + static int mt8195_dsp_probe(struct snd_sof_dev *sdev) { struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); @@ -294,6 +305,9 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { .probe = mt8195_dsp_probe, .remove = mt8195_dsp_remove, + /* DSP core boot */ + .run = mt8195_run, + /* Block IO */ .block_read = sof_block_read, .block_write = sof_block_write, @@ -307,6 +321,11 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { /* misc */ .get_bar_index = mt8195_get_bar_index, + /* module loading */ + .load_module = snd_sof_parse_module_memcpy, + /* firmware loading */ + .load_firmware = snd_sof_load_firmware_memcpy, + /* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.h b/sound/soc/sof/mediatek/mt8195/mt8195.h index 48cbbb5aacb5..929424182357 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.h +++ b/sound/soc/sof/mediatek/mt8195/mt8195.h @@ -10,6 +10,7 @@ #define __MT8195_H struct mtk_adsp_chip_info; +struct snd_sof_dev; #define DSP_REG_BASE 0x10803000 #define SCP_CFGREG_BASE 0x10724000 @@ -152,4 +153,6 @@ struct mtk_adsp_chip_info; #define DRAM_REMAP_SHIFT 12 #define DRAM_REMAP_MASK (BIT(DRAM_REMAP_SHIFT) - 1) +void sof_hifixdsp_boot_sequence(struct snd_sof_dev *sdev, u32 boot_addr); +void sof_hifixdsp_shutdown(struct snd_sof_dev *sdev); #endif From patchwork Thu Nov 18 10:07: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: 12626473 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 8A963C433EF for ; Thu, 18 Nov 2021 10:11:30 +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 0D40561ABD for ; Thu, 18 Nov 2021 10:11:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0D40561ABD 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 D748218A9; Thu, 18 Nov 2021 11:10:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D748218A9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230287; bh=zQbXvfYFyhIYzlOkKhAzmdkOkOeGPEY8V059DXnt+5Y=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=luqvFPHwMVrhNwylxxFRazQD+FIoXyJwjAwzWHCQsIXVukERImFn02IZ6PAi6wmli e8KggfwSlhH5G6hvTLA0tgpa8LmFmqzB59Z2BrghwdUNhD0flplpz9yYBzxnE7HEvV vhrpjLak3r7mzQkZO/L93oV6UhxbkhsNGlw2qhys= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 27D5DF80519; Thu, 18 Nov 2021 11:08:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 40AD4F804FD; Thu, 18 Nov 2021 11:08:33 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 6F554F8010B for ; Thu, 18 Nov 2021 11:08:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6F554F8010B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="RSaVGktF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lrg5YO3U9LqWq3NXyhOMMQziaIh5SwdQpaPWY6gN+ogiPqb+ssadqAg5XAjUMFn9Ee8hAob3c5Wy9Z4EnVYxBC8DpYmBImXCxk6i9I+wzn6wPgaVuWg+NXW//WFCyBq0T3tdlCqCt5V1JdMgYM/TF/lWpq/pAjMKcMYMIXgOZq6bUMVH8buQNVYhn1dUGGKmw8+cikX8puiEnTEsG///zbL7m5wO3WKHJMKifMItkb6jVR2o6MZiZcXwJi5iTpr2MeM7PEdGXFdCtbZFt6n01qLmNlBNYUPJecXgT01cwhqG9vhcwwpm3wjOVEhZyO5F+bQ+1M4UiexgC56vRZ2cZQ== 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=3rLHhWr+VMdNdo8jPTd1t8rCkBuoynNxwXMACXCxzpw=; b=MJT4I1dWleiV94SlX6EWBogPwiN36iaOyny6rp6IF+XVqfVyeS/HfGJsOIMS/BycDPxm0xMODaZMkxFsSpe1hComB63I1igJ6hMdQamKKO88LjOYlw/76zcfffc31+PSoQ6JXN/a0BVYBdTp99EpX17wTxPY0fy1isy+HkhgJUs1p6iHmLKKwH6tSBaRB97HQur2PYReLCGbRJ8IdOTmR0zfBwefjfgUi/zRqmRBA+AvX8WDfYxXEt3K09sG+zi+r5AQFDi6YQA0ByXQvrg4PBUgk69N1fHQ5Wkbp/vWJGLG7KmWmrQUw47jg9wIC6WuutwJQIWf3eB/A3RCHrIQhw== 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=3rLHhWr+VMdNdo8jPTd1t8rCkBuoynNxwXMACXCxzpw=; b=RSaVGktFIeSlLmpaWLVFGHM/VDxzHjru4RttE8UQciC2lUP15+ZIvsg9mJ61cGrJPJPejHhYLWlHKNy64m0h5ODucAj9lXHmYLLQKQmdG6Sq5UFAr7rJdj4950jKhJRTD4rghWwL0zIKtT8VL/WXoGUxW8Xy+Tg36RApXlo9IEQ= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:17 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:17 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 5/8] ASoC: SOF: Add mt8195 device descriptor Date: Thu, 18 Nov 2021 12:07:46 +0200 Message-Id: <20211118100749.54628-6-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:16 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 094c7214-8390-4b0d-2d27-08d9aa7b576c X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1201; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Rnrvj67/Xvipbu2Qx9Kb22RSryCoM8t6aqTfjqrOwWuRlpidHWjRDCY5qRtRxU3EzqM1RTdUAMD0Xt7bfw99oB4yzl2i90bc0IY+Q44BH3ab7+DRm08f5mZnxjQ4o8iI2/4dfEmJKLK0+WkNbBOx25NkZW1gB5wgKxyjsUQC+pMnXu9e+9yMRbdtfXbUQ01fOtnKTyGBnJpCgklN48gnVbeg27nvdq6TAIU4SrMnaDs1LsKpm6XNnhDeHDSgihugEGbIFBh+72LLbkLvd4f0TNnxbpk6NgjnU86C4JpnSsgIXJd6T+yi2CCXNj+X3k/vnf3tWmEdeK5lTc8oZXYi1Ll3v74rtzawhU+dzndBfE0XTyDxpDX0AZCSPPeE5m0GgIVWJu/rZdOhR02IWehObNbx0AlFRuy3E5av9bLTgzgyT+KrJrjbYKMZQzimLdm3rBLQKc+YxHNRdzFKGeK1uretj4SwnSU+7amyntTCzNDv0GnRrflhfmn9zt0RTpWTFZaqg71iLo+A2gbeloz7A8hxIbO32TDCWhJeU4IPBODIFvNYSRcnAvBJ9vLzJPnl/AWhxPDUz558wLJp9TrKYNN3q85BLQOkXrTTJqF/J8E/xmX18RGIQuybHroKXFdAKT5BNJ2jNAcMRTMiJlQBg== 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)(186003)(54906003)(8676002)(2616005)(4326008)(44832011)(86362001)(7416002)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(83380400001)(66946007)(66574015)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?3diUbdzbV9utkPmyC8elx1mS4Ykc?= =?utf-8?q?MPvCJvhP1nf39pP69He4LwaSemTDsl9AMUkazdn4W48E+ifc1jXlqTSMwFmv68w8Q?= =?utf-8?q?+xEGCAMz0gOYgyC+uWRls29QjFgymFArgclML8ialtTbGjRfWRrJpyal0VcsXgH+d?= =?utf-8?q?JQlqfLrDrsxe+5nQb+p7/oGtI7GTjL/WaAa7182Lz6hIapFAf4YxhWxgpuDHkYY5W?= =?utf-8?q?HxmMy5R5PMlKSf0wK9vaeObcfoST67t+ij/rFnC8QCiHPU9DjPo8SjcPWZNC8dPM1?= =?utf-8?q?e0EtE8LELLfECTmCKEjFCFrakn5E2rikWykAfHeoz5FtBVgItLjoT+mnbfOoJxlmQ?= =?utf-8?q?aBWGWhMJMA8e2YxTgMJf7182xCqrDnsz3363UdObh+bSXDZ/sZUMrih/5VfvfmNL3?= =?utf-8?q?vOpTLsvPEgZy6oUDD1ar6j1jy1z55lGqp3f5VBAVtL8ZGZbKiBg/xHvBOxwaqRRlN?= =?utf-8?q?ZV1IFZqUpd6Ms5b60yUCDG3fFNreJN5azSMAONKEu1CcvG/a1X5zEA8gwfbqgLDcg?= =?utf-8?q?hgR5IF9gkYOGleqGXpyyizCN3fTU83pzcefkY7m7O216tPuy3GNQuNLaJfOWO0f4z?= =?utf-8?q?2wkGYhnKUC6z+PUaK2zglpTxkwMomGjnygL3RBxfdvkXvUlsUG9GMKwCvJp7i+FKw?= =?utf-8?q?oQIgCarTz3PUqJ9M1Vzr9DZPTG2iZufxgeorG4C7IQ7hPbNxYJIyPh6cbu/AhMd/2?= =?utf-8?q?ZPtiw3VcUR3zdspe0ALIIeChDII43ZEUhFX7w2oxvnmQUg7gD73iaP81WfELpU8T8?= =?utf-8?q?H1hwGl7ImsopGtoqlgWwLwuUKN2tFHM3TSoA1bCE44aVCC9lr3HPCuS6fDOF9nlZ9?= =?utf-8?q?M/3BxOXe+xtZoZe5Z8ZcPxykQOk3jagPTtR7ZRWBXWc0X14Oa6Kgg6hgUYSlGfTXN?= =?utf-8?q?ujbns42N/gmv8FIu1KJM7EqDZtT6GnkesAXkdlYYkr8h1rqGOMIMZC0BGjyX6ZPLz?= =?utf-8?q?cX988NtuZgSyW/ouJKTHU6bcl12MZuFRGkJvUdcDQ5TuHBSMOdk50861vKP7ficGN?= =?utf-8?q?Rpv1hAkTCDV+f3nsVk8vfnKV7iU0FszYjFaGUKxL3ALmkvkgk908ZEPS/ILSEq3Gk?= =?utf-8?q?FBfQj8cZV9xhCJP4htZiiwppvtBA8R2Dm0EzQgAtqvvaK95sFV+WfGbz8KfV+CMlU?= =?utf-8?q?h6XXWMwkFFyp3DmraRqESeQxWTbbvFju13uo0JRYoM50AFAyhMrRhIoSn+Y0fw03S?= =?utf-8?q?huK8VLhf5jpWzk2JmudCal8QkSO0+uGLmyow6f9Pfp1CrVRPKt5f7500HQkMFkO7b?= =?utf-8?q?+AaCwT7X4ULkjNRVOQ6VVRpGOYlC7ts5p6Q5kOf0DB0wGD6a+qUWErM4eOH9/hfYe?= =?utf-8?q?jK5xWidOHtAxIFdwsSDSyofiIb1YYEJ7F1CzLNlu3QQNy1y7eajwLgYHMWbCq36Wm?= =?utf-8?q?NxNYPaXi7Yr5ayWdllQkoOItJRM57X4hfUGCc/gq5wlPjnM4rM/gv9kX+jLv1inP0?= =?utf-8?q?WMjijuKYiN97OdOvsPx4Fw7rxRRbkG6htPNCs3jriQozE7wipwrlVc1pGhlBUwgkW?= =?utf-8?q?8AOtEm1Zz+x8CP83Z69+TPjgB7FLiVYBxBMZLvZ/tN8QUTCoTKtae6ptHibNZue6+?= =?utf-8?q?HfR+/fi2OsFmJ16VQbDAGuEQTPuhMXbJNDsjwFlN0Z2V/jH1ABDd7I=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 094c7214-8390-4b0d-2d27-08d9aa7b576c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:17.6860 (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: eEGDZ6b8T+UBdIiSIcSO9obVDGbqmNjZjTQaT56h0drVS4VyTmxfJAzTu+BXEtAy/iEl0pwSbt5wgIiRKmK1KQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add SOF device and DT descriptor for Mediatek mt8195 platform. Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Kai Vehmanen Reviewed-by: Guennadi Liakhovetski Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/Kconfig | 2 +- sound/soc/sof/sof-of-dev.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/Kconfig b/sound/soc/sof/Kconfig index b0cdabcfdde7..ac34c330cf0c 100644 --- a/sound/soc/sof/Kconfig +++ b/sound/soc/sof/Kconfig @@ -42,7 +42,7 @@ config SND_SOC_SOF_OF depends on OF || COMPILE_TEST help This adds support for Device Tree enumeration. This option is - required to enable i.MX8 devices. + required to enable i.MX8 or Mediatek devices. Say Y if you need this option. If unsure select "N". config SND_SOC_SOF_OF_DEV diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c index 885430a42226..412cbb824b84 100644 --- a/sound/soc/sof/sof-of-dev.c +++ b/sound/soc/sof/sof-of-dev.c @@ -13,6 +13,7 @@ #include "ops.h" #include "imx/imx-ops.h" +#include "mediatek/mediatek-ops.h" static char *fw_path; module_param(fw_path, charp, 0444); @@ -50,6 +51,15 @@ static struct sof_dev_desc sof_of_imx8mp_desc = { .ops = &sof_imx8m_ops, }; #endif +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195) +static const struct sof_dev_desc sof_of_mt8195_desc = { + .default_fw_path = "mediatek/sof", + .default_tplg_path = "mediatek/sof-tplg", + .default_fw_filename = "sof-mt8195.ri", + .nocodec_tplg_filename = "sof-mt8195-nocodec.tplg", + .ops = &sof_mt8195_ops, +}; +#endif static const struct dev_pm_ops sof_of_pm = { .prepare = snd_sof_prepare, @@ -130,6 +140,9 @@ static const struct of_device_id sof_of_ids[] = { #endif #if IS_ENABLED(CONFIG_SND_SOC_SOF_IMX8M) { .compatible = "fsl,imx8mp-dsp", .data = &sof_of_imx8mp_desc}, +#endif +#if IS_ENABLED(CONFIG_SND_SOC_SOF_MT8195) + { .compatible = "mediatek,mt8195-dsp", .data = &sof_of_mt8195_desc}, #endif { } }; From patchwork Thu Nov 18 10:07: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: 12626475 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 326A2C433F5 for ; Thu, 18 Nov 2021 10:11:51 +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 86E8F61B7D for ; Thu, 18 Nov 2021 10:11:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 86E8F61B7D 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 550B618C2; Thu, 18 Nov 2021 11:10:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 550B618C2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230308; bh=uRywt/6Kyw3A59jrRjOw0vqU/slQPz8+odzpqxuhGVY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AEPyKYcc8/bOrfwJxn/LA6TxFtWVcDB4RzK3+Wy5xW6GdjN1nYg2TZ9zJOCwc6JxE RqqZupHm9iIHd68x/VRKWQ7vpw6hadOMV5pM5Xtdk1oAH8IuC0Yd6sxLXyoimJ0CKX WhAlM6I3aE1Kzv+tSGHesFvW65UjOMdnt/TBArAo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 305EAF8051D; Thu, 18 Nov 2021 11:08:39 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F4144F804FE; Thu, 18 Nov 2021 11:08:33 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 C0F03F804D6 for ; Thu, 18 Nov 2021 11:08:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C0F03F804D6 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="Is3xwVFx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/cCkFYZhxwMpBjlCDJQek8r7PjE8dSQ+pb1AaRsKO8kGWkfC3cdDcsGVCpjnqZAd1xqMZoEWgH6VBfIaBfZMc+vXr56JI0VfHJNLF159Qa3r4h8yOPQCNozDQF6xY6ic2HDZyWLoUHZgN6Kk/eRrcFe2mB6+MkP30sejej5XnUlyTo2WUb9vVOzU1GKDXusee3Hen9ZD1gfyFW0reRdwuZa9ACsT4TNFE555GMDuPaU/Olto9f88q8SGiwq0ZRx/E5FaDGByGltg2QUhzfje2OwKkUzrj142FLTwSqh2+2GfDV1bGajQuumiwBMeuo5DmTPzxvTnIlw2vu2erhCfQ== 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=LfCMsRTQHWceFWu6tp44o22ZVYte66A8Zl2PxavSv3g=; b=T0/1DSjlz42/HgEmbsZsbifvkEfb5eOr+VcJtp0tA6YatDZMp5u6sUlmSQvdsOc0fo48EoT+igwzGDGneb8W+U1BrElyUioJgnXyVvdr4JAZTLLfl/D3yzlTZEmwkP0OE5flHJLil04KMoWG6xwsasS7dvOCk9ZObGacibcvBzeshLKs0R9zww4LK/Ne/eDiqqhwr6S9a3Bdd9c+H75kTS+pWW1V+hlnAe+2H566bvR2JKuau2ZkuIrAozYVRFs1SWzjOXXuqIBZBPnOYND/+VwBVCD3uoy4d9gtebIGxn2/wPRWw2w8LPVj3SpeAINt7qwjcFLqoTBJZAhIIQD/DQ== 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=LfCMsRTQHWceFWu6tp44o22ZVYte66A8Zl2PxavSv3g=; b=Is3xwVFxiEU1h8vp0fsYjjleJNIonUKyg9/cFhc/5GNh/pfT6jRgW97tlFhA7nfBtZMxyZWREABNgDRo6fntl+WcF8Cbg8mXrdxjT1bWAqaElSvkKtvSTqKSXcaPCj+2Y5gEDVqYDKyRVL8ehlWBCGkD5l0W484XyQeLPB5NHCo= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:19 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:19 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 6/8] ASoC: SOF: mediatek: Add dai driver dsp ops callback for mt8195 Date: Thu, 18 Nov 2021 12:07:47 +0200 Message-Id: <20211118100749.54628-7-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6fa336a2-d635-4222-2cd5-08d9aa7b5869 X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ugQn4vJJfLzhVzXIj+7ZDCJrFPMNt4UrrzWEYEPouYlOy0ATC0je/I/+98DOF2v+Q8lhRXwzyx2btY2DrHYFGHDgaqopYiTixeMDxnu1RhG6Hpaf0yYgEABVWXwusZZ+kmATHz3JzZ6v1eDpI2cu1HP+r4y3+EjVsy2FxTAGxu/KszsDVOBPN4Xtph6HmGJOGcpe8z9jmuH/6vAHyqK5DpzCB6BZ51hlHhYRsf/LsBjqCBq0a2tCS4l5lk1gUGIYeHF7SjZyK60FFMZXlJtbmJLq/fBQA6scKliCe8bmbCdjy70YG0N1vJPJLFZlT+V0B5SSp3P2vjCMJH2yPkE0RCiuJjxkG2INbd/W5qfoSFFLla8QHOuZ/yLhrjJd33NKNfJFQ8Iu0GyYfuLxbp6vgYdISmqPfrPOzp5A9aqfDTqObwhOaTG3E1Ig1g9XJ7+7loDrCHK1cgZJ9uVTrRvS2y8tLbUE3Oey6WRDceTWleoisOFJrf63NhmQYJAl2wBNW1XajpFPZ7ebQsO4Rb6MAbrzXwRqJgtCH+R8SvIPGCE8CdqtqDeY/fmVQoPgY6MK5nqx5CYCapHrB81QDS9lWhViGBS5yLTavvzUFbsfK7F9hKpYi7HRT8BsQNBrux77NWdwg4DchSdRXg1xPbNFyw== 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)(186003)(54906003)(8676002)(2616005)(4326008)(44832011)(86362001)(7416002)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(66946007)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KAC5MUHgLrdNuGKSsepXZdKlT1hU?= =?utf-8?q?8o/XMVuce7m96PV0AgV82URO9LOA4NAzWHptatsPa7HKx+JK8KDXekRMCTUpSQwEZ?= =?utf-8?q?hIlf5v8RW7T5c+BONmxQlV01hj8yDFdLKPOPWYKY4ZlywVPrlkydiMrPs/zNWSndH?= =?utf-8?q?EqGwhMNgtclTMQ6nyWKcmfGiJXLYLeigVcCamV+VfsamTlpwIz3OnZCTwq/ppsyWS?= =?utf-8?q?Ep1HRGCFr6+Makz8mATeRGs3JDcQTuC6Fwm4O4hQAihGZD9BvSb2ZSpYZs7dO5PEf?= =?utf-8?q?vbt3MbfPlln7l7nrFANAakg9ha9W64KmcUN+UnxiSbq4b3Vuis9jwlpz0hURJ2SrI?= =?utf-8?q?61YZ6QuSHkHRHLZ5FrX3UPRb0js73uZApuzjoAYL561wiEDk/eSvr4/eon1STChbS?= =?utf-8?q?VAEZhZB0VfGtfyvyBGf+klnQpF8iyXKeeFdzLpJ8KiMdxrWAdPIjrR/y+7VRTRtoZ?= =?utf-8?q?PwAfr2vlQA97AB6ibY6RhYt+qxJbnHEEP2PpQXlhpLYiaNoXbEYsDbWq+FW7EFqfw?= =?utf-8?q?4OV6+TE7LvXA7neQa9AGlCDF0m/n7F/VEfUnNTec9gRifHA7QnhOehdIEyOlYJ6bl?= =?utf-8?q?zc5/sXA3KiTF69SCgL78zoZIvUATfvohvgeCRNjkSh4RHr/2ZjJ+MPb1lOkMZGrh7?= =?utf-8?q?Tt1Ai+Q1UXXSgS2CyAABx9DVnzBgcTT1RmgflYrJjZ3GYrw8ckI8cHcoSvBjqyNa9?= =?utf-8?q?7es3jhQwCRotuzXZ2dlhixQeoABFbFVVtwDqe9WtLi29Sbk0c2jfXfaxEAkYV9nbR?= =?utf-8?q?C/f1sSUoy2nhePpW6W40G3kK+urZo6HaTXNsK9Wy0nQlfBO+pwtcnwewHFKDxl63o?= =?utf-8?q?PO7dAK69xrvUIg9crjSt0aO9Op9IzjJHJ3uWz4ubG5fKgLChkslscHoJdJyq+IhWU?= =?utf-8?q?ilc/bsnZTdQoK3GG45Q4aKHvVA4ybqrMu5cbySJH2gbUSTuLdEpJvt4yfioJ5hJBl?= =?utf-8?q?EssZl+ssXPQ0oSJp2YRTRtDEm5Mdmcg/h6yo7RYKwoFR9YDoQpJsd+OFoar4YvBoJ?= =?utf-8?q?KuXFZZwXxIWUXdMLpgUqs/6HDBYOFm5HgYcy58OsvQ/sz8RCm+QSW8Zk8rlzHfaEQ?= =?utf-8?q?der+3+cVyNBw87l/t+WtO77TrNmKcwp4e8pzU2qOp7y7Y2eUi9jR/ubQ5pAopxy+A?= =?utf-8?q?6CVzjDEVIwHzdRqUpWnV7pmCeKFOvljQZ/4q+iGJbVUNPYm+yfQSb5DXjh0XxiQwr?= =?utf-8?q?7Uq3+3IQochJGzy2zEaadWBpIhwt3FLltqczNNdCgSln6H8n2W9MbjzqxDNZoPegE?= =?utf-8?q?RtglhjOYpwe2kaZATZBVvDiM9hmMNMkWJ+qvp2xdiA+hEBdr7MBEUmUqViGUgfumP?= =?utf-8?q?VATK5qLcPDYGHdzC2faeeiV86+SOLHOmuJUu87/GyVWtw7RlXktHsrrhZflaGIxVy?= =?utf-8?q?5oUpX3/o9xtMLRS1tLG5uK9C/een6VQwB2tbVvpde0wHvh6NYyzmZYtunEqeQOaWM?= =?utf-8?q?q/EdKoUa3tmzXCMQWGTr8yrXYbwFOVIs80qvvTDzdEb2WzUIaO+lmsvgP5f69/uJR?= =?utf-8?q?W4OQylaSppW2Gw/w1BsrsOPxM7rheqy+BQJPcwblBlKd4UBKo10PKLp08VTIvSNYx?= =?utf-8?q?nYQb0T2EM9sqxwr/WZdklYrdEuKn3EsYa9REfBLEqPO5RSFc3/e0Ro=3D?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6fa336a2-d635-4222-2cd5-08d9aa7b5869 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:19.3111 (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: mw1okgv/b+UL46B6IWFKv8VCDYMgqXp5MLbgfGuQtbVPTW8GEhaAw6zf/b1diNaidRhcJ19YVINDLiRvkKk3VQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: Guennadi Liakhovetski , daniel.baluta@gmail.com, Kai Vehmanen , lgirdwood@gmail.com, =?utf-8?q?P=C3=A9ter_Ujfalusi?= , linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, Ranjani Sridharan , yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add dsp ops callback to register AFE DL2/DL3/UL4/UL5 sof dai's with ALSA Signed-off-by: YC Hung Reviewed-by: Péter Ujfalusi Reviewed-by: Kai Vehmanen Reviewed-by: Daniel Baluta Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart Reviewed-by: Guennadi Liakhovetski Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/mediatek/mt8195/mt8195.c | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 88da6c2de070..99075598a35a 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -299,6 +299,37 @@ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type) return type; } +static struct snd_soc_dai_driver mt8195_dai[] = { +{ + .name = "SOF_DL2", + .playback = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_DL3", + .playback = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_UL4", + .capture = { + .channels_min = 1, + .channels_max = 2, + }, +}, +{ + .name = "SOF_UL5", + .capture = { + .channels_min = 1, + .channels_max = 2, + }, +}, +}; + /* mt8195 ops */ const struct snd_sof_dsp_ops sof_mt8195_ops = { /* probe and remove */ @@ -329,6 +360,10 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { /* Firmware ops */ .dsp_arch_ops = &sof_xtensa_arch_ops, + /* DAI drivers */ + .drv = mt8195_dai, + .num_drv = ARRAY_SIZE(mt8195_dai), + /* ALSA HW info flags */ .hw_info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | From patchwork Thu Nov 18 10:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12626479 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 6B744C433F5 for ; Thu, 18 Nov 2021 10:12:26 +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 E779461B7D for ; Thu, 18 Nov 2021 10:12:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E779461B7D 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 3022718E2; Thu, 18 Nov 2021 11:11:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3022718E2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230344; bh=oWgfUmGpScC53mX7YbfQXkOptj/3blPF4qwWjxVNxKg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=lL5g9f0paiDE3UTMo3mQTyuJbJ0FUZbZqYopkUva/zbfq9KfssKGKKUB4VgeaDlW0 z3t2ufwAs77KB19NN9/auVGNOxQki8JIRKTKj1xOJS0eFHurNBmk8Hj2QBpDCV8Rtz IqFkvPcJGYFGQ34jJ2vu23Dfr7x4mzSLBufSTREk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DB6B4F80528; Thu, 18 Nov 2021 11:08:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 37023F804FD; Thu, 18 Nov 2021 11:08:35 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 11609F804DF for ; Thu, 18 Nov 2021 11:08:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 11609F804DF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="lhrNjCOB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hOclHhCP8fWo+biXKaRtG3NyxvC1YQXbfAvGwmLpJLFA9CBi8LAWxVjCTLy70EYC18mEvJRqQshJNM0grdSpDPyBkKpn/IL46+JVOJz2WqkI2n+OIOZPu3P+8vJeq4xdifua5iplKhWoOO5OHI0XYRdF37WnlA0OP8yXx+nu35p3e4mLDu4RFsEZNredlYc1No0Nii75cFMkCgw3srZe2by85mgB2uWxnnoN/Kzrqq3IDdt0fa2ImbOVGDfSP1fwPJYL3tJNZNTo8EgqXnUZTUGJMbor5IJQje9o9UCpJHebPkj5A0rU1UhFbAPcrrS6GdkbEulU024ZGD1jJYejWQ== 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=RCMUzfA8hdjBrmOIn6d07q9GBomDcmPvFrEtSFmZKi8=; b=DYoFfRwpjqnD0HAasDJnAn1938oOoRsubFUtiOo4BUuHBoLQkMagKYWggNQJhjTS3m4/VDVQNB8toGAsVmUm1CYLRX7ps/ESLgbzznqA8YGKXMXMV4SmEQi7V1Y3bf3DScIqC+wfuFgq/Uf15oXNtv2bC7VqoNN3fX2Asel0dr/N7vraLUZCW2L7/PCKhIzsw297ARSz+TsJTGABVAUiXBUfJMLVT3hWDb8MDmTPPPhMCtVfG+8oxMJgpfo7zs5VX0+cJafjmhwEx7MNvRzv06iSEdErjZrc+PGi5Qg/t/kuqxIp4Ic0WZjrh2eygJ1jrB4wi4Y0kFwMmCCLaC9etA== 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=RCMUzfA8hdjBrmOIn6d07q9GBomDcmPvFrEtSFmZKi8=; b=lhrNjCOBBpsc8Uz7E9lEtanSWfBNAdkoV3yS6qt8pfXLWHVTmlN/ozJGwpEMNT09x1EMi6YpQemy8XR4//pcTUdf68Mb7RKZeZJb1FTjKXmJQjUsoWhKeTN7vCx76X58nPLYQNr2GLv23GZQoY63Xa9Dgn/5wmDbJ4YGxfGCY4I= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:20 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:20 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 7/8] ASoC: SOF: mediatek: Add mt8195 dsp clock support Date: Thu, 18 Nov 2021 12:07:48 +0200 Message-Id: <20211118100749.54628-8-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:19 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce4a513d-9bef-4f57-abdb-08d9aa7b5950 X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:277; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R8N3moHGBB50MKxznFsQ02ZMD2H5rOzOgK6YKb0b2PqXFuNeg5QHKco5B44LjLDJsNppBz1fIXczBWJSYy8y8moKNoTDFkyoS32ydWsWWuq0kAQ4P9ePhmpHQ1enCqZu9+KzeQFr9NuIbblhS47Zm7YfIBAL41njIp2MxMkWrb1sTqDnN8D/qjZyo6LkTuNPJq7k1v98Pqr+qn43EqanUUEpKr7J5Jcqu3mR/eeD2MaAdayJuTZZlsQ8wwE8b/YsZQRw40+xOZPWDcn+U2e//1U0tG4mW4l44RnZGqZAVPK/ayj8cVOTOKx1qUA9Umo1wpwzc70V2HrETN6Wr7cXXDYWrWBmlHcKexnOgSr04/mTo+3UdOa8nwQe4bmWPbFTuB9z1AFEx95sqO8U1fxrzvWedqlVHehUvGMw4QT+GhJxTFBFW7zj46S6KjsQZcXFnWAb+iXO14GjjoOZ3aZ4eN8D5MSTEL2vsKIAYAoPLP18iUAOiewC/DXXp8CBGUxmUSGb9/Pc41eRu8tHbDwWPrMFNRGUv/ptfQwi+X3XDhnpXNlVTR6SCBPm0lkIRI9YwR0Hdcqqe5wrusWj8wuLMAFw0A0Lejpa4H1/tY7gvTSAvLZoMuK33Nn3/cIuZ8pyqHNJdB378HT+O56ZNOsx8A== 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)(186003)(8676002)(2616005)(4326008)(44832011)(86362001)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(83380400001)(66946007)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EYE5w/bTLGCoKeQ1n1RyhGEqDO2rFf19w1B8bJW2eq2EemgN6P0PWRhR6KaMIX+a3s2ShAhgn9DpnFjGka0gkkKUpPfNjUzfCWSCLv9wU8kB86YmtjkHBNCGpb+ndSEnfjTCvu7dmHZLGxIhRCfrhkHfkgHeZAD3O+MueZdroispGuCrl62mkZI06ns8d+jPPYJu8wx7oqlmWWfzSPH5znmfC0XmN17FFwTm7V+fDnfwo2RYmtBXJD/D4uPFUEH+uQDYetQxNopC4W0Dvh1m1rAL6yaW5MS+kpV6Qo2ubqOEGP8Eqbr2Bmv3Ii5tuTGTeD2MJ+68z8lyQFd+Cwr4FB54L9KwbTljP0ySZFhS5RApz5sNrrvKTpyRYLyKTkEGf2O5zzsiBoJ+QkAHL+7O7Sb76Qdiw5nFeTy6cg+1NR+ZquvGAwTDGppd3QPE/9nWngounu8eQnK57zQZSU13wala8Q5U1c0LRcm4J5DthGrRWOSxAwThtklhpTPD2y+9/u0/Ay3lSzu8BYxgL2Q+0Yv3NDhOLQ9+6P1MgntAgIc6ppD56nNlHza7h4BmqWehY479H7NsLqzXUStvnU0UQfcKaj00yh9WlftTNON+sR7OC15VRq2O1jPT69cIF0LiJHdAZV8k0edney12FfmDW9XlZzAbAOzSMThfTTmqvk+8sziKP0Ozrn7ZbOL8t764DtZsK6hZxzQrInc57Uq5bWtY8uqDsgXrgBsML795ptiFBCEJAbtkJEeNFJHDWOKwW5sJucsMhNqdzTipCGfly9g8RhSxOfVsRm9nVd9aIogX7TBRRSIC1Xp2SJNB1539SqQEWWiatxfL2EXVPB40kGZG5zWAQ6Vh2z6XEAbn6PbdY/TwiUxLjuzrgaY2WRr0Lyz4a/9FskFSlE4rsavjI7dNsuF9fmjqdnPMLKypJsVzpDqH2uZSN91Cd8sba4+R1j+4cMZXhrGMuTXclNCsM4y02ayCE2Xz9QEobSg46+pPD8CGg9qxEQ03c74GzOaXorzrYAz3s+JVjpC8pCGqn4ZPD1ZXeKjyyHbLiIQZoxQ5Me6IOxj2R5+7C0+l5au6Ad9QYyZlJA69vy7qayzaoMBcwhSV0Exvy4WOHGhHGcApWLzJbPwhBH7oIStmd/snJhDmEEJv7V01z80qKwiWd3Ut5LUk1/tLhQLHwkhoGusMs47Bl3E/Qcd/nZGPOpEhmzRikd/Z8jM7DXMStfkC80eBu6KnzDMQxOKVoa8FnnBg0lz2gJGRwAXY1n1U9A7GzkTKh6OiSbUFJNnf9TI8ZrTHtPb6f98izxO5TpJ/k0iCmEo+qMuhsAPqqGqQQ5YtWUB1ikACN6y24Zn9gSSb47dBR/qpt3dXKFloCgwczjDKBbzzjV5PEn1Qr2Svncla6ITwdypxmtKKmMc7nEURrFPJ1IkrKBZGmllgJ9qf1tEeomgTn4DgqvevTjN4wWAMxGWF+wPjYcU17SZQvKeLLF7nFfADAPqvQFm2rrOOTWJgGrdeRFVHYiqXygxmpmKOiGiyPr9Q6J3MtVc3bIXvdJfuzToCb9mLI0Btq3/k3seeOkyqiibTtCg35uTU9iJn1hLmY208sm3TdM0FAm08PSqyKeAOYoK0I44uZpsOiZWNwscLoFnbbIPWqTSu+o57Dh+1jBQ7529uiboqzPKcbMvamnUGpA9Wai7URe1s4Ms= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce4a513d-9bef-4f57-abdb-08d9aa7b5950 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:20.7813 (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: T7t3a+KRAVhZAhYGHqcf7NCOx6miw8NEbtL+SH8yBGGrCyZfcspWUuLS272UXn3EuIbq4aR8840ateBvtzV1gA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: daniel.baluta@gmail.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add adsp clock on/off support on mt8195 platform. Signed-off-by: YC Hung Reviewed-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/mediatek/adsp_helper.h | 2 +- sound/soc/sof/mediatek/mt8195/Makefile | 2 +- sound/soc/sof/mediatek/mt8195/mt8195-clk.c | 158 +++++++++++++++++++++ sound/soc/sof/mediatek/mt8195/mt8195-clk.h | 28 ++++ sound/soc/sof/mediatek/mt8195/mt8195.c | 22 ++- 5 files changed, 208 insertions(+), 4 deletions(-) create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.c create mode 100644 sound/soc/sof/mediatek/mt8195/mt8195-clk.h diff --git a/sound/soc/sof/mediatek/adsp_helper.h b/sound/soc/sof/mediatek/adsp_helper.h index 346953dd22db..6734e2c0c6b1 100644 --- a/sound/soc/sof/mediatek/adsp_helper.h +++ b/sound/soc/sof/mediatek/adsp_helper.h @@ -39,7 +39,7 @@ struct adsp_priv { struct mbox_controller *adsp_mbox; struct mtk_adsp_chip_info *adsp; - + struct clk **clk; u32 (*ap2adsp_addr)(u32 addr, void *data); u32 (*adsp2ap_addr)(u32 addr, void *data); diff --git a/sound/soc/sof/mediatek/mt8195/Makefile b/sound/soc/sof/mediatek/mt8195/Makefile index 66cdc0e7bf3c..afc4f21fccc5 100644 --- a/sound/soc/sof/mediatek/mt8195/Makefile +++ b/sound/soc/sof/mediatek/mt8195/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) -snd-sof-mt8195-objs := mt8195.o mt8195-loader.o +snd-sof-mt8195-objs := mt8195.o mt8195-clk.o mt8195-loader.o obj-$(CONFIG_SND_SOC_SOF_MT8195) += snd-sof-mt8195.o diff --git a/sound/soc/sof/mediatek/mt8195/mt8195-clk.c b/sound/soc/sof/mediatek/mt8195/mt8195-clk.c new file mode 100644 index 000000000000..6bcb4b9b00fb --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/mt8195-clk.c @@ -0,0 +1,158 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// Copyright(c) 2021 Mediatek Corporation. All rights reserved. +// +// Author: YC Hung +// +// Hardware interface for mt8195 DSP clock + +#include +#include +#include +#include "mt8195.h" +#include "mt8195-clk.h" +#include "../adsp_helper.h" +#include "../../sof-audio.h" + +static const char *adsp_clks[ADSP_CLK_MAX] = { + [CLK_TOP_ADSP] = "adsp_sel", + [CLK_TOP_CLK26M] = "clk26m_ck", + [CLK_TOP_AUDIO_LOCAL_BUS] = "audio_local_bus", + [CLK_TOP_MAINPLL_D7_D2] = "mainpll_d7_d2", + [CLK_SCP_ADSP_AUDIODSP] = "scp_adsp_audiodsp", + [CLK_TOP_AUDIO_H] = "audio_h", +}; + +int mt8195_adsp_init_clock(struct snd_sof_dev *sdev) +{ + struct device *dev = sdev->dev; + struct adsp_priv *priv = sdev->pdata->hw_pdata; + int i; + + priv->clk = devm_kcalloc(dev, ADSP_CLK_MAX, sizeof(*priv->clk), GFP_KERNEL); + + if (!priv->clk) + return -ENOMEM; + + for (i = 0; i < ADSP_CLK_MAX; i++) { + priv->clk[i] = devm_clk_get(dev, adsp_clks[i]); + if (IS_ERR(priv->clk[i])) + return PTR_ERR(priv->clk[i]); + } + + return 0; +} + +static int adsp_enable_all_clock(struct snd_sof_dev *sdev) +{ + struct device *dev = sdev->dev; + struct adsp_priv *priv = sdev->pdata->hw_pdata; + int ret; + + ret = clk_prepare_enable(priv->clk[CLK_TOP_MAINPLL_D7_D2]); + if (ret) { + dev_err(dev, "%s clk_prepare_enable(mainpll_d7_d2) fail %d\n", + __func__, ret); + return ret; + } + + ret = clk_prepare_enable(priv->clk[CLK_TOP_ADSP]); + if (ret) { + dev_err(dev, "%s clk_prepare_enable(adsp_sel) fail %d\n", + __func__, ret); + goto disable_mainpll_d7_d2_clk; + } + + ret = clk_prepare_enable(priv->clk[CLK_TOP_AUDIO_LOCAL_BUS]); + if (ret) { + dev_err(dev, "%s clk_prepare_enable(audio_local_bus) fail %d\n", + __func__, ret); + goto disable_dsp_sel_clk; + } + + ret = clk_prepare_enable(priv->clk[CLK_SCP_ADSP_AUDIODSP]); + if (ret) { + dev_err(dev, "%s clk_prepare_enable(scp_adsp_audiodsp) fail %d\n", + __func__, ret); + goto disable_audio_local_bus_clk; + } + + ret = clk_prepare_enable(priv->clk[CLK_TOP_AUDIO_H]); + if (ret) { + dev_err(dev, "%s clk_prepare_enable(audio_h) fail %d\n", + __func__, ret); + goto disable_scp_adsp_audiodsp_clk; + } + + return 0; + +disable_scp_adsp_audiodsp_clk: + clk_disable_unprepare(priv->clk[CLK_SCP_ADSP_AUDIODSP]); +disable_audio_local_bus_clk: + clk_disable_unprepare(priv->clk[CLK_TOP_AUDIO_LOCAL_BUS]); +disable_dsp_sel_clk: + clk_disable_unprepare(priv->clk[CLK_TOP_ADSP]); +disable_mainpll_d7_d2_clk: + clk_disable_unprepare(priv->clk[CLK_TOP_MAINPLL_D7_D2]); + + return ret; +} + +static void adsp_disable_all_clock(struct snd_sof_dev *sdev) +{ + struct adsp_priv *priv = sdev->pdata->hw_pdata; + + clk_disable_unprepare(priv->clk[CLK_TOP_AUDIO_H]); + clk_disable_unprepare(priv->clk[CLK_SCP_ADSP_AUDIODSP]); + clk_disable_unprepare(priv->clk[CLK_TOP_AUDIO_LOCAL_BUS]); + clk_disable_unprepare(priv->clk[CLK_TOP_ADSP]); + clk_disable_unprepare(priv->clk[CLK_TOP_MAINPLL_D7_D2]); +} + +static int adsp_default_clk_init(struct snd_sof_dev *sdev, bool enable) +{ + struct device *dev = sdev->dev; + struct adsp_priv *priv = sdev->pdata->hw_pdata; + int ret; + + dev_dbg(dev, "%s: %s\n", __func__, enable ? "on" : "off"); + + if (enable) { + ret = clk_set_parent(priv->clk[CLK_TOP_ADSP], + priv->clk[CLK_TOP_CLK26M]); + if (ret) { + dev_err(dev, "failed to set dsp_sel to clk26m: %d\n", ret); + return ret; + } + + ret = clk_set_parent(priv->clk[CLK_TOP_AUDIO_LOCAL_BUS], + priv->clk[CLK_TOP_MAINPLL_D7_D2]); + if (ret) { + dev_err(dev, "set audio_local_bus failed %d\n", ret); + return ret; + } + + ret = adsp_enable_all_clock(sdev); + if (ret) { + dev_err(dev, "failed to adsp_enable_clock: %d\n", ret); + return ret; + } + } else { + adsp_disable_all_clock(sdev); + } + + return 0; +} + +int adsp_clock_on(struct snd_sof_dev *sdev) +{ + /* Open ADSP clock */ + return adsp_default_clk_init(sdev, 1); +} + +int adsp_clock_off(struct snd_sof_dev *sdev) +{ + /* Close ADSP clock */ + return adsp_default_clk_init(sdev, 0); +} + diff --git a/sound/soc/sof/mediatek/mt8195/mt8195-clk.h b/sound/soc/sof/mediatek/mt8195/mt8195-clk.h new file mode 100644 index 000000000000..9cc0573d5cd2 --- /dev/null +++ b/sound/soc/sof/mediatek/mt8195/mt8195-clk.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * Copyright (c) 2021 MediaTek Corporation. All rights reserved. + * + * Header file for the mt8195 DSP clock definition + */ + +#ifndef __MT8195_CLK_H +#define __MT8195_CLK_H + +struct snd_sof_dev; + +/*DSP clock*/ +enum adsp_clk_id { + CLK_TOP_ADSP, + CLK_TOP_CLK26M, + CLK_TOP_AUDIO_LOCAL_BUS, + CLK_TOP_MAINPLL_D7_D2, + CLK_SCP_ADSP_AUDIODSP, + CLK_TOP_AUDIO_H, + ADSP_CLK_MAX +}; + +int mt8195_adsp_init_clock(struct snd_sof_dev *sdev); +int adsp_clock_on(struct snd_sof_dev *sdev); +int adsp_clock_off(struct snd_sof_dev *sdev); +#endif diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 99075598a35a..5bfae9379ac8 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -25,6 +25,7 @@ #include "../adsp_helper.h" #include "../mediatek-ops.h" #include "mt8195.h" +#include "mt8195-clk.h" static int platform_parse_resource(struct platform_device *pdev, void *data) { @@ -231,10 +232,22 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev) if (ret) return ret; + ret = mt8195_adsp_init_clock(sdev); + if (ret) { + dev_err(sdev->dev, "mt8195_adsp_init_clock failed\n"); + return -EINVAL; + } + + ret = adsp_clock_on(sdev); + if (ret) { + dev_err(sdev->dev, "adsp_clock_on fail!\n"); + return -EINVAL; + } + ret = adsp_sram_power_on(sdev->dev, true); if (ret) { dev_err(sdev->dev, "adsp_sram_power_on fail!\n"); - return ret; + goto exit_clk_disable; } ret = adsp_memory_remap_init(&pdev->dev, priv->adsp); @@ -282,6 +295,8 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev) err_adsp_sram_power_off: adsp_sram_power_on(&pdev->dev, false); +exit_clk_disable: + adsp_clock_off(sdev); return ret; } @@ -290,7 +305,10 @@ static int mt8195_dsp_remove(struct snd_sof_dev *sdev) { struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); - return adsp_sram_power_on(&pdev->dev, false); + adsp_sram_power_on(&pdev->dev, false); + adsp_clock_off(sdev); + + return 0; } /* on mt8195 there is 1 to 1 match between type and BAR idx */ From patchwork Thu Nov 18 10:07:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Daniel Baluta (OSS)" X-Patchwork-Id: 12626477 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 66DF5C433F5 for ; Thu, 18 Nov 2021 10:12:01 +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 E822E61B7D for ; Thu, 18 Nov 2021 10:12:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E822E61B7D 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 C391118E1; Thu, 18 Nov 2021 11:11:08 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C391118E1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1637230318; bh=tq8p14dgLQ88hgOrF7/zyMNbI/BoytAk0VK3aYb4eG0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NW3wuRE5+kZ6qPnpTNpisdXKpkvpfTxK2JE6f1iTcktLbLkAopRXhMS2rVtpxouG1 9g9PH/EsjYUuu9oU2jh+ZxB4yqcyxidsyp83fkevlBnpnV3XlizdiAurQnHEHKGBTd /yPUznRIo6FqDBXVQW33Noq22YPYG3iSQU83O1R8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 233CEF80524; Thu, 18 Nov 2021 11:08:40 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 817A1F804FD; Thu, 18 Nov 2021 11:08:34 +0100 (CET) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-vi1eur04on062c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0e::62c]) (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 4D9E1F804E7 for ; Thu, 18 Nov 2021 11:08:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4D9E1F804E7 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="b+T3jkI/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jNr/EDEktVeFK6ECm1rX6TxiDJuIbL4iacFa4PQ8bjoSQc9COR/+jB7Oppo9TS0kS3UNKcuzaTg3ESY4I2D52Gnb/zslaIgdup/xMlLYTw+x6D826R6GzgGWKcxVufDwJTZdCpNUVbWjfLDOPdYoaCKU0mjCahRB12maWiUMamyNoV6HU8X9UM0EX9JnwdddWC7SER+fEAlBXuaYNNySF1BIC/iOxFyNufTI3/aTJrgKE2S9nvxTrSrjfSTa/XpxaeHHxVD/c8rNk5WF/3ILDw6nqbdEWEoLv9HLkYtT+dWwUwhKaTussY//nlN1X+80RkKC90f9znTVT8ix2DQZWg== 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=9qA+AKWCWzOd4laj79fwXpT4DlJBt/zadXCV9ubK1x4=; b=cojsfRs9zDZqLXnAkdQatW8ZscJYz5DSn1ySOCaL5hpF9fGXw58wARfiW2M6ChWUYzxA6K+XSCEr3jMQ6Tj+vZoc1ck2aUzXhqBVYIx5XqgGZfjbrCB0tKBfWFrMuYWXFHBRMtZMWdO1+VisdvIo3f7AV4nGDn1R6DQ/jtHm0rf/7AGLNH18MANIkGaGpGlCRFNMEcDUB5ox0cqXj4JQHsu5WXDOAAFJ+I5BGKmu5wLYIY8eaDZ6fKmkQaKUgVYui+qoVhs+/S0UJPLBSxELLlE25IWdbssPNTU6wGo+e4sRKO4rmqtKF0R8y/QUT3uTJ0fbdS39G3A91Onj5yPPHg== 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=9qA+AKWCWzOd4laj79fwXpT4DlJBt/zadXCV9ubK1x4=; b=b+T3jkI/zUmYAgBOcheD/pAkRqtKqAY3PFJG33UeRhFWSwNAgquZnl325LRa5SsoqPS6tH1kZxyJUpfh63++KuqvlMxAq3dFExESMH8xI2MeMcTIMJD8EWz5twXiM7Jh0DKQxltQfO5rBmFG7tj8TmNTov219H5f9T0ONly7+QY= 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 VI1PR04MB4285.eurprd04.prod.outlook.com (2603:10a6:803:4a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Thu, 18 Nov 2021 10:08:22 +0000 Received: from VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f]) by VI1PR04MB5151.eurprd04.prod.outlook.com ([fe80::85af:f8be:aa99:ba5f%3]) with mapi id 15.20.4690.027; Thu, 18 Nov 2021 10:08:22 +0000 From: Daniel Baluta To: broonie@kernel.org, alsa-devel@alsa-project.org Subject: [PATCH v2 8/8] ASoC: SOF: mediatek: Add DSP system PM callback for mt8195 Date: Thu, 18 Nov 2021 12:07:49 +0200 Message-Id: <20211118100749.54628-9-daniel.baluta@oss.nxp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> References: <20211118100749.54628-1-daniel.baluta@oss.nxp.com> X-ClientProxiedBy: AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) To VI1PR04MB5151.eurprd04.prod.outlook.com (2603:10a6:803:61::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2a02:2f08:5706:b700:863d:d4f3:969f:6fa) by AM4PR0902CA0008.eurprd09.prod.outlook.com (2603:10a6:200:9b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Thu, 18 Nov 2021 10:08:20 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 37125a9c-68a6-47f9-91e1-08d9aa7b5a0a X-MS-TrafficTypeDiagnostic: VI1PR04MB4285: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BtDiLpb0DzPA+LjLsSZw9w7rNm+dkwEXNP5RNrvyNHU+oJOwIx2GJR4UHOXvdSv/Xqkoo4PukO5mT8M7p3r4Kf7RsRM/UXzj6JrEBbkPs0t73/ii8cPeCff/V25D6aQgEApP5Lk/ULxYETb2Mr1zriuYSur+pP9ua88lok4coBWyhpg0qzd2gOa/Q8imBktpe2Xt8K0H6IfHEuiwFgEADUFKzDAyVRgq4lNe02F2BwVr6FaPFM4p6BXqCHBbrVM6/zMCLRiabvJSZIi1b3su4PlbPcSs4+bmK/bU762q8O+8JBO1nNqwyx97Z9MnO4i83s9GBsLgoApi8LSA8bA8O/gDBdL4+TNIdpD1k9Yhszc6bZOtza1sQiPfR3sgOMwU+ZPOFOuDwwXwXVm36eBFjOEW9GAmATv/tb3cWxKN0Hd7yK7OertPH+reSVMhE/BkltVxT59ad5hvhkDUXkfDuhQC6FwfvWXtv9un5cXioxroQH8rO9YTNW1OawLHFvwtLLC3lIP78Pu8fVcU5bK/GzJdbQLdP2tXR6hqOwf0yJux+HnwobWnrJhrkueqVtqXxC2fuPYOKfs2ErgJjb1IRQXJM0Vy73WntZmDKGyWIPap6bHWNsGzy0s55RChUoWuCvFWmNgxdimiFZG55Iey5g== 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)(186003)(8676002)(2616005)(4326008)(44832011)(86362001)(38100700002)(316002)(508600001)(2906002)(52116002)(6506007)(6486002)(1076003)(6666004)(66556008)(8936002)(83380400001)(66946007)(66476007)(5660300002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YJh3SwtL0XWr/6xhGr59nVTXQDWLjpp1vSBR+DRvTdZJMB5zc+t5aXkOpq/dN0dBiLaR9oZKqQB6neJYNh1SsoEYjzlWFkyQeaJSfpxyEg+ilsY0Q7eOWwj7AfzLd4hKZPP9TyM73LEF0YNzTDdoMxWLVOYUoPTrsF/hyZcbGXOCfp9HAj/N2hdLgeiEiHcgOxg0CwyzVA02tztNbed683wydWvP1N0etyGKb9y+oDzYTSKaJsQoU+JidOh0YxdOMVPL40qTif+Wf5raX/2oeUC+nOe3ui5XsS0Lx4uRT4uPcCjCJFfEdczEqe3f1Zt4Q+fYksIYvy4tCf+SwIysHnM66H36QJh8Sbvi3ZKX7lhj7HFqkgPzoIDUs+i71GhcD//gbzTcCD5qS68jMIENETjTMCu2wznEjp63HIdNqvm4yTpAIaIVCuewPTISL1gFVU8n1J2yluJFuftzNkTUODUKxeTr2CY5JbwbCSklOYAaAdJZXejRI0YNmDX3yH0lkdOEeQj7KbvQ0RKDwAmXxwYvXZaDQYF3kf5sFIbj0fvYk8aUHkzhg0tKAvFzKUzd9FK5tQ6seT7oWstbxGuq3Xo1S49vNIPGPMCJvyqqITKKT/oTwmgpzd8uqHrSm2VTK9nOc70ayiE8P+AtLSqffJvpVGoGbiWQAkoQ+wrBkxAxbX17PYkngT8LbYnlfx9FmT3PQVcevuNHbqMdl2mL5Bi1apAGWtpv4utm/HuNxeECtafhpaD8X5+X1ceBKUvWo6DbTF7UsJv1YqtbkvHvUMCvd9IT2VKutE1JZEF5CTQIpUjBq+VaMObhMz9DOPdmTgz+q7ko4mhTFtIIeyiB0uvsoqdoTwQEzHaBv87ZT+SWdRZIpVQQ5E+/nwB2BHPo+nlOFbpdjStvbqV22caDGnkpm3CJ9xX8c+PlMTrQextHkvdFsF6zIj5UG0gyImDtNHpCWfish74hsGoaxeIc4R8f/CXnrw+FHWmMnzdocddN72Jje0ETh+V1wdf+pZW9b/8HlFy5rApF7m9C2t50U3HUpT2ZipoiCfO3U1czI6NQhQR8xMUKdl6I6nlODphvGnf0QB18LcPZlV/vQ8X5OpRPGk7fMTay41GzogMoJZgouZcP6KnQhpBQ1QSxo4Q5nRyWIsu71JGtYRxv2UiAmwefIFpolpBWtK5c1KatKMH2Cko4m49HP85lGfQpgEvYOlt5KFG18JHcUwtMp0e5HeoPVxVD+cNkFltfxq0nXepjH3SfF1GDwv9w2/20IPW0xdg2nzDCc/jIcD08+SgeI5oGEAxlm8JPQ7MwQ1+vn1UTCIQZv1pIekladAl4aq4MgrQXf7sIWBTlw039UT84WQsMwh9qhVfclXY/8ZWzpq+TVLQGiziT6uheIq6yN6noAXChE6/6IbAFW3yterWIuQ8uLPKgiCOOZH6oAvEK9zKNRziLvlccuOLnBJ0qmZJ2rUnGSS3WtZArrgPNbNJRfRDj6SaVrTGaTxh4Hglr0JcmnUhR1jSX0xTrS7hvT2GrtNqO7DKwOlge8qdlgJiky0/RoM2mm1X2homFkzMY4TY2asJJ4e1TT3GcrjNA3x93rHKJLIWGCgW52n20f7Aap/7veawW/J6YLeuOSrAHft2+ufdXxkJnaKGO+lVB7gruS6NAmm3KEvjuNDupOGjJMDryooOK9BhnQ98nBsq906o= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 37125a9c-68a6-47f9-91e1-08d9aa7b5a0a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5151.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2021 10:08:22.0625 (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: +8i5Ubp9v8rWqPUmuLONgX4GRaV9XyEa1Qi/kh+fQnGd+aF6P2UelgXLOEma7+KicDMQ0tz2mfXLHSo98gdO7A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4285 Cc: daniel.baluta@gmail.com, lgirdwood@gmail.com, linux-kernel@vger.kernel.org, pierre-louis.bossart@linux.intel.com, linux-mediatek@lists.infradead.org, yc.hung@mediatek.com, daniel.baluta@nxp.com 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: YC Hung Add DSP system PM callback for suspend and resume Signed-off-by: YC Hung Reviewed-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Signed-off-by: Daniel Baluta Acked-by: AngeloGioacchino Del Regno --- sound/soc/sof/mediatek/mt8195/mt8195.c | 42 ++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c index 5bfae9379ac8..40e5a25875a6 100644 --- a/sound/soc/sof/mediatek/mt8195/mt8195.c +++ b/sound/soc/sof/mediatek/mt8195/mt8195.c @@ -311,6 +311,44 @@ static int mt8195_dsp_remove(struct snd_sof_dev *sdev) return 0; } +static int mt8195_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state) +{ + struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev); + int ret; + + /* stall and reset dsp */ + sof_hifixdsp_shutdown(sdev); + + /* power down adsp sram */ + ret = adsp_sram_power_on(&pdev->dev, false); + if (ret) { + dev_err(sdev->dev, "adsp_sram_power_off fail!\n"); + return ret; + } + + /* turn off adsp clock */ + return adsp_clock_off(sdev); +} + +static int mt8195_dsp_resume(struct snd_sof_dev *sdev) +{ + int ret; + + /* turn on adsp clock */ + ret = adsp_clock_on(sdev); + if (ret) { + dev_err(sdev->dev, "adsp_clock_on fail!\n"); + return ret; + } + + /* power on adsp sram */ + ret = adsp_sram_power_on(sdev->dev, true); + if (ret) + dev_err(sdev->dev, "adsp_sram_power_on fail!\n"); + + return ret; +} + /* on mt8195 there is 1 to 1 match between type and BAR idx */ static int mt8195_get_bar_index(struct snd_sof_dev *sdev, u32 type) { @@ -382,6 +420,10 @@ const struct snd_sof_dsp_ops sof_mt8195_ops = { .drv = mt8195_dai, .num_drv = ARRAY_SIZE(mt8195_dai), + /* PM */ + .suspend = mt8195_dsp_suspend, + .resume = mt8195_dsp_resume, + /* ALSA HW info flags */ .hw_info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |