From patchwork Thu Jun 22 15:23:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5158217vqr; Thu, 22 Jun 2023 08:37:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7uWzwilFXiRuS28d8WZCVNCF++bm61CvThZzMGWcgFxsvI7qxVFIhK2cJNP3U7ycStYsH3 X-Received: by 2002:a05:6a21:32a0:b0:120:80ba:3df0 with SMTP id yt32-20020a056a2132a000b0012080ba3df0mr9243843pzb.27.1687448242733; Thu, 22 Jun 2023 08:37:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687448242; cv=pass; d=google.com; s=arc-20160816; b=zd5aBXVMR8Zf9Q0/7eAJAU/aAVPz830AUpR01SQ98GxMsm6gsk/Jl7smg+6y3a5oHG bH5ra04YsZ8QJMEJBpHo9hARMSuS+w1ylLiiz/YCG3GKOgjR75bGdinVHIahcijMoMZs j93YF+B1scAAF27xB8x/0b7g8H98OcZYHsHSUGSPxMPRLdDEviJXo4wEM9EgiqHV8j+P /wa6AWi/rlJzQ2WISsexYLaPTCtXMXBzjOQ6UeYQ9lZVz//Z9AYlcbkKc9CBtO4wM8d9 5bV6m/DItcy+kScfWKXmt21uDuzQ8gGAXKrob/Siv2C8dr8Ut+gVxasEcWItuUvdaSeb hEYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZvE7+sHAx7gFFMEXYrdJmw8Y+MxDll2Zrp6Zoj6FHjM=; b=kDr5mNHVv+2WxRCEJc+BVg2EzSNQmZzxTi8X3YxMpFrecp8V88Eb8IZX3M7ZNSV9Pt 8dFwAma7ZxRokeKRMpypmWWCNb7/5uzX8eTfQ/2OD/fU/iN+SLTvq3juvdY9wNWC6cbC QlnHc+KHhYttobXdNx1ii/BCcx/0w82U4Ww15c0CQ00lNlT8/fpuFtn9Wi0IVt2E7Yuj zkSV/wmU7+cAb2JZZDXAKrYNZPxt3i8+vcLVYxSy9xNn6EpCABzNo9QH4lDTlzW5vDCN FhGeCYQnEnfS9QfjyEk1R7Al/WlZIhI0i/aF+BmiMzy+uawRWiMkq4zO4aczel7XCWWE QGdg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=tNEesaUz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 139-20020a630091000000b00557373e6f7asi3480361pga.515.2023.06.22.08.37.09; Thu, 22 Jun 2023 08:37:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=tNEesaUz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232265AbjFVPYf (ORCPT + 99 others); Thu, 22 Jun 2023 11:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231734AbjFVPYd (ORCPT ); Thu, 22 Jun 2023 11:24:33 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2069.outbound.protection.outlook.com [40.107.94.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CD12197 for ; Thu, 22 Jun 2023 08:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jmKXd5qjNjfOYyaSCjJmr45XOhg9Hi3eWuhYC29qt5fl1AJ6iQlzt63RpFQ4hHRZPnxPGwlR77noVT1p6teb3T+9iTuO+1BmUr5u1xou34MQT73XXKxY0zAs6JdpBUxU6pBkVS3yyqPyDFpRKFT8Tz70523hO8rLtz/WIGOzOQc1EW0R/14PpLc/M8t/1BnTdqWCHbPwV8E6M52cJUif8m/jKfxzAMU4uBMQZMRlif7oXIcB+cz5Yfw/KpJS0vCR/E65cLOwe+sQwZi/+PnpNq6EREtiwRCd6lnQXkoHooYa8hjgykBMngcBZhuL9DiNMdJtGECIYJfohM0KJq1gHQ== 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=ZvE7+sHAx7gFFMEXYrdJmw8Y+MxDll2Zrp6Zoj6FHjM=; b=doxce6imwRpfvvNSauUCto86qdA9B/JzfpizRl+AKD/99deHTW/zg6aR94+KI8AAIM7erIc1xDY/WNk5039WYiXOVzjJzACfYWAK6GVtnxmtSPDcKtxqqp6iAgEBW4Qosy9yIcwiVTgXziOxYiaT3cXbXdiCtFC6W5+yyA+tuKAn5n/UErZKCpwRcjXgmB2MiF6DpjIn59KgCCfWI73hov40yBHeyF98oon/A8qGaGLvlI94+Op3wATMdLjR5NPl2P0naMOPRNnbk5Ezd1tFz+1m8tiySdaJ9Sdyp2+dzYm5nimr9tL8WmdZFAknmjtLyObCxFp4bv6yd5K7DO9elg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZvE7+sHAx7gFFMEXYrdJmw8Y+MxDll2Zrp6Zoj6FHjM=; b=tNEesaUzP8+/zpd+LAi6FMPrl/Hbf3g++gpnLN/CPtGJQFHRxUR/RM/JmWdACsI+oHDxl17tg+WS3hA1/P5mquvlMFoGN/etg25USEMsehCw9S00kJFTMrWEIs9E6Q/hiBqdNVEg5NWgptUxrCbtA25nB5yh+b+W58jSiWX3q/Y= Received: from MW3PR06CA0009.namprd06.prod.outlook.com (2603:10b6:303:2a::14) by DS7PR12MB6287.namprd12.prod.outlook.com (2603:10b6:8:94::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 22 Jun 2023 15:24:26 +0000 Received: from MWH0EPF000971E3.namprd02.prod.outlook.com (2603:10b6:303:2a:cafe::fe) by MW3PR06CA0009.outlook.office365.com (2603:10b6:303:2a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:24:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000971E3.mail.protection.outlook.com (10.167.243.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.19 via Frontend Transport; Thu, 22 Jun 2023 15:24:25 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:24:25 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:24:24 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:24:21 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , "open list" Subject: [PATCH 01/11] ASoC: amd: acp: remove acp poweroff function Date: Thu, 22 Jun 2023 20:53:39 +0530 Message-ID: <20230622152406.3709231-2-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E3:EE_|DS7PR12MB6287:EE_ X-MS-Office365-Filtering-Correlation-Id: 8eca2618-32fa-4c10-1a87-08db7334c3a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e3qUePiNR8Ra8HXL5HEyspS96cXAuTX0KqxO/DbICt5TMTtq/V3+vQUwFsPTkVCqXSbQhq7VFyNnuh1Q7VToT4x0aA0bmotqYZIUTtBMYbZ/NgF6k2AMSkGmaO4XbEnxjj9Vv+KwFKTJJU39jMiC9LGmT0Q/DsrVXM4rq44jgGGow9McF6SqePOqiIoDxNX/k9BFfonlnsw0TA37euk/qv7C1RDQ2B4jMBZWGpdVRTf006jRLgDsPFNFVRYNFP8GKDOPAy5V+Vp4CEc0gAaBU++mPuGlYJcj8LLOkInq5OYDftRqBbVJ625gulBVl0dzmqseD1Dq5VnVRRK/f3zDGE8UrE5XjnJlomxO3ICJHCISyODdEDTyKKhnDLX72k31Av4QBF4TsCKjtnHwguVpSbm4fBXi8cJu/tnmnGsPkqox2/7z+xvSmNDYo5ikPf5F9rf+gxec9u1mNIlPwD4d9cyxEeV4nvCOUQWBf4eZRrGv+nAyAnsWJKE0bdmdHg0MGUiAOQ+6+xYCcav1+4g9I91c0my8TYo6/YP8qUlaR1c3aw4d6szK2+y5ePQ4eyjziANVJcuBWBgkQEpeOqBTECu0U5xnD0CHH+uSOYjJJNpRcfWvAwg4oqVPbP26a9XUYxOsM+C3nj26dbv/+ufiSBHbDlkUxGNOl8woUVI/F3hGV+jmgUgXmxXTYDf4+SQ/wNBgosl56Y/urINNDNbuIddGlz5c/WXnYJgSeENEE7KMkNVyBpzhxSeZLi/7MmM7EnAzawz6znHUXwRtmgHvcQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(26005)(2906002)(8676002)(8936002)(86362001)(70206006)(316002)(4326008)(70586007)(478600001)(41300700001)(54906003)(110136005)(5660300002)(82740400003)(82310400005)(83380400001)(6666004)(7696005)(36860700001)(47076005)(336012)(426003)(2616005)(40460700003)(186003)(81166007)(356005)(1076003)(36756003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:24:25.9521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8eca2618-32fa-4c10-1a87-08db7334c3a5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E3.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6287 X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, TVD_SUBJ_WIPE_DEBT,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769417728681590448?= X-GMAIL-MSGID: =?utf-8?q?1769417728681590448?= BIOS invokes ACP Power off sequence based on ACP device state. Remove redundant code from ACP PCI driver for ACP Power off sequence. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-rembrandt.c | 25 ------------------------- sound/soc/amd/acp/acp-renoir.c | 17 ----------------- 2 files changed, 42 deletions(-) diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 5c455cc04113..1b997837c7d8 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -204,23 +204,6 @@ static int acp6x_power_on(void __iomem *base) return -ETIMEDOUT; } -static int acp6x_power_off(void __iomem *base) -{ - u32 val; - int timeout; - - writel(ACP_PGFSM_CNTL_POWER_OFF_MASK, - base + ACP6X_PGFSM_CONTROL); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP6X_PGFSM_STATUS); - if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_OFF) - return 0; - udelay(1); - } - return -ETIMEDOUT; -} - static int acp6x_reset(void __iomem *base) { u32 val; @@ -299,14 +282,6 @@ static int rmb_acp_deinit(void __iomem *base) } writel(0x00, base + ACP_CONTROL); - - /* power off */ - ret = acp6x_power_off(base); - if (ret) { - pr_err("ACP power off failed\n"); - return ret; - } - return 0; } diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index b3cbc7f19ec5..f188365fe214 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -169,17 +169,6 @@ static int acp3x_power_on(void __iomem *base) return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); } -static int acp3x_power_off(void __iomem *base) -{ - u32 val; - - writel(ACP_PWR_OFF_MASK, base + ACP_PGFSM_CONTROL); - - return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, - (val & ACP_PGFSM_STAT_MASK) == ACP_POWERED_OFF, - DELAY_US, ACP_TIMEOUT); -} - static int acp3x_reset(void __iomem *base) { u32 val; @@ -246,12 +235,6 @@ static int rn_acp_deinit(void __iomem *base) return ret; writel(0x00, base + ACP_CONTROL); - - /* power off */ - ret = acp3x_power_off(base); - if (ret) - return ret; - return 0; } static int renoir_audio_probe(struct platform_device *pdev) From patchwork Thu Jun 22 15:23:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5155496vqr; Thu, 22 Jun 2023 08:33:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mEWFCKA2Vb2lULXbFLWbEpD5NrClpLxYecNX3dtfCpqaKP3syYSNhGy1FPpRA9HPqKYQV X-Received: by 2002:a05:6a20:6a27:b0:10f:8b61:197c with SMTP id p39-20020a056a206a2700b0010f8b61197cmr9112269pzk.54.1687447988296; Thu, 22 Jun 2023 08:33:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687447988; cv=pass; d=google.com; s=arc-20160816; b=0N9GZbv8i1y0+FqueLEGjoBQoyQsPTk405ZzGlU9NKfsXu7DcISq3FKpfP9V7EGiA/ 1jXS/HWsbPUtYjVAIknX0lfj/M3Ms4x9wimQCd8OYaKEhhAZv660KjfiON7lj74jiCkq USESbVMC9/d+GaUtGNmmVv2sZy4uzNjwDN5szmWHMrtDgeD1glA+Rkuux/3fPi6y4t7g +eLXVl73jCSiHUYP/SCLaSmxJpymJEH0btdLZJUPJm/BseCHjRjDi4fdUvwh3ZS583Mz NyG+34PqbnfFmLAZE0CG1m6Gpos2zdRuZmI0xWRwUQXsEaY6WnvfQSwtFTGLkWfhD+sC gx9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=d8Kj6Twc48hub+oy54t5cQGk39t2eOzsoZiUkZ/FU34pgFYvqEgaNpcdqH8RnUQ/5n WESfMk22EN8gYf5a2DXz0G1fbFvCPoGOzEZX5G48Qw8VhPq8JCoxBk6x5Iy6jgGl4a6P CvmeXdwYccVjaCd/jdS5KdnsPNLzqdcpZEgnwF0DJgChqOP5gIT4mbdY7Sm9OUnYSPA9 l/4BYG64yvJ8bgIV9xWvs8uxRrqqI0/PRNqiV8LHFmk7HaqP0PsJAfYweyCqR7ZWiubX vv0yHRcINFpRQMCZhUTqaeyOEv/ngRtKKS+FfwqvaNpjZ2yxcYzrP+qVQuVaqjIkGfQi SfyA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=kTgoSKG2; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u75-20020a63794e000000b00534784002afsi3291213pgc.807.2023.06.22.08.32.40; Thu, 22 Jun 2023 08:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=kTgoSKG2; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229972AbjFVPYz (ORCPT + 99 others); Thu, 22 Jun 2023 11:24:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232388AbjFVPYt (ORCPT ); Thu, 22 Jun 2023 11:24:49 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2040.outbound.protection.outlook.com [40.107.93.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECEFEE75 for ; Thu, 22 Jun 2023 08:24:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QhRd8AK5DysTdA/gMZIVZpOE0B787K6azNewMNEJzvXdsHyCpbekoLYPqCXmO+Juy67ZII0XxK14hyULVqII/kw4cYHWi4ntpfvn0KJWHIddc6qbjOD7f9stXjuRIBTsTR0L/fVEOmeszXZT9NsyiRqSifJY+r10Q1bRt4u7lCPEeu2A9t21+ZsrvGw4hJx2Dwl42olvw+KzudhwYhC0MKAuzJGEeFijVVm+ReRd7sZPtnrztvZ6g4RmI9nsLybjQkie6cLzOm1ByUJYir4Zfo4W8vGIybKoTCJtZmZ/60ZXDMaIAwKEtkhTcucMzLGRUOm2jUkaW/VDBaEQM03MoA== 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=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=Yv8BxllOBy+/M2UGrWmD/dOzH9INsov0ufOob14UXjjoSnxFz6V/tGvcc40+T1Rx02GtUTYOc1OL/294GlLYEaLxzcDAep2uQu5IGT0Yc0kDoQxSWvpEmYUIL34JSFkZ/bjpe/nnGv50gsSNiopUME5Hclsrt15L31oqjJs1TA7D4+0513O+9KgJ6IrCQ9+EMRABbwP7Z8uBCw/4wjKFvHpkm+aTkZOq3+kqdjA6lHW5ZXe3WUit3HuW5dWa8iJOrOlMxs9BU117WCG4o4jL6IgVTv0NRQo3nvcmMwNur3go94L7atzsDiiwHQtGUjO4H3k9kXJykzAV0xLPSfvIAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=kTgoSKG26E2TDBH1EqNBtwdGdoE4L7cP09JpN3SLYVI9pVqWFL+asZCmrUK00T7AjSurITUbtRHJXqBod1hr0Gsh/pE4gAOiZT5eJvY0K9fOKsz6E6XZCBgukcQ2z4VQKOY2Ejwib+reEQQdk2hwRBE7Fy4f2FHrNXxDkwqz908= Received: from MW4PR03CA0020.namprd03.prod.outlook.com (2603:10b6:303:8f::25) by IA1PR12MB6089.namprd12.prod.outlook.com (2603:10b6:208:3ef::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 22 Jun 2023 15:24:44 +0000 Received: from CO1PEPF000042AA.namprd03.prod.outlook.com (2603:10b6:303:8f:cafe::78) by MW4PR03CA0020.outlook.office365.com (2603:10b6:303:8f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:24:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000042AA.mail.protection.outlook.com (10.167.243.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:24:43 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:24:43 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Thu, 22 Jun 2023 08:24:42 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:24:38 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Yang Yingliang , Venkata Prasad Potturu , ye xingchen , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Nicolas Ferre , Ajit Kumar Pandey , open list Subject: [PATCH 02/11] ASoC: amd: acp: refactor the acp init and de-init sequence Date: Thu, 22 Jun 2023 20:53:40 +0530 Message-ID: <20230622152406.3709231-3-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AA:EE_|IA1PR12MB6089:EE_ X-MS-Office365-Filtering-Correlation-Id: 91332e55-c33d-4ede-2952-08db7334ce3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wmTNq3T3shNl5itN5lJx2YmcueQmomwQ47W+OeyoQxMQiRxRV+ljtwamOhDVywhe6Z3HYjedoHQBv/eijk8M7dnA75TSUGOOy7bTT5KVkHBPoZY1B3zDlmVcXhS672gh1M5vk+L8ZgJJDRifltaUAEUarXL7l3O8DgU4pZkKMHRzTJU3T0AJJ3Bge/zbCAwCT5tlDScDTBolvrba2UaRi3TXAU8jmme8hyNXPsa8dKK2Qu/Z94GTL5NWQV+urqu9mtib+CQijj2wslLibB7wUSlREYXWHhTm5SycDAGDhoO5NDcOEhNvd+366NHCRezYPv7WHAywbQjXzR2fL+PjmdCKX7Kh67arM3uD9y1ZYGgEIE2RTj7KxZnns1/9ohKUcGriK0Y+WFhZU9e5et0IsH/GdXVCH0q0xyeq6rVJ+gq5Q8hL11bPZVjx7pln+tbp+oZvjFZgV3AyDVl3y0mH+gDt/KJKhnRuuoyd7OjVHEt6RXO6xubTR+oUSYwvHuTdS3m2sud8HztDEHfYXO0LHbIoKCuwifV6vha2U2vvbkiIzVGgDJEzo8gcsv2MpV4v2B1q7FZUtiVHI2yIIySJwhQM5EVuJN5yaj5SywcabISXHWANUQU7ld0hLxyA8h/n9AuExRnq4WPXXVerjXwI3j3tH1Y7ihiqV5xBUTk/m7m2D1QPi3ikGyx3izxRiTPgMLDD3A9Oed17Nri8IIXSNjpliCCKy+lWJyK/V215LbqRPkM2wBLXgf0nCh3/tiR4+LJNHwJVL8voNL6g0v1XjQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(376002)(136003)(396003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(478600001)(110136005)(6666004)(54906003)(4326008)(47076005)(40480700001)(83380400001)(426003)(2616005)(336012)(86362001)(36756003)(36860700001)(40460700003)(30864003)(70586007)(2906002)(82310400005)(1076003)(186003)(7696005)(26005)(81166007)(356005)(82740400003)(70206006)(316002)(41300700001)(8676002)(8936002)(5660300002)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:24:43.6946 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91332e55-c33d-4ede-2952-08db7334ce3d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AA.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6089 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769417398758817590?= X-GMAIL-MSGID: =?utf-8?q?1769417461722449615?= Remove the individual acp init and de-init functions from different variants of acp pci driver(for renoir/rembrandt platforms) and use a common file to define callbacks and refactor the callbacks to support existing platforms. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/Kconfig | 4 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-legacy-common.c | 99 +++++++++++++++++++++++ sound/soc/amd/acp/acp-pci.c | 9 +++ sound/soc/amd/acp/acp-rembrandt.c | 110 -------------------------- sound/soc/amd/acp/acp-renoir.c | 92 --------------------- sound/soc/amd/acp/amd.h | 21 +++++ 7 files changed, 135 insertions(+), 202 deletions(-) create mode 100644 sound/soc/amd/acp/acp-legacy-common.c diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index ce0037810743..6a369e5d825c 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -18,6 +18,9 @@ if SND_SOC_AMD_ACP_COMMON config SND_SOC_AMD_ACP_PDM tristate +config SND_SOC_AMD_ACP_LEGACY_COMMON + tristate + config SND_SOC_AMD_ACP_I2S tristate @@ -28,6 +31,7 @@ config SND_SOC_AMD_ACP_PCM config SND_SOC_AMD_ACP_PCI tristate "AMD ACP PCI Driver Support" depends on X86 && PCI + select SND_SOC_AMD_ACP_LEGACY_COMMON help This options enables generic PCI driver for ACP device. diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index d9abb0ee5218..4e65fdbc8dca 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -8,6 +8,7 @@ snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o snd-acp-pdm-objs := acp-pdm.o +snd-acp-legacy-common-objs := acp-legacy-common.o snd-acp-pci-objs := acp-pci.o #platform specific driver @@ -22,6 +23,7 @@ snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o +obj-$(CONFIG_SND_SOC_AMD_ACP_LEGACY_COMMON) += snd-acp-legacy-common.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c new file mode 100644 index 000000000000..5b7000eae693 --- /dev/null +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2023 Advanced Micro Devices, Inc. +// +// Authors: Syed Saba Kareem +// + +/* + * Common file to be used by amd platforms + */ + +#include "amd.h" +#include + +static int acp_power_on(struct acp_chip_info *chip) +{ + u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; + void __iomem *base; + + base = chip->base; + switch (chip->acp_rev) { + case ACP3X_DEV: + acp_pgfsm_stat_reg = ACP_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP_PGFSM_CONTROL; + break; + case ACP6X_DEV: + acp_pgfsm_stat_reg = ACP6X_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP6X_PGFSM_CONTROL; + break; + default: + return -EINVAL; + } + + val = readl(base + acp_pgfsm_stat_reg); + if (val == ACP_POWERED_ON) + return 0; + + if ((val & ACP_PGFSM_STATUS_MASK) != ACP_POWER_ON_IN_PROGRESS) + writel(ACP_PGFSM_CNTL_POWER_ON_MASK, base + acp_pgfsm_ctrl_reg); + + return readl_poll_timeout(base + acp_pgfsm_stat_reg, val, + !val, DELAY_US, ACP_TIMEOUT); +} + +static int acp_reset(void __iomem *base) +{ + u32 val; + int ret; + + writel(1, base + ACP_SOFT_RESET); + ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, + DELAY_US, ACP_TIMEOUT); + if (ret) + return ret; + + writel(0, base + ACP_SOFT_RESET); + return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); +} + +int acp_init(struct acp_chip_info *chip) +{ + int ret; + + /* power on */ + ret = acp_power_on(chip); + if (ret) { + pr_err("ACP power on failed\n"); + return ret; + } + writel(0x01, chip->base + ACP_CONTROL); + + /* Reset */ + ret = acp_reset(chip->base); + if (ret) { + pr_err("ACP reset failed\n"); + return ret; + } + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_init, SND_SOC_ACP_COMMON); + +int acp_deinit(void __iomem *base) +{ + int ret; + + /* Reset */ + ret = acp_reset(base); + if (ret) + return ret; + + writel(0, base + ACP_CONTROL); + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON); + +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index a0c84cd07fde..d3b2ccbe7fd8 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -107,6 +107,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id goto unregister_dmic_dev; } + acp_init(chip); res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL); if (!res) { ret = -ENOMEM; @@ -155,10 +156,17 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id static void acp_pci_remove(struct pci_dev *pci) { + struct acp_chip_info *chip; + int ret; + + chip = pci_get_drvdata(pci); if (dmic_dev) platform_device_unregister(dmic_dev); if (pdev) platform_device_unregister(pdev); + ret = acp_deinit(chip->base); + if (ret) + dev_err(&pci->dev, "ACP de-init failed\n"); } /* PCI IDs */ @@ -178,4 +186,5 @@ static struct pci_driver snd_amd_acp_pci_driver = { module_pci_driver(snd_amd_acp_pci_driver); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(SND_SOC_ACP_COMMON); MODULE_ALIAS(DRV_NAME); diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 1b997837c7d8..59b1653b8479 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -24,26 +24,6 @@ #define DRV_NAME "acp_asoc_rembrandt" -#define ACP6X_PGFSM_CONTROL 0x1024 -#define ACP6X_PGFSM_STATUS 0x1028 - -#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 - -#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 -#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 -#define ACP_PGFSM_STATUS_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_POWER_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define ACP_POWER_OFF_IN_PROGRESS 0x03 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - - -static int rmb_acp_init(void __iomem *base); -static int rmb_acp_deinit(void __iomem *base); - static struct acp_resource rsrc = { .offset = 0, .no_of_ctrls = 2, @@ -180,54 +160,6 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = { }, }; -static int acp6x_power_on(void __iomem *base) -{ - u32 val; - int timeout; - - val = readl(base + ACP6X_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STATUS_MASK) != - ACP_POWER_ON_IN_PROGRESS) - writel(ACP_PGFSM_CNTL_POWER_ON_MASK, - base + ACP6X_PGFSM_CONTROL); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP6X_PGFSM_STATUS); - if (!val) - return 0; - udelay(1); - } - return -ETIMEDOUT; -} - -static int acp6x_reset(void __iomem *base) -{ - u32 val; - int timeout; - - writel(1, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK) - break; - cpu_relax(); - } - writel(0, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (!val) - return 0; - cpu_relax(); - } - return -ETIMEDOUT; -} - static void acp6x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -248,43 +180,6 @@ static void acp6x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rmb_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp6x_power_on(base); - if (ret) { - pr_err("ACP power on failed\n"); - return ret; - } - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - return 0; -} - -static int rmb_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - writel(0x00, base + ACP_CONTROL); - return 0; -} - static int rembrandt_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -303,8 +198,6 @@ static int rembrandt_audio_probe(struct platform_device *pdev) return -ENODEV; } - rmb_acp_init(chip->base); - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -345,9 +238,6 @@ static void rembrandt_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip = dev_get_platdata(dev); - - rmb_acp_deinit(chip->base); acp6x_disable_interrupts(adata); acp_platform_unregister(dev); diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index f188365fe214..a73fd70171c1 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -25,20 +25,6 @@ #define DRV_NAME "acp_asoc_renoir" -#define ACP_SOFT_RST_DONE_MASK 0x00010001 - -#define ACP_PWR_ON_MASK 0x01 -#define ACP_PWR_OFF_MASK 0x00 -#define ACP_PGFSM_STAT_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_PWR_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define DELAY_US 5 -#define ACP_TIMEOUT 500 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - static struct acp_resource rsrc = { .offset = 20, .no_of_ctrls = 1, @@ -154,38 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; -static int acp3x_power_on(void __iomem *base) -{ - u32 val; - - val = readl(base + ACP_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STAT_MASK) != ACP_PWR_ON_IN_PROGRESS) - writel(ACP_PWR_ON_MASK, base + ACP_PGFSM_CONTROL); - - return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); -} - -static int acp3x_reset(void __iomem *base) -{ - u32 val; - int ret; - - writel(1, base + ACP_SOFT_RESET); - - ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, - DELAY_US, ACP_TIMEOUT); - if (ret) - return ret; - - writel(0, base + ACP_SOFT_RESET); - - return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); -} - static void acp3x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -206,37 +160,6 @@ static void acp3x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rn_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp3x_power_on(base); - if (ret) - return ret; - - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - return 0; -} - -static int rn_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - writel(0x00, base + ACP_CONTROL); - return 0; -} static int renoir_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -256,12 +179,6 @@ static int renoir_audio_probe(struct platform_device *pdev) return -ENODEV; } - ret = rn_acp_init(chip->base); - if (ret) { - dev_err(&pdev->dev, "ACP Init failed\n"); - return -EINVAL; - } - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -300,17 +217,8 @@ static void renoir_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip; - int ret; - - chip = dev_get_platdata(&pdev->dev); acp3x_disable_interrupts(adata); - - ret = rn_acp_deinit(chip->base); - if (ret) - dev_err(&pdev->dev, "ACP de-init Failed (%pe)\n", ERR_PTR(ret)); - acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 5f2119f42271..83c9a3ba8584 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -92,6 +92,25 @@ #define SLOT_WIDTH_24 0x18 #define SLOT_WIDTH_32 0x20 +#define ACP6X_PGFSM_CONTROL 0x1024 +#define ACP6X_PGFSM_STATUS 0x1028 + +#define ACP_SOFT_RST_DONE_MASK 0x00010001 + +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 +#define ACP_PGFSM_STATUS_MASK 0x03 +#define ACP_POWERED_ON 0x00 +#define ACP_POWER_ON_IN_PROGRESS 0x01 +#define ACP_POWERED_OFF 0x02 +#define ACP_POWER_OFF_IN_PROGRESS 0x03 + +#define ACP_ERROR_MASK 0x20000000 +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xffffffff + +#define ACP_TIMEOUT 500 +#define DELAY_US 5 + struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ @@ -168,6 +187,8 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +int acp_init(struct acp_chip_info *chip); +int acp_deinit(void __iomem *base); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); From patchwork Thu Jun 22 15:23:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5154802vqr; Thu, 22 Jun 2023 08:32:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+O01gcCDYsdzHcxu4b+4IbcagKnhkBhnBpLtUNfSat8Uqph0PccM+CO/2WFpUC4jDBUt7 X-Received: by 2002:a17:90a:1089:b0:25b:c8b7:9e5b with SMTP id c9-20020a17090a108900b0025bc8b79e5bmr18771183pja.31.1687447928249; Thu, 22 Jun 2023 08:32:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687447928; cv=pass; d=google.com; s=arc-20160816; b=cKFWpoKqavXLtckKUR0B3eJHl/g22zW3FJVFHcxxAc1eQ6FoGwv1X9oQzD7Z8Pw8r6 TijlL5QwQ6lj7CyrzUQGspHeGHbMap2I6ZEELzVuBVOusmQc4fPiIHIPt6H5YEiSsKrw 1zjEHEDSOeb3L542jJtKoWSLf6WnA49EbT01FNYQJpAJ5ZyZnJK5mPokpR3h91DjGREZ 5GCD8uURPNJAd1wZEJ6wM/a06Q2TVXiDM5I/yT7qmJm5+EoabC617B+W0t3guQfs3S+X AoiAV4AXemdUZoIdGhoua/bWutL8lzCrrM8kM5hHG/Ssc8OjCgpydomdPz6h109WFtTo 7K6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=YBnOUUPV0xO9EhqmRcLXQFQqUoQEwpvdPVfaAGHibHYRlFcI//enlN4b0kA+mIWKA2 XScBsoOXjMTlSQEPEP3WIb1N9zEwgJJ9reGNFbrgxrXH7uGcs25nQR4CVuE9OSousnob IC78HQBOJZxuz6IgXVvEcojv8Zc9AAP8quDM3xvCP11lxhoPjv8m4cGFtlgCLE+8rICV wlaSokn5UVGrRHHAXLQ0y+zCfYBsYRRPgPTBvK8rtQWkzpqqrS7U9BXjKzvFd2CTmhg0 A0AlQ731Nq4ZBpGKK9js2Tn44vZMDtWuQiJetzkh03TX6E4yD3nkQI7mtcGpvPUzzJSI mEKg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=dmzc10NU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 14-20020a63010e000000b0054033bf35f4si6432198pgb.773.2023.06.22.08.31.46; Thu, 22 Jun 2023 08:32:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=dmzc10NU; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbjFVPZp (ORCPT + 99 others); Thu, 22 Jun 2023 11:25:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232369AbjFVPZm (ORCPT ); Thu, 22 Jun 2023 11:25:42 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2081.outbound.protection.outlook.com [40.107.94.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D826E6E for ; Thu, 22 Jun 2023 08:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ja7CW6rsBCt6sJie/UwgLG274fdZUyMGJOf87cQnU5R7mEzN0RfHEgxsz4f+szjY32XHaE4ZEPXNfzV7+mInhSa9XbTfDaWYF5gQj5DFqAUrhbm6cFlzD1OMiknY3JPT6G48Td9jsyFbv5mtEpOdh3N3sWhlkWaxtJtfu+CkBihOow0STIwopUVcUG6qHGuxfDifLnikhDTjb3WVsqzNlIA5IhtvgNBtpFdBGXLGQZgZuwoo8KpHGq/dn5+rMxxYR91f7FQnRC4gqHE7iA6FqNs05MrfMjh/3P8BfKf5+r0/3nsvu2DIAw2paIkqnC2/JTdGYLeqIozq1GeLKm9Deg== 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=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=UeO8pJX2TMY9txk5mWPC/fX3zXWBdotCAFHRzOZhqTIsEM3oMf+CJH5Sfdzzp/nzfk6b04SKMP2so68q504ZaPc4VHUdQcWi2x4IPCXiVyaWLlnNXvYg0xkCDt0oWc8RnUark71zAWaUnbL5noSCb2bae3aAInQXRkpQVAlwkZpGlL58k+InoirwdpUjO7p59/cjfwCsW4Q2TrMVWYbGRDd8PpjWczLgkkMkpVDKSBwxfQ9FGWaMQdVmuZGIYd8OwT0/g3oHiQ8/Ys79wz3+A9MLPpjy67IsqQ3yhCKQdX9thwg640JTT0huLQIknBCHCDND2g50qKEgDK2epY10Ig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gycwDhAyFF+K1xbN3kqPBoobKHCJK/+BUp0Tu2LksTU=; b=dmzc10NUEpjOP+8/2gwAV7+lFB+UdRkiLP0HhyBXRHdFQx1vberrFb5vbt9Tm+Sm8A6M0Eyyy0D+lMjRQ/LmuPxQm6pPQyvoA5fYkriqeduVWemnweMGRIKyOB3/CLMvWUGo84U4yZohbBUcNxPiP3lZp9aGDd5bjHxybRycp50= Received: from MW4PR04CA0221.namprd04.prod.outlook.com (2603:10b6:303:87::16) by CY5PR12MB6035.namprd12.prod.outlook.com (2603:10b6:930:2d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 22 Jun 2023 15:25:23 +0000 Received: from MWH0EPF000971E8.namprd02.prod.outlook.com (2603:10b6:303:87:cafe::94) by MW4PR04CA0221.outlook.office365.com (2603:10b6:303:87::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:25:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by MWH0EPF000971E8.mail.protection.outlook.com (10.167.243.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:25:21 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:25:21 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:25:20 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:25:16 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Yang Yingliang , Venkata Prasad Potturu , ye xingchen , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , "Ajit Kumar Pandey" , open list Subject: [PATCH 03/12] ASoC: amd: acp: refactor the acp init and de-init sequence Date: Thu, 22 Jun 2023 20:53:43 +0530 Message-ID: <20230622152406.3709231-6-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000971E8:EE_|CY5PR12MB6035:EE_ X-MS-Office365-Filtering-Correlation-Id: 49c02349-33a5-4ab6-ef7e-08db7334e50b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F/KayTk/RkMTN5WItat2G2Sq99kvZNiyEw1zJD7el/JZau2VBTzksDDfuhVkh6ZAUQaHqyaohl8ZLaD8+J+//l5a7w10R0ySarmBv6Jj6X+ulK0KBLavxX7vGVt3tvjLdqBJp1bI1o5TVI7vzzWBLYf8XIBJxyFjKcGffbIWIh7mFZUzOwPpSJ9MfPhFb1KBp4Ry27MElLFVXkqU2eTwVAWwR9lljX9LO7OLUglhN5XNxkGReVaQ0ijrUXvap6EzWI//F68/jhGsxTFS8OpETU9UwX1jFDGQitooRiE96O8V6sOYE5F78u5MspOCixZMZHtClNss0C/ABKKMbR1ze9ja9C+mPJ3p6MQtd0vZY5Z9Ilyv0kXP5QqaCMQy0ffrOGR/FL3IrVHHoIgLjF5kwo4Dmlq/4ci9E5OYTvuY7LBMCFyJPjiGmt8tK4modUQzeR+QU0RLxOyLe/4oo0a2rqdPlUV4SGPl2IrlPyvSaPUYROLzEMztHXqw9rrglqSc9Hs3yIYO8dPAIAFESFbBD3eHfqotbTCP1L5SA62T0czgm58sjlU4fJazy5FnbvcsPCG7a+RefjbZgIMcisFdHmpSzzC67R76Qw/i/7Y4GcZ2uQqjRDy5onFvi6DkbicDfmZNizHZZaMbKXCGc+cDZjF8fser2poL+EIm8sn7IrgsM+0mxK+VLW0GLazKIVQjOswWHs+BOJfQY46v6FDQpjhOLCxZkh/C08ubznMqZiQoyFJxtspz+s+X/Kc/3fKkfLZOHespf7NncFzRfON7rw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(136003)(376002)(396003)(346002)(451199021)(36840700001)(40470700004)(46966006)(70206006)(1076003)(186003)(26005)(8676002)(2616005)(336012)(7416002)(82740400003)(83380400001)(426003)(7696005)(82310400005)(36756003)(2906002)(47076005)(36860700001)(478600001)(6666004)(30864003)(316002)(54906003)(40480700001)(4326008)(70586007)(40460700003)(110136005)(86362001)(41300700001)(81166007)(5660300002)(8936002)(356005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:25:21.9127 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49c02349-33a5-4ab6-ef7e-08db7334e50b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000971E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6035 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769417398758817590?= X-GMAIL-MSGID: =?utf-8?q?1769417398758817590?= Remove the individual acp init and de-init functions from different variants of acp pci driver(for renoir/rembrandt platforms) and use a common file to define callbacks and refactor the callbacks to support existing platforms. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/Kconfig | 4 + sound/soc/amd/acp/Makefile | 2 + sound/soc/amd/acp/acp-legacy-common.c | 99 +++++++++++++++++++++++ sound/soc/amd/acp/acp-pci.c | 9 +++ sound/soc/amd/acp/acp-rembrandt.c | 110 -------------------------- sound/soc/amd/acp/acp-renoir.c | 92 --------------------- sound/soc/amd/acp/amd.h | 21 +++++ 7 files changed, 135 insertions(+), 202 deletions(-) create mode 100644 sound/soc/amd/acp/acp-legacy-common.c diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig index ce0037810743..6a369e5d825c 100644 --- a/sound/soc/amd/acp/Kconfig +++ b/sound/soc/amd/acp/Kconfig @@ -18,6 +18,9 @@ if SND_SOC_AMD_ACP_COMMON config SND_SOC_AMD_ACP_PDM tristate +config SND_SOC_AMD_ACP_LEGACY_COMMON + tristate + config SND_SOC_AMD_ACP_I2S tristate @@ -28,6 +31,7 @@ config SND_SOC_AMD_ACP_PCM config SND_SOC_AMD_ACP_PCI tristate "AMD ACP PCI Driver Support" depends on X86 && PCI + select SND_SOC_AMD_ACP_LEGACY_COMMON help This options enables generic PCI driver for ACP device. diff --git a/sound/soc/amd/acp/Makefile b/sound/soc/amd/acp/Makefile index d9abb0ee5218..4e65fdbc8dca 100644 --- a/sound/soc/amd/acp/Makefile +++ b/sound/soc/amd/acp/Makefile @@ -8,6 +8,7 @@ snd-acp-pcm-objs := acp-platform.o snd-acp-i2s-objs := acp-i2s.o snd-acp-pdm-objs := acp-pdm.o +snd-acp-legacy-common-objs := acp-legacy-common.o snd-acp-pci-objs := acp-pci.o #platform specific driver @@ -22,6 +23,7 @@ snd-acp-sof-mach-objs := acp-sof-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCM) += snd-acp-pcm.o obj-$(CONFIG_SND_SOC_AMD_ACP_I2S) += snd-acp-i2s.o obj-$(CONFIG_SND_SOC_AMD_ACP_PDM) += snd-acp-pdm.o +obj-$(CONFIG_SND_SOC_AMD_ACP_LEGACY_COMMON) += snd-acp-legacy-common.o obj-$(CONFIG_SND_SOC_AMD_ACP_PCI) += snd-acp-pci.o obj-$(CONFIG_SND_AMD_ASOC_RENOIR) += snd-acp-renoir.o diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c new file mode 100644 index 000000000000..5b7000eae693 --- /dev/null +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -0,0 +1,99 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) +// +// This file is provided under a dual BSD/GPLv2 license. When using or +// redistributing this file, you may do so under either license. +// +// Copyright(c) 2023 Advanced Micro Devices, Inc. +// +// Authors: Syed Saba Kareem +// + +/* + * Common file to be used by amd platforms + */ + +#include "amd.h" +#include + +static int acp_power_on(struct acp_chip_info *chip) +{ + u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; + void __iomem *base; + + base = chip->base; + switch (chip->acp_rev) { + case ACP3X_DEV: + acp_pgfsm_stat_reg = ACP_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP_PGFSM_CONTROL; + break; + case ACP6X_DEV: + acp_pgfsm_stat_reg = ACP6X_PGFSM_STATUS; + acp_pgfsm_ctrl_reg = ACP6X_PGFSM_CONTROL; + break; + default: + return -EINVAL; + } + + val = readl(base + acp_pgfsm_stat_reg); + if (val == ACP_POWERED_ON) + return 0; + + if ((val & ACP_PGFSM_STATUS_MASK) != ACP_POWER_ON_IN_PROGRESS) + writel(ACP_PGFSM_CNTL_POWER_ON_MASK, base + acp_pgfsm_ctrl_reg); + + return readl_poll_timeout(base + acp_pgfsm_stat_reg, val, + !val, DELAY_US, ACP_TIMEOUT); +} + +static int acp_reset(void __iomem *base) +{ + u32 val; + int ret; + + writel(1, base + ACP_SOFT_RESET); + ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, + DELAY_US, ACP_TIMEOUT); + if (ret) + return ret; + + writel(0, base + ACP_SOFT_RESET); + return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); +} + +int acp_init(struct acp_chip_info *chip) +{ + int ret; + + /* power on */ + ret = acp_power_on(chip); + if (ret) { + pr_err("ACP power on failed\n"); + return ret; + } + writel(0x01, chip->base + ACP_CONTROL); + + /* Reset */ + ret = acp_reset(chip->base); + if (ret) { + pr_err("ACP reset failed\n"); + return ret; + } + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_init, SND_SOC_ACP_COMMON); + +int acp_deinit(void __iomem *base) +{ + int ret; + + /* Reset */ + ret = acp_reset(base); + if (ret) + return ret; + + writel(0, base + ACP_CONTROL); + return 0; +} +EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON); + +MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index a0c84cd07fde..d3b2ccbe7fd8 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -107,6 +107,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id goto unregister_dmic_dev; } + acp_init(chip); res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL); if (!res) { ret = -ENOMEM; @@ -155,10 +156,17 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id static void acp_pci_remove(struct pci_dev *pci) { + struct acp_chip_info *chip; + int ret; + + chip = pci_get_drvdata(pci); if (dmic_dev) platform_device_unregister(dmic_dev); if (pdev) platform_device_unregister(pdev); + ret = acp_deinit(chip->base); + if (ret) + dev_err(&pci->dev, "ACP de-init failed\n"); } /* PCI IDs */ @@ -178,4 +186,5 @@ static struct pci_driver snd_amd_acp_pci_driver = { module_pci_driver(snd_amd_acp_pci_driver); MODULE_LICENSE("Dual BSD/GPL"); +MODULE_IMPORT_NS(SND_SOC_ACP_COMMON); MODULE_ALIAS(DRV_NAME); diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 1b997837c7d8..59b1653b8479 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -24,26 +24,6 @@ #define DRV_NAME "acp_asoc_rembrandt" -#define ACP6X_PGFSM_CONTROL 0x1024 -#define ACP6X_PGFSM_STATUS 0x1028 - -#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001 - -#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 -#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 -#define ACP_PGFSM_STATUS_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_POWER_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define ACP_POWER_OFF_IN_PROGRESS 0x03 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - - -static int rmb_acp_init(void __iomem *base); -static int rmb_acp_deinit(void __iomem *base); - static struct acp_resource rsrc = { .offset = 0, .no_of_ctrls = 2, @@ -180,54 +160,6 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = { }, }; -static int acp6x_power_on(void __iomem *base) -{ - u32 val; - int timeout; - - val = readl(base + ACP6X_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STATUS_MASK) != - ACP_POWER_ON_IN_PROGRESS) - writel(ACP_PGFSM_CNTL_POWER_ON_MASK, - base + ACP6X_PGFSM_CONTROL); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP6X_PGFSM_STATUS); - if (!val) - return 0; - udelay(1); - } - return -ETIMEDOUT; -} - -static int acp6x_reset(void __iomem *base) -{ - u32 val; - int timeout; - - writel(1, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK) - break; - cpu_relax(); - } - writel(0, base + ACP_SOFT_RESET); - timeout = 0; - while (++timeout < 500) { - val = readl(base + ACP_SOFT_RESET); - if (!val) - return 0; - cpu_relax(); - } - return -ETIMEDOUT; -} - static void acp6x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -248,43 +180,6 @@ static void acp6x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rmb_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp6x_power_on(base); - if (ret) { - pr_err("ACP power on failed\n"); - return ret; - } - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - return 0; -} - -static int rmb_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp6x_reset(base); - if (ret) { - pr_err("ACP reset failed\n"); - return ret; - } - - writel(0x00, base + ACP_CONTROL); - return 0; -} - static int rembrandt_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -303,8 +198,6 @@ static int rembrandt_audio_probe(struct platform_device *pdev) return -ENODEV; } - rmb_acp_init(chip->base); - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -345,9 +238,6 @@ static void rembrandt_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip = dev_get_platdata(dev); - - rmb_acp_deinit(chip->base); acp6x_disable_interrupts(adata); acp_platform_unregister(dev); diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index f188365fe214..a73fd70171c1 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -25,20 +25,6 @@ #define DRV_NAME "acp_asoc_renoir" -#define ACP_SOFT_RST_DONE_MASK 0x00010001 - -#define ACP_PWR_ON_MASK 0x01 -#define ACP_PWR_OFF_MASK 0x00 -#define ACP_PGFSM_STAT_MASK 0x03 -#define ACP_POWERED_ON 0x00 -#define ACP_PWR_ON_IN_PROGRESS 0x01 -#define ACP_POWERED_OFF 0x02 -#define DELAY_US 5 -#define ACP_TIMEOUT 500 - -#define ACP_ERROR_MASK 0x20000000 -#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF - static struct acp_resource rsrc = { .offset = 20, .no_of_ctrls = 1, @@ -154,38 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; -static int acp3x_power_on(void __iomem *base) -{ - u32 val; - - val = readl(base + ACP_PGFSM_STATUS); - - if (val == ACP_POWERED_ON) - return 0; - - if ((val & ACP_PGFSM_STAT_MASK) != ACP_PWR_ON_IN_PROGRESS) - writel(ACP_PWR_ON_MASK, base + ACP_PGFSM_CONTROL); - - return readl_poll_timeout(base + ACP_PGFSM_STATUS, val, !val, DELAY_US, ACP_TIMEOUT); -} - -static int acp3x_reset(void __iomem *base) -{ - u32 val; - int ret; - - writel(1, base + ACP_SOFT_RESET); - - ret = readl_poll_timeout(base + ACP_SOFT_RESET, val, val & ACP_SOFT_RST_DONE_MASK, - DELAY_US, ACP_TIMEOUT); - if (ret) - return ret; - - writel(0, base + ACP_SOFT_RESET); - - return readl_poll_timeout(base + ACP_SOFT_RESET, val, !val, DELAY_US, ACP_TIMEOUT); -} - static void acp3x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -206,37 +160,6 @@ static void acp3x_disable_interrupts(struct acp_dev_data *adata) writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); } -static int rn_acp_init(void __iomem *base) -{ - int ret; - - /* power on */ - ret = acp3x_power_on(base); - if (ret) - return ret; - - writel(0x01, base + ACP_CONTROL); - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - return 0; -} - -static int rn_acp_deinit(void __iomem *base) -{ - int ret = 0; - - /* Reset */ - ret = acp3x_reset(base); - if (ret) - return ret; - - writel(0x00, base + ACP_CONTROL); - return 0; -} static int renoir_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -256,12 +179,6 @@ static int renoir_audio_probe(struct platform_device *pdev) return -ENODEV; } - ret = rn_acp_init(chip->base); - if (ret) { - dev_err(&pdev->dev, "ACP Init failed\n"); - return -EINVAL; - } - adata = devm_kzalloc(dev, sizeof(struct acp_dev_data), GFP_KERNEL); if (!adata) return -ENOMEM; @@ -300,17 +217,8 @@ static void renoir_audio_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - struct acp_chip_info *chip; - int ret; - - chip = dev_get_platdata(&pdev->dev); acp3x_disable_interrupts(adata); - - ret = rn_acp_deinit(chip->base); - if (ret) - dev_err(&pdev->dev, "ACP de-init Failed (%pe)\n", ERR_PTR(ret)); - acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 5f2119f42271..83c9a3ba8584 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -92,6 +92,25 @@ #define SLOT_WIDTH_24 0x18 #define SLOT_WIDTH_32 0x20 +#define ACP6X_PGFSM_CONTROL 0x1024 +#define ACP6X_PGFSM_STATUS 0x1028 + +#define ACP_SOFT_RST_DONE_MASK 0x00010001 + +#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01 +#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00 +#define ACP_PGFSM_STATUS_MASK 0x03 +#define ACP_POWERED_ON 0x00 +#define ACP_POWER_ON_IN_PROGRESS 0x01 +#define ACP_POWERED_OFF 0x02 +#define ACP_POWER_OFF_IN_PROGRESS 0x03 + +#define ACP_ERROR_MASK 0x20000000 +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xffffffff + +#define ACP_TIMEOUT 500 +#define DELAY_US 5 + struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ @@ -168,6 +187,8 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +int acp_init(struct acp_chip_info *chip); +int acp_deinit(void __iomem *base); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); From patchwork Thu Jun 22 15:23:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5155477vqr; Thu, 22 Jun 2023 08:33:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6/m16a2Z4rZakuBozZaW/AFm8pIGE3d5NoGjWdpLZ9MSapdDEFqsz+sKcQvacsPHjiNMor X-Received: by 2002:aca:f0b:0:b0:396:11b3:5851 with SMTP id 11-20020aca0f0b000000b0039611b35851mr20072305oip.54.1687447987049; Thu, 22 Jun 2023 08:33:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687447987; cv=pass; d=google.com; s=arc-20160816; b=VgTiIHgybyYztuJ71nOkHYl74jJaYHgFJRJUl/w9VKpiaHOyKmA+pxjZZKYpmD3pi6 MIURR0ln7Dn711TDeECDzKsdpzMaBjTWf2DARnGnDSIhAoI6hu1kEJO3O4/qQTaXaR9o s3nt7Y2pUvGD0p2Os8q8lSCrHf4vl0ec2OSrXfQg9iZewXbrxaLiMmsLQ6yeDsxaprY+ mZNmTG2ZwLILHOuPgR7Y7jJQ1AtinDt2T+7tN679cr+AW66AFVL1zDQhhKA3PPMqe4bT CC4SQK9sPIAqurn5GhqCxvM/Ob+sDw+01ByjpLnfOK8LspCaCV4l2XVGEtJpdOz9k68R k68g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eTi+jNwx22Rw4e2bVwgKMy2ba0IycMTYdowrOqOEbg4=; b=xo3Mj4KJ0vQg1aCbPJs6Jjguh8C2UWm0S9is9m/HxdaU6F00cSc7NCyMHV51v03z2J X1mCd6N0UuWRf/BNed6wC38jCwsnKD2zrYx4RLFpOzkaSag3i9duHjgrw2I5PH9SsX16 nuUY4qMvvfgGASgDhSaEAdT6zoisGUinSF0/cuIqoy1Qf/oRG3Q6bBMW+NcUJaqW0a0j GKnIz61KQQ60j1C2dQV1CIS5nEaXwf5m0RnuE4mknqxTUWEkamY5KjyNu96y046M1+Pw GqPeBiizK6Am8imYHT9UI24pK9Z6VWJ8IZ4dGF8W4W7zZjEjirJ8V9ki1szq2vhtV+sH wAZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="I/TBx9aR"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g15-20020a63374f000000b00553ebb05d23si3955685pgn.70.2023.06.22.08.32.38; Thu, 22 Jun 2023 08:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="I/TBx9aR"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232369AbjFVPZz (ORCPT + 99 others); Thu, 22 Jun 2023 11:25:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjFVPZu (ORCPT ); Thu, 22 Jun 2023 11:25:50 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A6AA1FE1 for ; Thu, 22 Jun 2023 08:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bnCx1+qxzWdTNwH9xRf2TFCuHOIB4fsRI0LL3xpphFwkLE65JNTAnUVXv+vwjtB178+z7cm4B8D7IrCtvWrnPb6y/p1Lrhu3auGXnwJT7D706XoaWiHqWacbTbiECDCfYnXrnWXmOHDWr3DOTvtiXarDZGBbVDcIIaEDkeJ52FBJkC9RedQjr419YK9y/3scDEl0cXQsMs9UemyTsQX6b277EgJOxnujc7ID6My4La45uCrBi6WGJyXBCjP4Ab3HqQuchLfhhuEF3p7SrBmAQWK3mRQ11EMrGJaix7nrSJB3eQW4ozITciDonPxFZyfmctYztwAIF+i4g8uDkOITqg== 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=eTi+jNwx22Rw4e2bVwgKMy2ba0IycMTYdowrOqOEbg4=; b=EfAAaZT0krtMH4xA+2ujBAv+GOKH4gqE+gCB033KvhHDBqDJOIcRxq8zqLzhrzgpdWtOPSsxZ4kiqPSXgx79NvlEqYC1Mv1N0APvHns5eS7bGG2pkUKGqi9L8cOQcVL1EzXK5lssrdjBHdYuSNBlsT/5LtTvgfhSipkZvHI7bFCkBl06yFueBJoZuMLeYteq8f/CiVXrX/waClK0mb+PZRzDgHC/qB2WL1yDIhad4WtT61cTN8w/C5rvD5KHC2Y/+kIz8eY5ZnGiYN3ZqmWyMgk/yQe7ciBzJPx+HGgvZmXsxuusEC2hddPo3CgvQamG2JbdM/EvjcRoI7eM/ib4tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eTi+jNwx22Rw4e2bVwgKMy2ba0IycMTYdowrOqOEbg4=; b=I/TBx9aR0jWW8pn/y5F9BUJDJ8v4gGC5z7AiifgqDpFt6BwVPxVNv5VWveZINd4nYZi8OJSgTlQjZLq9TYrEons0UeKolxtts84HV5qR7TKgeh6by5wXbl/1W2K+hzpwpSW2C0pup7chCV6gCVeNboOcCor7L2NkBNT3AR5sYv4= Received: from SN6PR16CA0056.namprd16.prod.outlook.com (2603:10b6:805:ca::33) by DM4PR12MB6255.namprd12.prod.outlook.com (2603:10b6:8:a4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:25:33 +0000 Received: from SA2PEPF0000150B.namprd04.prod.outlook.com (2603:10b6:805:ca:cafe::9e) by SN6PR16CA0056.outlook.office365.com (2603:10b6:805:ca::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:25:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF0000150B.mail.protection.outlook.com (10.167.242.43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:25:33 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:25:32 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:25:28 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , "V Sujith Kumar Reddy" , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "Venkata Prasad Potturu" , Ajit Kumar Pandey , open list Subject: [PATCH 04/12] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform Date: Thu, 22 Jun 2023 20:53:44 +0530 Message-ID: <20230622152406.3709231-7-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150B:EE_|DM4PR12MB6255:EE_ X-MS-Office365-Filtering-Correlation-Id: 752ddcd1-74f4-41d5-e4ec-08db7334ebb8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bsq9V5dVZNSQLWKvihDR2xCZYOwq0yAZaV/09O4yvHbIGpCmknbZcJFtzM+r/0Hi54IwDtAAkWxLxmIyPYrddFzZBTdRUy1byEM6Jj8gqhKWSI5NsgKBIwYPVOcZTBKGGGu68h+fDlDDaln6/lmIv4UclEgk50X7mQtvBMbLWxHwjqcUtoeNkIGBWX0jY5xEC1ZhVaCtKgyI+TwapblbAtTdVIIpIe8lHRPJZBXoDploBV/y779hjevBr2aG0vy2jfJcTZ1GVyJft36+n6sEaxZz38eqJFIf1XvObDoWcxgPNp8IJ7rS+d7cSD8HeU0aXCaKpJ4hn75uvFyp5OXcZSV8UEq/X630jvl3/LOgurs50nS64q1Fp/B9S/DNn8KKTt3akR2IDuoOf1KvbTFC+00fne63F2GBWTQxPbpTkGpyt4J7oDIflzHGCtqrm/6HLPeMYVVlnn2sVMR/5GbwmcAZaiV/f9OhoQQiHY3l7S2TFLptvDmbDkefKxe3JsUEyC4w5hU7Qo9PXRZUxve/G/KzgOPLdkL1nfagqZVDyE9BGBqrv/djF6mzQ659a6YRXAlpw93Mz+tuNVGhN8tW9sXcrX6KI2M1ZJls08kZI6jYg2LyQDzivJ5OFmt/5dJ/rmcGRvnMKtku4nSq3VaMfMkFLHyjf2a0XnEd/QJfWmWyFNrTsXdn2SJPlrDKUA9XiIkqjubz2F3uZaeqAVtuRExIUvtN4iDizTA9FW9yL+tYs4cXB4HA8IKt9/Ct9VXljko+bFuBSlfip/AkzASEjg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(346002)(136003)(39860400002)(396003)(376002)(451199021)(36840700001)(40470700004)(46966006)(54906003)(2616005)(86362001)(110136005)(40480700001)(478600001)(7696005)(186003)(6666004)(41300700001)(70206006)(70586007)(316002)(47076005)(83380400001)(26005)(82310400005)(4326008)(426003)(336012)(1076003)(8936002)(5660300002)(36756003)(8676002)(36860700001)(40460700003)(2906002)(82740400003)(356005)(81166007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:25:33.2688 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 752ddcd1-74f4-41d5-e4ec-08db7334ebb8 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6255 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769417460449178907?= X-GMAIL-MSGID: =?utf-8?q?1769417460449178907?= Add acp i2s master clock generation logic for rembrandt platform. Signed-off-by: V Sujith Kumar Reddy Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 19 +++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 26 ++++++++++++++++++++++++++ sound/soc/amd/acp/amd.h | 3 +++ 3 files changed, 48 insertions(+) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 5b7000eae693..4302d8db88a4 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -13,6 +13,7 @@ */ #include "amd.h" +#include #include static int acp_power_on(struct acp_chip_info *chip) @@ -96,4 +97,22 @@ int acp_deinit(void __iomem *base) } EXPORT_SYMBOL_NS_GPL(acp_deinit, SND_SOC_ACP_COMMON); +int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data) +{ + pci_write_config_dword(dev, 0x60, smn_addr); + pci_write_config_dword(dev, 0x64, data); + return 0; +} +EXPORT_SYMBOL_NS_GPL(smn_write, SND_SOC_ACP_COMMON); + +int smn_read(struct pci_dev *dev, u32 smn_addr) +{ + u32 data; + + pci_write_config_dword(dev, 0x60, smn_addr); + pci_read_config_dword(dev, 0x64, &data); + return data; +} +EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON); + MODULE_LICENSE("Dual BSD/GPL"); diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 59b1653b8479..83515ee753f3 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -19,11 +19,17 @@ #include #include #include +#include #include "amd.h" #define DRV_NAME "acp_asoc_rembrandt" +#define MP1_C2PMSG_69 0x3B10A14 +#define MP1_C2PMSG_85 0x3B10A54 +#define MP1_C2PMSG_93 0x3B10A74 +#define HOST_BRIDGE_ID 0x14B5 + static struct acp_resource rsrc = { .offset = 0, .no_of_ctrls = 2, @@ -160,6 +166,25 @@ static struct snd_soc_dai_driver acp_rmb_dai[] = { }, }; +int acp6x_master_clock_generate(struct device *dev) +{ + int data = 0; + struct pci_dev *smn_dev; + + smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, HOST_BRIDGE_ID, NULL); + if (!smn_dev) { + dev_err(dev, "Failed to get host bridge device\n"); + return -ENODEV; + } + + smn_write(smn_dev, MP1_C2PMSG_93, 0); + smn_write(smn_dev, MP1_C2PMSG_85, 0xC4); + smn_write(smn_dev, MP1_C2PMSG_69, 0x4); + read_poll_timeout(smn_read, data, data, DELAY_US, + ACP_TIMEOUT, false, smn_dev, MP1_C2PMSG_93); + return 0; +} + static void acp6x_enable_interrupts(struct acp_dev_data *adata) { struct acp_resource *rsrc = adata->rsrc; @@ -228,6 +253,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev) acp_machine_select(adata); dev_set_drvdata(dev, adata); + acp6x_master_clock_generate(dev); acp6x_enable_interrupts(adata); acp_platform_register(dev); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 83c9a3ba8584..96bd87290eee 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -187,6 +187,9 @@ int acp_platform_unregister(struct device *dev); int acp_machine_select(struct acp_dev_data *adata); +int smn_read(struct pci_dev *dev, u32 smn_addr); +int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data); + int acp_init(struct acp_chip_info *chip); int acp_deinit(void __iomem *base); /* Machine configuration */ From patchwork Thu Jun 22 15:23:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5164241vqr; Thu, 22 Jun 2023 08:47:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7WWJa77kNOCgl3hye5ABv/tbS+1eDsyLt1wvWvClEPO8Le/iKuKDrHbTsK9U99Td8Qh8M+ X-Received: by 2002:a05:6870:1729:b0:1ad:f52:81b7 with SMTP id h41-20020a056870172900b001ad0f5281b7mr5098019oae.36.1687448850918; Thu, 22 Jun 2023 08:47:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687448850; cv=pass; d=google.com; s=arc-20160816; b=q2jC8/2LJ3AHmNLkR2owv77fm9eMbT+bQuIQWhUyvE/gKu76/AXbsV3HrwRADK4gaH C1tRnsOWb3cFJp6bqfhOee5cJbR/jIjKYWIOkjlVutXPUtWgYXYDHWNbNMHs+WZWq9mq yuyHfpodHoO0z62cd9t4bPznCoEy0GYEZLHTNdnrYwoVEJIbf7whgtSQ11c+USXoAnVE RTd8bXZMu50ESXmvoXCActaitSla4UyrZCGd1dKrwaQbM4ONC2CBdPneCVQHgjlXqPlQ szSMHLkcSf8ugr0aeZmFo3tAJpUhASs07PN2BHuBikM9A0kwhTxvXUuRyn8rQd3sYeD6 zEVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lyb4oUKPqZp6YQRg2tTH63rwDvDI64BEIOp/IMCkntM=; b=mOC5QISF27h8BAxMED8GZzVk+hD5CA7pkQSUvHzTIwIyNFcuHPY5wzR8Jx+mn7YDq/ 0eHdU5/WvgnmGKcq0dm8xAPkUbZsy2syQ0NUCL8t0muyonu0FoDjJqBbnJMo8g0whNw+ VayXeSJ4s25Rvnhg1HF6WMx6CspE2tnygpUgnil8XPVQ2uRwSEruNSfp/CXwEz2lpPta cuPtWVjKEiFbDVc+rG7POeel+Wg+Znl7nDPyrmV3dIW6pU97+Y65U7XSbyFnHmvdhNxm DexaYB5jz+KvMCcQKmRgTzsyvEa8v/q/aypOXHrzRmSEuadQ1+53nv6tstkxfPxlnweP 7i9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="PaQwTS/F"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 196-20020a6301cd000000b005307b843a98si6663202pgb.53.2023.06.22.08.47.17; Thu, 22 Jun 2023 08:47:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="PaQwTS/F"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232396AbjFVP0R (ORCPT + 99 others); Thu, 22 Jun 2023 11:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbjFVP0O (ORCPT ); Thu, 22 Jun 2023 11:26:14 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2043.outbound.protection.outlook.com [40.107.102.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31B71211F for ; Thu, 22 Jun 2023 08:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j+VChYyt+gpDe5bBboFM+KtTz/Ye4jGvEEI02j+CV3D7TefjqjL5aeDTJd6V7syTSzQB0BtbZmSwtEmSJ5XPTsIl24T32oZ9inHnJS6jXeN9tCZueYIpY914uKyChiXUxI/SxhYnXW6cPHGIBGGYHvHCFSU1gYweJyZAzuDYviu3x5cuYeEK+jq23kpb1udbDVUrdTR2nDte8t9NwZTqNFi/RwuUmV0I/YRTObXUj97LHTdv7w3UFf2nfrCNc9lA1zDCO9bzqPGPpnfF+AN4GbLN50JlalUN9hjXtDa2m3Gvi7cAkQPncmxz8bUSctsKeDwrfxrG6rv8JQjS/vKGDA== 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=lyb4oUKPqZp6YQRg2tTH63rwDvDI64BEIOp/IMCkntM=; b=aXDwDyNL3If/AlWn1TbJV/u4A5BBNvkOUV0I15IAzdPvZPCpqxdIarL8TlP1YtPMuw7Ijzv0xy+CVqd79vLaWeUqW6Khv/O3TZHmeNko7flPLvdd3nLSI3pjNPdwvbEoWc9DNiB49fuaGK3o5/faL2hi2oR0EHzyTlAyaqnRnEEv0vVUNphbfvPPPKdHLgXIyRfj7kSP3qocxkn8tUnF51ntWyzwnrUxt7xN5GVXtUn4bqwThUD8CXNSftW41Agj/p00c1BsfZloi0yd8NX0M4y79aWlzwckq5HqcE1iB5+rH8PBPVJ5uYsJ+k0FG5qv53ZUBFg+mLvoZNCUOIRRCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lyb4oUKPqZp6YQRg2tTH63rwDvDI64BEIOp/IMCkntM=; b=PaQwTS/FKjj4kXXVYIyjqNi4PwSSYtJYewhljMqpu9sOMpCiDI0WLKWGP5PPkJPv77+jC+gBPUYpOeSwGZePU+QkehirC+JvwUWh9/dtWmCrQ3niB07hHXkOVAQhr5qjOzwYl/B00T7/mjSKIiJRaHuRitcXDjgz7fLVIiYK2MU= Received: from SA1PR02CA0014.namprd02.prod.outlook.com (2603:10b6:806:2cf::21) by LV3PR12MB9096.namprd12.prod.outlook.com (2603:10b6:408:198::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 22 Jun 2023 15:25:59 +0000 Received: from SA2PEPF00001508.namprd04.prod.outlook.com (2603:10b6:806:2cf:cafe::e8) by SA1PR02CA0014.outlook.office365.com (2603:10b6:806:2cf::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:25:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF00001508.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.19 via Frontend Transport; Thu, 22 Jun 2023 15:25:58 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:25:58 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:25:58 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:25:54 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V Sujith Kumar Reddy , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH 05/12] ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions Date: Thu, 22 Jun 2023 20:53:46 +0530 Message-ID: <20230622152406.3709231-9-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001508:EE_|LV3PR12MB9096:EE_ X-MS-Office365-Filtering-Correlation-Id: ebd7b68c-101e-4943-4da0-08db7334faf3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HsU5gIQfByngOmQivmzUFV65gKD0yUGXysXWNR1UrKtHzY1c8MCo3Ch6A3b7jlqNVCx06QqNV1iOZc+KNfoxRkoFQUZ1D+G43DEYMV5ILAcmHlMXkV8p35SXq5VjdzYdYzPt9peofm0bBBhqz3neu51jvg1gpKt8Z0E0kudmObKLErzOrVNBR5P4SMd4ZfAZG03F3RIKTz7Xq1KGoW3no10P/cifXSA54tYviR/GPjIPiZrkbyOgfIfkOQKMDApIqcBhqgEH2z+BhLmtrt6JARGx41ylKD0oSCyGGm79yD1zcLXc9p2kSbNP9lV9l+FRGvFpnCv7i2AEBxlExFdwLKX2513eG0En9YVMZE3ZsS+HN4dF+4qKtYZqZ2Sh09J8hLf0WHeHFkfkdjJchllDOyIPeDX1ZU9VQ3ouRK+oAGdcVSasAGwTdcRp06bhBwp1krIuKPOrGVhPMsNtUKblwK8KUOF9LKZHj3E4J3ibb/oMg912x4Vg2qs86MfxFGxRtS5h+k+rUJL9ZopmYlnqlp/S7ePpIPcNwdGOKiPLoDRFwcDFgtanyr3ucu55E+n98yBKK4UnTg5GwDGhO2DizxMLIxEeza/aN8/dzmsabOOR+fESES9KyzcI4npRXgYk/Dxmg1HUBn3DlhPVNjvUbR7SyzRuB/W+LdOPnRn9uUEVYYf+H2ScHaPorv4eDs0Bqdkg9tlbn3zzfnE77ja3IT82iU+3ZOx8uDf0ZR7Y3MWL2jbPWudBvGWG7vONJ8z0PWJH97gbC7LZZX9ovVqS2w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199021)(36840700001)(40470700004)(46966006)(70586007)(82310400005)(7696005)(8936002)(8676002)(41300700001)(316002)(356005)(70206006)(36756003)(2906002)(81166007)(82740400003)(83380400001)(26005)(6666004)(336012)(426003)(110136005)(54906003)(478600001)(4326008)(86362001)(40460700003)(47076005)(5660300002)(40480700001)(2616005)(186003)(36860700001)(1076003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:25:58.8174 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ebd7b68c-101e-4943-4da0-08db7334faf3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001508.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9096 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769418366308398600?= X-GMAIL-MSGID: =?utf-8?q?1769418366308398600?= Instead of having individual acp enable/disable interrupts functions for each platform, implement common place holder to handle the same for all AMD platforms. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 21 +++++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 24 ++---------------------- sound/soc/amd/acp/acp-renoir.c | 23 ++--------------------- sound/soc/amd/acp/amd.h | 2 ++ 4 files changed, 27 insertions(+), 43 deletions(-) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 4302d8db88a4..45a45d002915 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -16,6 +16,27 @@ #include #include +void acp_enable_interrupts(struct acp_dev_data *adata) +{ + struct acp_resource *rsrc = adata->rsrc; + u32 ext_intr_ctrl; + + writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); + ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + ext_intr_ctrl |= ACP_ERROR_MASK; + writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); +} +EXPORT_SYMBOL_NS_GPL(acp_enable_interrupts, SND_SOC_ACP_COMMON); + +void acp_disable_interrupts(struct acp_dev_data *adata) +{ + struct acp_resource *rsrc = adata->rsrc; + + writel(ACP_EXT_INTR_STAT_CLEAR_MASK, ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); + writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); +} +EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON); + static int acp_power_on(struct acp_chip_info *chip) { u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index 83515ee753f3..bc8e1de45170 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -185,26 +185,6 @@ int acp6x_master_clock_generate(struct device *dev) return 0; } -static void acp6x_enable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - u32 ext_intr_ctrl; - - writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); - ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); - ext_intr_ctrl |= ACP_ERROR_MASK; - writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); -} - -static void acp6x_disable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - - writel(ACP_EXT_INTR_STAT_CLEAR_MASK, - ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); - writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); -} - static int rembrandt_audio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -254,7 +234,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev) dev_set_drvdata(dev, adata); acp6x_master_clock_generate(dev); - acp6x_enable_interrupts(adata); + acp_enable_interrupts(adata); acp_platform_register(dev); return 0; @@ -265,7 +245,7 @@ static void rembrandt_audio_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - acp6x_disable_interrupts(adata); + acp_disable_interrupts(adata); acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/acp-renoir.c b/sound/soc/amd/acp/acp-renoir.c index a73fd70171c1..1899658ab25d 100644 --- a/sound/soc/amd/acp/acp-renoir.c +++ b/sound/soc/amd/acp/acp-renoir.c @@ -140,25 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = { }, }; -static void acp3x_enable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - u32 ext_intr_ctrl; - - writel(0x01, ACP_EXTERNAL_INTR_ENB(adata)); - ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); - ext_intr_ctrl |= ACP_ERROR_MASK; - writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); -} - -static void acp3x_disable_interrupts(struct acp_dev_data *adata) -{ - struct acp_resource *rsrc = adata->rsrc; - - writel(ACP_EXT_INTR_STAT_CLEAR_MASK, - ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used)); - writel(0x00, ACP_EXTERNAL_INTR_ENB(adata)); -} static int renoir_audio_probe(struct platform_device *pdev) { @@ -207,7 +188,7 @@ static int renoir_audio_probe(struct platform_device *pdev) acp_machine_select(adata); dev_set_drvdata(dev, adata); - acp3x_enable_interrupts(adata); + acp_enable_interrupts(adata); acp_platform_register(dev); return 0; @@ -218,7 +199,7 @@ static void renoir_audio_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct acp_dev_data *adata = dev_get_drvdata(dev); - acp3x_disable_interrupts(adata); + acp_disable_interrupts(adata); acp_platform_unregister(dev); } diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 96bd87290eee..0d8c0febbbfc 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -192,6 +192,8 @@ int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data); int acp_init(struct acp_chip_info *chip); int acp_deinit(void __iomem *base); +void acp_enable_interrupts(struct acp_dev_data *adata); +void acp_disable_interrupts(struct acp_dev_data *adata); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); From patchwork Thu Jun 22 15:23:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5181000vqr; Thu, 22 Jun 2023 09:11:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5pk43YFpQXoflB22pQ0+yLRLFCJ0kDa6zHp45dxZ4h7I20XPrA8iTRU0UJSqLj727ATbWK X-Received: by 2002:a17:902:eb4d:b0:1b1:7362:9a18 with SMTP id i13-20020a170902eb4d00b001b173629a18mr12590416pli.27.1687450281929; Thu, 22 Jun 2023 09:11:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687450281; cv=pass; d=google.com; s=arc-20160816; b=aT+RiadQgot9E+ajhUsUdMc5YbICEDuAANS91+verFGZz0NzyOR+T3Me++BJ71xUzK bFgOxXh1A/ptJJ2U7UiSSws81oPV/8YsARZave3GU20tmdcXUTZnfr9/R25cMaxEfuRQ apGR/CwQEVdjdMlMXzvreQTWZbB2k/oOcoAfPaqSFLdAAKCYb+iO4WpV7OOW+9Wvwk1e DlqbpmxnrrhqwzAEfqBb+RYgzvmIIPr3KO7dkX7j711bnt608p5taoWcPSxS61hz8oX7 4vwrCvTYNRdbB9VR+6DnwmAloMYeOmkUNADwg1NGS4Le6dp4KJ30lLpRO9A3aBf/Db6r rNaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CvCBKnW1XfiJYktEn5OXvrGZ5iyfve+4NEgu2JLMNvQ=; b=fuyvACmLjGEE/ZkqBlAZw/T94msLPckWIvkvym6mJsycfaSDajfIOV66RSmFvB7f0f ta9r9wtizuZg4C3DN5tUl6UVoxximpU+VG0jLSaHwUsZsa81Xri3UCEZWv3xpSuKKIx4 1XViYoZImJH+m0+t90jOPCSku6KTUfw5osbkafB2gWQzqpM7FV/HT9H3KlSnbKfEJQbs 4vYXJ+uhwcvtdWsElJX+5Lj+7tIhZvmWDV/L2gepRzaKSDy1QGbQh6lKqytL5aGjwhlP 5cHQxRFNXLBV4WzA6ZEwpLqGzVNQp0OJiIlpPZHucrG5bDL1fO0itf+/WjzHvmQljxdX UrsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IarlYrr4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i1-20020a170902c94100b001b3b93609c6si7279165pla.538.2023.06.22.09.11.08; Thu, 22 Jun 2023 09:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IarlYrr4; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232428AbjFVP0t (ORCPT + 99 others); Thu, 22 Jun 2023 11:26:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232389AbjFVP0l (ORCPT ); Thu, 22 Jun 2023 11:26:41 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2085.outbound.protection.outlook.com [40.107.102.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7755B1BD3 for ; Thu, 22 Jun 2023 08:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U/W/ynJ9k9ySZTdlV8AfoDBO+YYN/qDNa/08Zw4dd66Q6+CCxzp8K/xWGxv8WoIeYBYQv7jMKviRGtCABXvKOWDQT2Ud3xxL25ElMqzVN/4KT7wanUNBNfpjHqPF84LqDl5T5nQt0UmGWeS6dkcxIko2E0pP/c2/yhgAksg/D84A2jL6/9BUgDeGZTxu4vJ+ub8TPQPfPmO9WZs1bmQA2V2bJGJlttohkUeKZ5YIrCIVOt/NNOU2MJHvKNJsH1nWRg1HYFiCHVs3Xu3SOCduPMf1cppEAyQilM0Zk2QhZVLbTQzLrtHgejx7rwwUNxEX3kDmi+bE8jmeebgKqEB6Tg== 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=CvCBKnW1XfiJYktEn5OXvrGZ5iyfve+4NEgu2JLMNvQ=; b=nYI6PYpykVJBBRwH6SltpOCPziAapnu8fkfmSvy9w36eCdbpnMI+D/KGRQqfQ/+jYUK8BMEXXUwUpkawoygDcySTYmW4DuAs+5kJODgzpU3OXyIM+r2mLWgx4v8Y5zWvBHnygHsx9ctoYkVATRedBy1f4ivkKeU1E0I1gy7knv48FZxFACUhoCof0f2NT5Cu6ih1nAQ3PJmmShETq+e5QndtljEuSKyxG1T9YiQEHDmuLqREZo4HTYjuVORWRk2ynPxPBrLBdcRivbJbBX+iZbAGJxBPeVSUIIwYtzb8xrDL6NqVG+vOlGz/jgcce9pEL4S4m7botVXIL6xYZHe+hQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CvCBKnW1XfiJYktEn5OXvrGZ5iyfve+4NEgu2JLMNvQ=; b=IarlYrr4U0G4zrdngAb4iG7y+vGDSBs4GbEpBtexZ1QFFxblB/a0uHE4b4uMjGTdDYPELdHrqyXxu0jYEb6JkktePsms8ucM5u8/ROzPUEGmIWGm18TcDXo2l1qh+ZmhXSNkPmM8doz1lCnP5QTbQcnYwJcrpUj5yARWj0bEJ+A= Received: from BY5PR04CA0003.namprd04.prod.outlook.com (2603:10b6:a03:1d0::13) by SN7PR12MB8131.namprd12.prod.outlook.com (2603:10b6:806:32d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:26:17 +0000 Received: from CO1PEPF000042AC.namprd03.prod.outlook.com (2603:10b6:a03:1d0:cafe::88) by BY5PR04CA0003.outlook.office365.com (2603:10b6:a03:1d0::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:26:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000042AC.mail.protection.outlook.com (10.167.243.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6477.13 via Frontend Transport; Thu, 22 Jun 2023 15:26:17 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:16 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Thu, 22 Jun 2023 08:26:16 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:26:12 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Yang Yingliang , Venkata Prasad Potturu , ye xingchen , V sujith kumar Reddy , Ajit Kumar Pandey , open list Subject: [PATCH 06/12] ASoC: amd: acp: store platform device reference created in pci probe call Date: Thu, 22 Jun 2023 20:53:49 +0530 Message-ID: <20230622152406.3709231-12-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000042AC:EE_|SN7PR12MB8131:EE_ X-MS-Office365-Filtering-Correlation-Id: b59ba72c-3d6c-41f8-36a2-08db733505f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4XOXJgG5+8qfPIUlYR5ZIW2q1JMs2Km05Ai2OCe7moyta1nYJanMj9Gro5FG03aZIElxUQd38FP1aOopnXw5kHceRgRuz+vK0OFdjrsy0EIxkksW/4mC2ZX00hDReD5WqJ8C9RwGrD3/N4sdWr8yYFJFrgGXx5u1SCypbaX1z2B7EdidAkYZ1ojpgfYc1XOLsQgZl4G0K4dzHxmxh3jUM6WEsL40ARAQbeqDSM+A3XLkA7ZOutN9ijtfTzsJ0KSkN0Fh1bCPCVl8AqFfJw1ZZKXYwVBmiah4yNqUWo92YWWdiHWCKUmo2/dc+VKnIWGtldfPtJzCo0BJ7p3gg+UXwjuT2CHlpVW8svG9WK1e24xYdT2aUYCdrqyOg4x3U4tja7pWfOjIaBif81og2yymqlTBQmwO/AIK5s3pEhXDN3QTVUqtiTWLgEftZEuONaagcqm2ZnD0h1x1mHE0NtKVXvJDrmqLDpOUvt12LazxRm6cw5ysfw10a9NeqaOAK0Z3zBXoS+GkvLLrp+2Ptr9yN198rVJIc0b7Fgg4uZ1G9IQ7Hkg0Ddd9dflm/SOz6n6OtNUQFMQCv2Mlnj7Lc871jXNMBvFhht09hL39jBFxpYl7Rvta0lX+Y8VxQEdMHH/B8ogNspUX+gdH12ixirq0UWHtsZE9eYDml1gS4EmJApkNwaIpQhV2Mgbo30LZoklGGJLXHj7L5COJ8TdjQzIWNfsaLUgIPCi/2F2ZEvA0BpNKVYhsq94DgqZxuD1OB6DFsXWYYj2SzbPf0FOZ8l7gdw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(346002)(376002)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(2906002)(41300700001)(8936002)(40460700003)(8676002)(36860700001)(6666004)(478600001)(82310400005)(81166007)(356005)(2616005)(83380400001)(82740400003)(426003)(26005)(186003)(1076003)(336012)(7696005)(47076005)(40480700001)(54906003)(86362001)(110136005)(36756003)(316002)(4326008)(70586007)(70206006)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:26:17.2330 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b59ba72c-3d6c-41f8-36a2-08db733505f9 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000042AC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8131 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769418523619838710?= X-GMAIL-MSGID: =?utf-8?q?1769419866407107605?= Store the platform device reference created in pci driver, it will be used in restoring the interrupts during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pci.c | 2 +- sound/soc/amd/acp/amd.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c index d3b2ccbe7fd8..0d91181364e3 100644 --- a/sound/soc/amd/acp/acp-pci.c +++ b/sound/soc/amd/acp/acp-pci.c @@ -141,7 +141,7 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id ret = PTR_ERR(pdev); goto unregister_dmic_dev; } - + chip->chip_pdev = pdev; return ret; unregister_dmic_dev: diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 0d8c0febbbfc..f53613216397 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -115,6 +115,7 @@ struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ void __iomem *base; /* ACP memory PCI base */ + struct platform_device *chip_pdev; }; struct acp_stream { From patchwork Thu Jun 22 15:23:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5192266vqr; Thu, 22 Jun 2023 09:29:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rW4QcOLOpp7MM16ZVeAB4p3MZD0ydcC+oTNMotxUM1e9MS63HKAHuPI2GNDfr56RKiC+W X-Received: by 2002:a05:6a20:914d:b0:122:cef6:295 with SMTP id x13-20020a056a20914d00b00122cef60295mr6987988pzc.21.1687451372656; Thu, 22 Jun 2023 09:29:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687451372; cv=pass; d=google.com; s=arc-20160816; b=HC7XW1nGNNHnRCmEwrwUk4RzmaXs7r4jcKKAIjiYH0UxfieWlYV/SLR34gqWQZbxXh VS7RLhEEvzZAHpZcepwCVl2AVZrZsHm9zamqRVYnwnLNvcQfByC7im+1j0w4VooKMKXu aKLMTQBLEPFAbkuPhh8rngycBfXW/mgSZqXKGaX+0Xb1tG1sWGL+fZxMrifTCXkQ/V7+ 4kxaQNGRdhs41XwcccmsReWfBmg6Of7+oC8qPFY2mJQ6ip4qj8WgV84IOOcdf5vNEOoP Ow6Ftd78LZRlpheq6pBBVJ/gBHL9WZveossHLEreSeOQdy+ALzJZqUteN6Ap5XeRyWLK jHaw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=eTTbdxLN3HKdKSoZdxErT0gjP0zXDf/kQQBWlSaDLP17mkwjPKViWaNHoaIdwkJ8oM kuGuknrd/jUIUnSELcCfCnE1geGe7KrTfRKTRoMKv+ZVtrpaUVtzNZFmkkh1TJ/iumjL ujNSfzZSzlzmPTkS8dMR387ZlZxApaa3xXcxmwArcCkVI81JPrD9KCCfMDjNocYBiIvc KfL808JgbsYFZwM4gWNJaHRrgjW8MyZOTN3EL6hiv2p9vtYRwEi8/giCeYOmjL0gVvrw mbj2jT1lXsX30jjfflTVn2NPqvX2XQoGRoR3rdH5NmAa01Zjuyda147qHLYzah9dkknU U92g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=5D8VVm2h; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y27-20020aa79e1b000000b0064d43f63156si6500287pfq.354.2023.06.22.09.29.18; Thu, 22 Jun 2023 09:29:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=5D8VVm2h; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232440AbjFVP1I (ORCPT + 99 others); Thu, 22 Jun 2023 11:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232448AbjFVP04 (ORCPT ); Thu, 22 Jun 2023 11:26:56 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBF01FC0 for ; Thu, 22 Jun 2023 08:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bNP2QP5Ni+R04gUfBIZ/ME/Gg1p0hdux+QAscFzn4rPhpRPejY1XoQMhkBAR8+HfC8zbyWNKJkpyQXELxzIY9JklCAZrCk1wxlbe99rrleJTJZRU0tq4TotMhuQm5SPwTWK7JAnzvPq5AGYflxLjR9EE7qYFBGArPb66Wk7lio/n+iqYloirRyEhLw//vDEpHsktJYXa5CPnluhaMnYH2PXFBms6hNvhQYh96eN/H4kJnMld68KJBqs0wToiRezhtKtPkjlERmY+5UOEb2rstsiFG/wo7ti/3UqOWPfDDxUeI+FQminv0TuCSR+LDILYqIBGQg6x3YuoX3BZneTyUw== 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=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=GSJj0pAvu8KP+LFVJFDiCfrC0bCODaahDkW4D9KrlN3QtgrrinXQik7dJ4L4rAUdw81iPo7hUiqa6Dtg7lagctwcMdc+HgKJ1/kokmBAGzv/B4e/tKvQLTc+Qm8Xvulpl73dPRaXsuDeWEd2RqG9ftkrZg+H+J7pJp/a2wKO20jS0YTa+P9m4uGBsrdpC7/6ITl4aT2URFvALN9GXbY5Jcb0UBj6GJApKT1z0QyzsE3kWNGiIpEJfkdUC3/34KjExXD6AgA6la2y7YrIZBYsFHO+GYwEpNSiOgqhXjPRFb8z+iMDA4FxW8dLgk7FoeZgOy62V699riOId/IeqMsjvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=5D8VVm2h4Bp+FbQHygieZtd/DEnUODNOxQbl1o7CtgEdSRu9c9c1F9QZGfGszssPhLHuc3OdloiooXbc9kUuMeJwcllwH2Lowa0gX/rCU6BJBYOH6zMc/Ci3nbIChhgGP9ZoTDnNPoACljLVCVOcN83ie0L+3/NNGVqsEvWEIsQ= Received: from SA1P222CA0033.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::6) by DM4PR12MB7648.namprd12.prod.outlook.com (2603:10b6:8:104::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:26:29 +0000 Received: from SA2PEPF00001504.namprd04.prod.outlook.com (2603:10b6:806:2d0:cafe::f1) by SA1P222CA0033.outlook.office365.com (2603:10b6:806:2d0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:26:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF00001504.mail.protection.outlook.com (10.167.242.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:26:29 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:27 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:26:24 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH 07/11] ASoC: amd: acp: store xfer_resolution of the stream Date: Thu, 22 Jun 2023 20:53:51 +0530 Message-ID: <20230622152406.3709231-14-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001504:EE_|DM4PR12MB7648:EE_ X-MS-Office365-Filtering-Correlation-Id: 66355664-f616-494e-2040-08db73350d42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sjCB3Ll2q8XJjWgq0BeDcjq1LOU1Y/jp+ztjS/quar5R9bs/M4VnqNmKlqA2yvoL/0uKz//gQlYaxnQTgoI37SkBD8cMkY0JJXfLUJe11hi3KfYfcgLdXZbBO1XvAE6rnT7qEklQBiGYJwBDLXBYDZaY0P8J9ECIKeYTZ7CV0L/lFtIFRsoKboHYdRP3Yf12xKyE5FKnFbulqV6dd2Wx07iscWR43WFLslgSYErXfRql6YoAnTy5tPwp0OWvxTCPkQD3fXfr7Is8bHPZuBwDA8N9E3pJkabrvsHpDwKfgkf7beHL/eBP5qyvBiVw0JQ/7NW9QMnZrKR9gJ6a6je2854d2irPbfmRpoKXeFr63sTA8iBbbcEr8rHGKS5ZSxVtx1+dnVv4A6xA89YQXgRZsWdi/CpRTNlgn6ezbBEWFVs6jmfipP4mq6Qoa9ivJAuZY/DyDQ9K38VpJiIqxKaWOVbjCK7e2wYXOd7ZwAKouAfuB/WN4zhV2eabluI6J43yu6jRpq9SXWEJ2qZnlk2MSfl17vYuMG0rnEyAtZAAA4fqOfozo50YkZaeLaMwHbU/sMgVXzRxLbAVGxDob3kIja/+lVVAguE/JbpCsUpjLe43gkbjAHrBfuiX6qb+mC5LfSqik7knHVrTtkeys1C3Q/ru4P/vb3n5Ga21AKnvRiMw2dvDAP86I37//4IycpaVINfD1PY93D//hcd810vAi/xvgmlJ3aNyNCo4m7yg2edxescziMhMHpucDL2j7HsmXnvxnUWx+KB4MqN/Aywmkg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(346002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(40480700001)(40460700003)(86362001)(41300700001)(8676002)(8936002)(336012)(70586007)(70206006)(2616005)(316002)(426003)(5660300002)(7696005)(1076003)(47076005)(478600001)(6666004)(4326008)(186003)(26005)(54906003)(110136005)(82740400003)(356005)(81166007)(36860700001)(2906002)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:26:29.5330 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66355664-f616-494e-2040-08db73350d42 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001504.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7648 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769419367523372688?= X-GMAIL-MSGID: =?utf-8?q?1769421010696968893?= Store the 'xfer_resolution' of the stream in private data structure, it will be used to reprogram the xfer_resolution for the active stream during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-i2s.c | 2 ++ sound/soc/amd/acp/amd.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c index 09b6511c0a26..09dc5f2c0bfc 100644 --- a/sound/soc/amd/acp/acp-i2s.c +++ b/sound/soc/amd/acp/acp-i2s.c @@ -149,6 +149,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_tx_resolution[dai->driver->id - 1] = xfer_resolution; } else { switch (dai->driver->id) { case I2S_BT_INSTANCE: @@ -167,6 +168,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_rx_resolution[dai->driver->id - 1] = xfer_resolution; } val = readl(adata->acp_base + reg_val); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index f53613216397..38c152c6c8c6 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -166,6 +166,8 @@ struct acp_dev_data { struct acp_resource *rsrc; u32 tdm_tx_fmt[3]; u32 tdm_rx_fmt[3]; + u32 xfer_tx_resolution[3]; + u32 xfer_rx_resolution[3]; }; union acp_i2stdm_mstrclkgen { From patchwork Thu Jun 22 15:23:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5174206vqr; Thu, 22 Jun 2023 09:03:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4UUVA1O75lyChlNLumRKHYVCaSQQf3y/Vvln0UEsjll9P13ZCzhLsVR+1cbrpPJbxg+xjh X-Received: by 2002:a17:903:1cb:b0:1b6:b26a:67ec with SMTP id e11-20020a17090301cb00b001b6b26a67ecmr1460843plh.58.1687449805713; Thu, 22 Jun 2023 09:03:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687449805; cv=pass; d=google.com; s=arc-20160816; b=R5iA5S07UWMYYrRk8mj8WSbQppHnmp/PKBQTMK/nQrH5OMY91fdrlR1zUi6sJuIsWs hZCOSUw+KCNEssix8QpxIuyDtIjIB5LUGVHu8DCrzlyQgQNjJsGdMGfjphhj1D/+Ed9J ZMUBSQC6EwUb8LA0aXx1Mn8WCwGbdlJqAxosC0ERSJvqcSWjfCjuch9DnyPMJQcDJpvw TRf9IcuHi+cVEFc9IOyjEE9MmsOgSQrIcmFZJvlkFTy2XSXlh45ihtVIdJCNl+sudOve AYZ5Nid9/TfcIiKJFE9xrInvg8QyuwlSU/zYVN8PRhkYhoIZWsvVrlNv6L+UmMdFx0Yb P1OA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=Ceq1jynFctLlSfQT3qRIXWd3f9KEh6UffB2J7k6ofjEJ/b1rqXH2yCeeVWOh3PoeNi 3E7kGQgQ1voHqGLTybHa71akD2CFUcBS9eE5UgkFr+xKVyrK/LleQL0xUFBhRe4LMVUk I1nb5gkKiL6LQ4E5GcgiCMwdLjcaSzc1rx89jQbdw+20PYqfq0Q26oSHRSe2r3/tleEB PH8JfI4shpopmsY+KWuGwlnnRe0mG2vFyIGaFQcso7l3K5ujm+VxC6FXnNcx8eSjux3o xkjdFJv3TbNon3DMiM/TlZDAx3oVULsueh0Rrt0QL7WTCN7tTmoA55FmCF48aqFC31LD /R0Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pCgUZlUp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020a17090340c400b001b392bf919bsi6624418pld.407.2023.06.22.09.03.07; Thu, 22 Jun 2023 09:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=pCgUZlUp; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232538AbjFVP1c (ORCPT + 99 others); Thu, 22 Jun 2023 11:27:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232422AbjFVP1F (ORCPT ); Thu, 22 Jun 2023 11:27:05 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2087.outbound.protection.outlook.com [40.107.212.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB144E6E for ; Thu, 22 Jun 2023 08:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NLHKAM92mGBUdqglIQZRk+if+YlvbFTl0CTPrF8KLtw0zJXtRl5+wx33aY/eIGNLvvgFwo52Og7vQi0kOzF0Y59iU45jsxf9TDMmM5uZa7ez9bmIgRUZ8s41xzW/UlKUbu7EnqyqBlP++2bHC2lfWEQ1HY4y2WuYOdXV8UGETD7nnEx/5QZ9XBKbB3dtzQCXsRVgGh5TSg/ePe8M2UePEJ+zdkWS9CZD9RWOAexRMrsswlh6fUnIA/f+A/0/iCVeB5+kBHU0cir/kwef36IiiuMDWtKtV+IzKcAylBPeaS/W2/2Ei/PMahwLxa9bBwU5KDHmKol50KZI72NfL+R5zg== 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=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=WRcdfzvy//g/bj6qnvmLTbTPS+GTEfZqjLBUAgZ75oX9+2mZLh1on97aEFCoqE7NfvUIrE6PUS2De/ecYpp0BUAI0kh9kWAUANODhYNAugQH71ww0lN2sQrMod+vzLL2cS6bzee4IpD1+r2Ali2vzDNd1b0O7KRlvjKVmLSwDL6m9hbqrogzlsb/5zAeAjH/zSHB+vpfQ76m2/N3n5zdqkpHus8dp00lkNPNYYTIQQcbsvnRINHBdbyOx5kQFYXx+m+sRWiSTT0Z2wMwelHczQkcVPNQktwLQvZJKYwzQHZYtVWJiXGDfqaNHynpijoWAVnQJqTn2uY8U2K051n7sA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y1gJUJChraGI/0cF68p/+kGmZoqkKWvMw/xcvMoaTYc=; b=pCgUZlUpPwXjbwbtlPL+tEHh89paYrr3leimp71BTqgFGcc5XILqVtRsNbiGsatx9lidr82toYdlLfAgDbv/dF4uWRtj/VC6ytYo7fLQtUfcu+6tfn5k/wpPTKqJ/7eIuyEG6rluVWyNqV50wf51t5LWLqPfYCMxaGAiaMpn1Nk= Received: from SN7PR04CA0221.namprd04.prod.outlook.com (2603:10b6:806:127::16) by MN0PR12MB5906.namprd12.prod.outlook.com (2603:10b6:208:37a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:26:40 +0000 Received: from SA2PEPF00001505.namprd04.prod.outlook.com (2603:10b6:806:127:cafe::f8) by SN7PR04CA0221.outlook.office365.com (2603:10b6:806:127::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:26:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF00001505.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:26:40 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:39 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:39 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:26:35 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Venkata Prasad Potturu , V sujith kumar Reddy , Ajit Kumar Pandey , open list Subject: [PATCH 08/12] ASoC: amd: acp: store xfer_resolution of the stream Date: Thu, 22 Jun 2023 20:53:53 +0530 Message-ID: <20230622152406.3709231-16-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001505:EE_|MN0PR12MB5906:EE_ X-MS-Office365-Filtering-Correlation-Id: 21743cbd-a690-4ae7-6519-08db73351390 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pxqpl/k18Rdn9ObUyxAPN7dHfsL1sLbgWznVX1tMZZgLG0odTrQrIOpld+J4q04PKxidKVHczAKANRMXEuFZLZ53spybRLcRzvnhsFIkOrnCtCEkoHLv8foz64BX3abQk218Ti9mpR30frk+4ZMZCgKqMz8ly5vkzN5dyUvTWP2SMf3ve7RNP8IZRRUSjlPHBbKScn9jiw8JZePnb/yASmEt6mw2HVIC4mUCQC7H9KWNESaEguaV6BkilfbjSYeTJ7GnE/PW6inGa4uzRu7XS7XsH93+Q1hLzqzfbUpPf3zKttqJcJG7saQqFM1bu3DMo45v3a/emKf7svdXvF1wEV82zsMAc0ws9dGtQxTUrFKEOysTl1L4o9WAUHDEZ2tijzNqLSBCK+5SxLUyQ0xTlr8Wr5Qwp2EzDJO8Pj3q9Eb9SCRDwBodP4hQL6+tbPW0vqyx4BcGeoc2pJs2t5HbM6VpruowesCR3ivjx1m9BToliyzgEf/Ed7sglyN1kWZ/ogSG04QZRABLxqOyfcjjg82nJ2B/P/d7v6sZnD9kPF/Tg16zvUsaYRAwFF9X4bm52uIzbzkhsyfeDVFr7KVBb/VfJRMYu3NlHCZwSxr4BgQVvX56qctpl9bntB4LU77P18/BADUIL+jx755ooh7P7GsUqnEHBxgfGnDDPg9aPiipmK5BGPM59u2RSFM4sTO9ZMvJnSN8t+tvsmN/Ve0XcLgH3NjRGMYmOXtcDArPTRyikBwM0bNKkTi4by687gsBmKrraHqg2ynMnHId9EI/Sg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(376002)(39860400002)(346002)(396003)(451199021)(36840700001)(40470700004)(46966006)(6666004)(26005)(5660300002)(82740400003)(186003)(356005)(81166007)(1076003)(7696005)(82310400005)(478600001)(40480700001)(2616005)(8936002)(2906002)(8676002)(41300700001)(40460700003)(70206006)(54906003)(110136005)(36756003)(426003)(316002)(70586007)(47076005)(86362001)(36860700001)(336012)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:26:40.1123 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21743cbd-a690-4ae7-6519-08db73351390 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001505.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5906 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769419367523372688?= X-GMAIL-MSGID: =?utf-8?q?1769419367523372688?= Store the 'xfer_resolution' of the stream in private data structure, it will be used to reprogram the xfer_resolution for the active stream during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-i2s.c | 2 ++ sound/soc/amd/acp/amd.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c index 09b6511c0a26..09dc5f2c0bfc 100644 --- a/sound/soc/amd/acp/acp-i2s.c +++ b/sound/soc/amd/acp/acp-i2s.c @@ -149,6 +149,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_tx_resolution[dai->driver->id - 1] = xfer_resolution; } else { switch (dai->driver->id) { case I2S_BT_INSTANCE: @@ -167,6 +168,7 @@ static int acp_i2s_hwparams(struct snd_pcm_substream *substream, struct snd_pcm_ dev_err(dev, "Invalid dai id %x\n", dai->driver->id); return -EINVAL; } + adata->xfer_rx_resolution[dai->driver->id - 1] = xfer_resolution; } val = readl(adata->acp_base + reg_val); diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index f53613216397..38c152c6c8c6 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -166,6 +166,8 @@ struct acp_dev_data { struct acp_resource *rsrc; u32 tdm_tx_fmt[3]; u32 tdm_rx_fmt[3]; + u32 xfer_tx_resolution[3]; + u32 xfer_rx_resolution[3]; }; union acp_i2stdm_mstrclkgen { From patchwork Thu Jun 22 15:23:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5190566vqr; Thu, 22 Jun 2023 09:26:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7V1Pnn4XOAOobgHzBTnv9O7UMen3svzycbERnaJdStdKpMuMeLGuo128dDORO+mvdqkZyQ X-Received: by 2002:a17:90a:68c9:b0:25b:d4bc:28d4 with SMTP id q9-20020a17090a68c900b0025bd4bc28d4mr17938475pjj.40.1687451177097; Thu, 22 Jun 2023 09:26:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687451177; cv=pass; d=google.com; s=arc-20160816; b=xselFTrHzwSNA7kS0qQw1DPpLAH19yiBa0B1QzJv/0pgmMzcoFAHnmgIDcFxyFgn/2 SV3jLI8CAgXP1XvPhVkay5R353QPT6lZPuhbTK9kzvmlQm+LdwqqO9HphJOtbwyPFBjc 2q2fHEDOvoJbwq86hDlLz8dYTkM3qv4oZ8PzEZDT/xh96O/oSl5lUR2ErCNLi/FlFxmZ D1U/SJPuqaUM3RXEL2IxcMK33dhHvzxgFbazwFoXV+1bWkMZxiK3srROYJ3O+AtNDKaH Z9uCFQ84AfBUfbScMQf87U/Cnws+VL2VLIj96Ibm0eBEdh4cOfP8UC2jSPw0ZiMOgpmY YHjg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; b=lsLy8scdDYpW2naIfNeK0nYs60o3AoHogu7JGLqD6smo7nIvo/0ietJB/xq5AlN8He VNWAggtzcoXEvRkA21rVAMW75sfeSYR4Byp+qb/B1+FUrTtZNTRZRpmWcLon5QFyvo1f sBlBzQsvMWhN7ZWH+PJehFVGdK3oYG4yd/X7hTyIsnMetRenKaM2j1Ve8I1E7lZPoTes q5245hRmZ5F+1iRSlGmCOb2oZ/klyGOtUzfzRFS/6b4nwaCBu7NR34k1WnzoBfZh8eCy nDNTowdFBGifrnSzg15WM/hBPuhjeTRUfMX/1fpAhE99gRj++A6BYD8FeL0/bfvUaOUn W/Tw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=bXxJ1uA7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g9-20020a17090adb0900b0024df4dae398si14322552pjv.18.2023.06.22.09.25.59; Thu, 22 Jun 2023 09:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=bXxJ1uA7; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232362AbjFVP16 (ORCPT + 99 others); Thu, 22 Jun 2023 11:27:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbjFVP1a (ORCPT ); Thu, 22 Jun 2023 11:27:30 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51970213E for ; Thu, 22 Jun 2023 08:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UNwlF4D1CjahwXloZYuNObgG+5yOAsh6Qhy8ns7kFzZexOSUz12ZekgYHTudkvpKyxoBwVKlgNVpNFeeIRFSB5KHk8qimGIZfKveS+rtV9Ht+E39eCX5vsgYz66EVA3xFvF9FgaF2+o5vS8xWdH2tnFIi3eW9hNNG0uKdcuWrOu8jc4gpxxLevFIyR1Dc2RRMlWvtSubA74D/O9VYU9yjbJhbSNNFUa5YQPAC+CKVaPAw8yLHUOZkTCzugIQHKNeqFioFVEnqNmiADIO8aOf9iQaUyMYb3eGo01jrZpbC3k1Nut5JCU+hOUE8DjwnxJ16eOiq49lHUe8tEH/AJ28bw== 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=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; b=LNKaO6SeawFTKRPZitVsLHzAtgGxZetvG+WIHDJvoW1zdrwbjIWl1SupSi3Apjd9RgDSp8XLu5i+uYL+riTUEUmrXKkdOOWaijbEx0+3UTcGG2uNFzy8925La0iYXSgbNhuG1Fqw78nPfGgncvYyZ8HsxzHfPxi4wRRfvjZhVm+Sev3SltvWHS5s3A15vs81r0NOsdTomuAPsydrxt0B77Ng+hIXcZ+Qk66oId10SyOTwq87tnCQcsC9fh5v5ztULFSrcj5Qvv2t20ytFHG4Hr/n9AefQ9J28rZS8Iu2zk6aafwkA7s2DEpIyUsN7ph1yTBKPNE7j2rppvyI48nT6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RuC/p36abO8JEZCdYis01V1LLwMVRik6s9LS9KgnaLE=; b=bXxJ1uA7K6HS1gTJ3AxfFL81n5Kz9IJEoVU8J5NajgVABodJBGUPOqbO9790V/l0HrSjm22bvK6gDTe42SOVv6IbOhcxdVOXOcoK99nQLYZOkA32/Yl3RTpbKmb2oAuKHfAyI/hbza4nThjMLZBzGekhR0mol5jh6lXSOX1Kdtw= Received: from SN6PR01CA0025.prod.exchangelabs.com (2603:10b6:805:b6::38) by MN2PR12MB4584.namprd12.prod.outlook.com (2603:10b6:208:24e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Thu, 22 Jun 2023 15:26:52 +0000 Received: from SA2PEPF0000150A.namprd04.prod.outlook.com (2603:10b6:805:b6:cafe::29) by SN6PR01CA0025.outlook.office365.com (2603:10b6:805:b6::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:26:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF0000150A.mail.protection.outlook.com (10.167.242.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:26:51 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:51 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Thu, 22 Jun 2023 08:26:50 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:26:47 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH 09/11] ASoC: amd: acp: store the pdm stream channel mask Date: Thu, 22 Jun 2023 20:53:55 +0530 Message-ID: <20230622152406.3709231-18-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF0000150A:EE_|MN2PR12MB4584:EE_ X-MS-Office365-Filtering-Correlation-Id: ddc39596-c3f3-4893-39ae-08db73351a75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FGzXHGqs+Z4Q0p/f5r7Nucx14zhPgtwdkiBoxRbWG6sz3aDSppsn9SfHPiqC5VkuS2qngPxuZhggGrZk0GH242Ly230a2VtFsO6J3zcysxRPHdXRfAFK3xoCh2OsBhcaK9Vyh1Sb0KDHB3GMtbyI5htK2BebU661sorxTNO870hwIVRLmsPso3ArvHglxk20vYS/p/FBvjsjJ1cg64AWV5mWj9F4SOAoUuA9tTk2xR/yx86YpZugdFNJwu7IsMGUw5vws356OkQQWRmS0v18U7ITtNkFrPLOAtzx47LmqEVCH4rYygySzc8s3cbCRFnR08k7HzlEKj7FfUXwOqEFW4ugNbhsbbo0QotIMacp1EAJrQagA4FQB0EeH6LfNuMWmOun1XZwl4h3Swk0yMoEgu8OHPOS90UUlFKqZj8RpIXKrEtzpRqEb2FMnycOTODRaCO2rZWrygzr0n7bLC8EA0PaQ6CgAgMVefgndAzdpE+8669UtrXFeN5xnU77v5kv6MSIugxXbG64KtbIsj6h85AQuCM/3+e6GkTymS3LHqOSiBTGu4eRFqUG0lMIouxqCo2ty/APCGnNNL9H2kxkOxfJaadSa3j/A/x/FdUTIwxnp7MCie9QT1qRq42RvSTVU8/4UU6w51+dTpOY0J+89oEsD62qxlEuKGD02OehsatHN72w7oiKvP9UtBKx1dL45IgpVJhqQdBlco+q6bkE73KOx3ziYrg9hCHAjt6D32ZFZVpvyQEgbMvEnA3FPlEURbAFuigpTG7c25ETYbPO+Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(39860400002)(396003)(346002)(451199021)(40470700004)(36840700001)(46966006)(40460700003)(110136005)(336012)(2906002)(186003)(2616005)(426003)(54906003)(47076005)(36860700001)(4326008)(316002)(70586007)(7696005)(6666004)(70206006)(478600001)(26005)(8936002)(1076003)(41300700001)(8676002)(5660300002)(40480700001)(356005)(81166007)(36756003)(86362001)(82310400005)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:26:51.6783 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ddc39596-c3f3-4893-39ae-08db73351a75 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF0000150A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4584 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769420457728374384?= X-GMAIL-MSGID: =?utf-8?q?1769420805410072212?= Store the pdm stream channel mask, it will be used during system level resume. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pdm.c | 1 + sound/soc/amd/acp/amd.h | 1 + 2 files changed, 2 insertions(+) diff --git a/sound/soc/amd/acp/acp-pdm.c b/sound/soc/amd/acp/acp-pdm.c index f8030b79ac17..2833d2b7e596 100644 --- a/sound/soc/amd/acp/acp-pdm.c +++ b/sound/soc/amd/acp/acp-pdm.c @@ -135,6 +135,7 @@ static int acp_dmic_hwparams(struct snd_pcm_substream *substream, return -EINVAL; } + adata->ch_mask = ch_mask; if (params_format(hwparams) != SNDRV_PCM_FORMAT_S32_LE) { dev_err(dai->dev, "Invalid format:%d\n", params_format(hwparams)); return -EINVAL; diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 38c152c6c8c6..82e0684cb284 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -164,6 +164,7 @@ struct acp_dev_data { u32 lrclk_div; struct acp_resource *rsrc; + u32 ch_mask; u32 tdm_tx_fmt[3]; u32 tdm_rx_fmt[3]; u32 xfer_tx_resolution[3]; From patchwork Thu Jun 22 15:23:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5179394vqr; Thu, 22 Jun 2023 09:09:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Hgu/ZmU+T15iAMsFT9I0XIU+QZ8/K/HvXVUbvnS/I0PLDLVV2fxogBcWM3ZvhT5HC5YKM X-Received: by 2002:a17:90b:3542:b0:25b:f0fa:ab3a with SMTP id lt2-20020a17090b354200b0025bf0faab3amr8112043pjb.18.1687450156135; Thu, 22 Jun 2023 09:09:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687450156; cv=pass; d=google.com; s=arc-20160816; b=thOpGFNepGLTb0k6ConcmnUMowUaL1XcN2O7GzTbFMkBd4MLnlMy2dwU+E4BE4PjAU uOB/dpGBUzPqKsJxgjfts/K0lNwQSNFCfArqOiLT1y38CzF/8uDiD1EOOsWyH/o+FHjE EIFsJ2xDu5F0g2OL3QB/bBA9Wg08gSEPthS+sqhnTRCrsg28O5RVcx/Bg71jqOEIewcf Y4DVBxtucDfs/W11/8JwXhTeqqdM3rg7AEsrnYUWUfJfBnplMAWn26oQRWutsMaoPsA4 OzLi2JCyY//MTjTRn+AuEKGlGnE0F58x4sL4NwYYwZ37C48RQSFqGsvsLO980wL3v56X qNsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; b=RGHI7wRU9txoNsmXb99v3ZZfIdfvohsYIyeKbxRSWu/TXFO7Zv70wCXlvUkVhCOSlf n1psU00WZRC5GETPOrOzGl8Rn/y5Xj3o4YVJkfVXKQ6IMXUTct7IJOiPVDapDroIZwL/ TJXkfifLoBwIaY2DCnAHs6C6nDmD+FQGOvwSE+TnMTAUd7cpphIqAYlOhvR/PWDdPExf PeSNhXnE9i9xF7P4yTN10cKrAykrHje6vmyoQn9J3J/1xeCRzUIszpcyJRHDw2hTeNSQ BwAdcqPBOgMYry3xUJQQBt38woMVHuX3TAlOJoqLWgQjIHbYKjcqUBeM0Tn9bLMu3cdr 9Stg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jL4RNEzX; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e15-20020a17090a728f00b0025906ab207dsi6670273pjg.64.2023.06.22.09.09.01; Thu, 22 Jun 2023 09:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=jL4RNEzX; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232605AbjFVP2S (ORCPT + 99 others); Thu, 22 Jun 2023 11:28:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232462AbjFVP1e (ORCPT ); Thu, 22 Jun 2023 11:27:34 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2062.outbound.protection.outlook.com [40.107.93.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A57135 for ; Thu, 22 Jun 2023 08:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d43SBcvYmYjRLmWKkeYiZ7/2h5Ow4iR6k7zctMNq+um/6KwKXws6EIAETipyE0uC8SGIGtBAnFE64ugxbgd9MgZ0VrsuMBNlD/2Js9p0m/rKKpHg3hJznPbpidD75jIUE0t9/Go3+8MjNz/6VXFB5qAHupLG4Hka6tNHbQRuSXWFGeskkvojzuUL4jH+2Jl+9HRc/gv9ZqEGqQ7Gc2TO1Drmk5tC7Ft3qxRg1lucvG99n2YpeVkwKDp7XLoTEnfMzkM/HdtyIyT8BWfR87J6stISORcOE0dSKhTF5ggfXKDhkaMhkf7EMArbWVHjpGNNvXq7vwW6RxQCucqTe7OZMw== 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=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; b=BsEkflmG21CSqv3XZBQh4y4OHvUb1Jzqv3xsY/paKopCKD7yHkyXGHktUdDUB+eaLeDTuAPkEOALcmJ1e30du/KUsVVdSZ+zpmuB8EPVQWr6KqaUgFU16NfAJyBcNhXV8M89sijhzKcA3M0cC1i/6aBMuKpnLmD8AgNqQrLQOC6i96jIPV9VepEm7FsWQw5wg9z49rBo073DE8VIJaQ2n5BG9+MhjmHKgbEAbZsZtAel5VEVI43j0+IAT7kypTnMTy0cG2L55iKN1wfvtmvkdf2m10BEbqdlB3rx6DwpcGWs08gddDutYq26xWja6kOaMj8B1PqqsibYfRRdeMK2Zg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iBy8FZtzhflK/O11biPfyMuMDcZU0bVlpYPp66Nv80c=; b=jL4RNEzXDM23rU9SymWljx4xnZiWUv96TqKMDcKnesZvsv9saqTvxGAYqdusjy2iBxL7UvnKsixFCes5xa14Rdgo4tTz8vntfzbqZ9qwcSq1VtlawHrDhseuLECWFYJ+Hl1bABEUPmkuszvIMAI1nSfjxivURHJGaFkERFytpb0= Received: from PH7PR13CA0005.namprd13.prod.outlook.com (2603:10b6:510:174::8) by BY5PR12MB4305.namprd12.prod.outlook.com (2603:10b6:a03:213::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:26:58 +0000 Received: from SN1PEPF0002529F.namprd05.prod.outlook.com (2603:10b6:510:174:cafe::13) by PH7PR13CA0005.outlook.office365.com (2603:10b6:510:174::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.9 via Frontend Transport; Thu, 22 Jun 2023 15:26:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529F.mail.protection.outlook.com (10.167.242.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.23 via Frontend Transport; Thu, 22 Jun 2023 15:26:58 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:26:57 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 08:26:57 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:26:53 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH 10/11] ASoC: amd: acp: move pdm macros to common header file Date: Thu, 22 Jun 2023 20:53:56 +0530 Message-ID: <20230622152406.3709231-19-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529F:EE_|BY5PR12MB4305:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b2c6004-2ef6-4a06-2c88-08db73351e3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JEbYIWKG2bfqu5fh90jJOJDt23XmTRqijRLFJCVZGV0JtYdwZMY2E2dlox9UIBJNoCy+g/1XU5Xm+pTqskzTNBzC5dpxAyOvDBYsTyhJ4r6/ji6pZgVmuow6twrx0x7KNm4BFc4xju/aEbqlvHYK14J1g2d0MchiqG/WiOXLe8PKfCSmaG8zFSsSfCK0ihG9a2GSup71QPGWeK9nto5UyxZHpn3ZYOlQn9hAWI48v/GvQPO0mksKomTIwSUTrBNVkVtlW1hb1gng6BZsAAdYLH+xIrIVA9rng2OHt1EB5hTfcyIOleGkpSoZnJzS+B69yF+LBtPfKtLzk/Pxi3QKd2OgXTVDeKMjwWRKK3upHB1zSlCBHy+a/HPtLsFZm9ZBqe9a4ML+38Zfav5TF3/Burnm+wc/P62w5WsXKm9SlBYhW/hkjhEY4+OKv8PwEFaw4JY10n2CZZI/Nb7I8+7uRfYvdIqHwxBcYwxiUJxSM2j7JpHkzkqLlYaFuAnmiuNuihy6vQ2TiymrHApt7OZjN46an2g6khZFR3ln6etlY+oWUkNh1QonBruMZ+Tkgy51kAuiR4RrKF7/UNTIUGbPZ0T6nrP457FNOat95k/6/cfw5AMVADrk8d/+U+7Cv8nJ2T9A64aHyo343vy6V7k8B12jUezWUPp7NxdFCOtGLjNYrsMrcFKHFIYIjJ59JBmMBidh3YW8BTKidI6bhBaLDiwJ4Q46pl3nOZ3zhKb2RON77i9Ne/qpmlRTl8fAqjxIb0z5N3w6a5sCAko8r7VPyQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(396003)(136003)(346002)(376002)(451199021)(40470700004)(46966006)(36840700001)(356005)(81166007)(82740400003)(2906002)(36860700001)(82310400005)(47076005)(83380400001)(426003)(336012)(8676002)(8936002)(41300700001)(26005)(5660300002)(186003)(86362001)(2616005)(1076003)(40460700003)(36756003)(54906003)(7696005)(110136005)(70206006)(70586007)(478600001)(316002)(4326008)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:26:58.0243 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3b2c6004-2ef6-4a06-2c88-08db73351e3b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529F.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4305 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769419499016382870?= X-GMAIL-MSGID: =?utf-8?q?1769419734950490250?= Move pdm related macros from pdm file to common header file so that it can be used across different files. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-pdm.c | 12 ------------ sound/soc/amd/acp/amd.h | 12 ++++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/amd/acp/acp-pdm.c b/sound/soc/amd/acp/acp-pdm.c index 2833d2b7e596..f754bf79b5e3 100644 --- a/sound/soc/amd/acp/acp-pdm.c +++ b/sound/soc/amd/acp/acp-pdm.c @@ -25,18 +25,6 @@ #define DRV_NAME "acp-pdm" -#define PDM_DMA_STAT 0x10 -#define PDM_DMA_INTR_MASK 0x10000 -#define PDM_DEC_64 0x2 -#define PDM_CLK_FREQ_MASK 0x07 -#define PDM_MISC_CTRL_MASK 0x10 -#define PDM_ENABLE 0x01 -#define PDM_DISABLE 0x00 -#define DMA_EN_MASK 0x02 -#define DELAY_US 5 -#define PDM_TIMEOUT 1000 -#define ACP_REGION2_OFFSET 0x02000000 - static int acp_dmic_prepare(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 82e0684cb284..8dc663c8d98a 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -111,6 +111,18 @@ #define ACP_TIMEOUT 500 #define DELAY_US 5 +#define PDM_DMA_STAT 0x10 +#define PDM_DMA_INTR_MASK 0x10000 +#define PDM_DEC_64 0x2 +#define PDM_CLK_FREQ_MASK 0x07 +#define PDM_MISC_CTRL_MASK 0x10 +#define PDM_ENABLE 0x01 +#define PDM_DISABLE 0x00 +#define DMA_EN_MASK 0x02 +#define DELAY_US 5 +#define PDM_TIMEOUT 1000 +#define ACP_REGION2_OFFSET 0x02000000 + struct acp_chip_info { char *name; /* Platform name */ unsigned int acp_rev; /* ACP Revision id */ From patchwork Thu Jun 22 15:23:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5170176vqr; Thu, 22 Jun 2023 08:58:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ748xmRgs68JU88mmIdpG2IHyvcCiOIjiLCjB/HimY1dRoWIYrEhyQGM+2tpOetC6M5w1mj X-Received: by 2002:a17:903:124d:b0:1b6:6625:d3a8 with SMTP id u13-20020a170903124d00b001b66625d3a8mr12233556plh.16.1687449500279; Thu, 22 Jun 2023 08:58:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687449500; cv=pass; d=google.com; s=arc-20160816; b=Tm5TkYcKmK3ngF0iaE+sLVPTNKzvZywEsb2tdr4tOiJdBnB1Ne6VTEWq3s3xIfHPcy I8fDk1eaX1CQOqW+NM1F+jbni5tA3TunKq5B3r4ey2NideuivFf/KhdqGjO6bzc0eccl Ygw4MtePhobnndzxY5FWTy6fY6DEV9rvAWFMsxaItXiTGy5/X8dyiOMDOd27f+7RvrsG bNPdhZZLQhOMMqKXZKeILj2mMa559C/b0PNMT2c84KhPILweP1muRLm+vWa2uC1qlHJi p0gjGfH5vbFe0xNMMdTSiY96gUXe/NUb7FPtgsN9zXBiwOS2KJjqHaWN+FX0mYwO4d8t LB1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=Bxgi9gbHadqC3vX+pib4I5KUzL5gKWXwlwdT7BAUrPw2f07f3bDxLNOwmoG+A2E/p1 e4GP3FLSLZhzn6nevXte51cIEn0LDRBjr72fdfw+XXjNzSnI2+7qe39f0F5Q67s0UNcV IjKx8hJgJEFHJUVKLM8SFPV5vlT5A9C46lnJK8iDEvAPsYkTzr+Fb/6Mh1nnIXFjuVE9 DcDQx7WGD2EF0iV0WooH7R2Ch7VdrbG+0SILuH2ATentD5fDhsuNSiiRhyUKUDneAN0r lYZWYw45w787sNUTt2aCDhyOpZgVGAJ+ELHqQIWBgIkOcFMUZpFIDtiAvhdzsiG5Gqda 8CvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VLkm6y9C; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a170902dac400b001b043fb4083si7556422plx.16.2023.06.22.08.58.07; Thu, 22 Jun 2023 08:58:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=VLkm6y9C; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232606AbjFVP3T (ORCPT + 99 others); Thu, 22 Jun 2023 11:29:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232509AbjFVP2U (ORCPT ); Thu, 22 Jun 2023 11:28:20 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2074.outbound.protection.outlook.com [40.107.100.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4659F212C for ; Thu, 22 Jun 2023 08:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nM3cEv73hxrKSFU0DCaW6bmnZBzNF9qp2rQ8dijZco7UK0SS0dQEVYWlO04KhKCzK9NWpCD1PyO3rK+Vqvxoz3obV3HUlwppesXMLGOj7/S0NljsdgRlTeTLjOjw8ISY4AdVUMdaghrEd2c7TO4fzbWVq9LL6n7eHKrjgCu9rdnpT+7G+TrQxnKCBlUtc8JfzHreG/wL3PkJ21idjnFYlnZsmLMGaglvMQ9oTIqOOQefpTu3PpxUEgaGVGhqrKlTolJ+tiWurXf9Xa2AQDxugz8j/q/OmEyFp+pk5y2Ue7Ut1MhP0JjluBXdffPagjUtKsVqkDfIR4qX5DASqY+Awg== 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=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=JJhhf67qHZ5NtivZfsj+TiArhXZda5GYk4nFqwXMajjEyCDCzBTD7rvMVt9d2Bf0H22aiYf7Kw2unHrTHQvF6vtSIWQBP8K2t+3zE+qzKPQHWM3i7piJtM0mpWLxt/3eerVkUW6apoJGJlhsZBl7wfVy50EBnywiRwjTzuBBXMQw9L5+5VYuVfuMdlSTjbzP39+aVdgizG24OZUmVTakb5SrH+4m7s7eHQG/746+WlZBJRLQxOzhdgKTIuS7tLR/bbg46KVuX6uESEi+eBY6mVm9qeXnVpcyL39VosxEdbABYu0uEtOdZfO815ZkhSrLP5F9wDqKGd6NhVecDe9U5A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=VLkm6y9Cy/tStIM+Jg4JT+FhGdH7zuw3AoB39EI8WYBW7DC9Nw56z+T3fb94eRlBs1WZueTprEYf6ym6Fd3YokPvTT0rxDDePJeG0Pqj1n3ndcvhQkqW1X/kgeTJGcfhukYcKzgdozptEBU12GFSUhRqrcLkABJbiD8a4fNHPxo= Received: from PH0PR07CA0072.namprd07.prod.outlook.com (2603:10b6:510:f::17) by CH3PR12MB7641.namprd12.prod.outlook.com (2603:10b6:610:150::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:27:15 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:510:f:cafe::ec) by PH0PR07CA0072.outlook.office365.com (2603:10b6:510:f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:27:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.23 via Frontend Transport; Thu, 22 Jun 2023 15:27:15 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:27:14 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Thu, 22 Jun 2023 08:27:14 -0700 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:27:10 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V Sujith Kumar Reddy , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Venkata Prasad Potturu , Ajit Kumar Pandey , open list Subject: [PATCH 11/11] ASoC: amd: acp: add pm ops support for rembrandt platform Date: Thu, 22 Jun 2023 20:53:58 +0530 Message-ID: <20230622152406.3709231-21-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529D:EE_|CH3PR12MB7641:EE_ X-MS-Office365-Filtering-Correlation-Id: a7bb2c5e-082d-4b7a-d0b3-08db7335287a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AxXdfieeATNUsAy+PYx+wjHT2WcSjUMt6xO+6eBNV0Yky/oCdZoFKDmKZlVH2DzU9SJ3yZR8MBpFVzn2mUwuD/26kSc4/luVp64JJ2poGUniTG1+FfSZm/SjZFd7X46bvxyfkB90bME8k9ItlFY4cMltDvcnVqze1+wID6WuZwh+eQ/Q+7qqG34LGbtz+tqeXSopmW3MaSabBm5IlmJYI4uZsevRD65fCcHjxKzfBZi94GSKRbaCBTxf50AEvD1ZijlYuObjm7Y0ZQc4xXtH6AUS6IXHhEVrF2UMje8PBLtZbEMYAuWUZppjaVcmrBcOzsl6yTfuD4ec9xubbPtcB1nJDDYGJc4AN1N4HDXx1mJLKG34EHqlRJ5YMqCqXh56+z0vhfV7xv2Y2Pa95Ku0iaEB4D1x+cStj6y+ZD48LY3hfFub2mwJIAJb03zeIeIe+n0YK+nO2HHQRYIeIPtsqFeOl7tI5zqOwWfuhwGwfcXlUS5AVKYHMML0q0zVpLeMKk0AzAm94zPLLBpnYGOo04C0rw4416SCrkEF6MdqEb2Y0KDBlHg4R8gFoH0BpT/gIzKkw+SaRNdsiDdSY7Ms7z/3EB4BoLdfgSDa5olKxua06k1fFPXXvCSopEWywNy7x99lA6quC5rXqilZxaGVngsvYf+S6cL3gc2TieBgMvV1i82fKGGbYh6ClBZdvS3hLsp5bcqwnEnF+zglJLV6yu4A10aYXKeWJHKp7q9+dcL+IbLpU8S0hnlj15Q0CDevQxEWM46hY8/OlLusQtIvLg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(4326008)(8936002)(8676002)(86362001)(2616005)(316002)(81166007)(70206006)(70586007)(336012)(41300700001)(356005)(82740400003)(26005)(6666004)(36756003)(186003)(36860700001)(110136005)(54906003)(5660300002)(30864003)(47076005)(426003)(1076003)(83380400001)(478600001)(7696005)(40460700003)(40480700001)(2906002)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:27:15.2030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a7bb2c5e-082d-4b7a-d0b3-08db7335287a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7641 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769419047172409123?= X-GMAIL-MSGID: =?utf-8?q?1769419047172409123?= Add pm ops for rembrandt platform. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 208 ++++++++++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 42 +++++- sound/soc/amd/acp/amd.h | 9 ++ 3 files changed, 258 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 45a45d002915..ba58165cc6e6 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -37,6 +37,214 @@ void acp_disable_interrupts(struct acp_dev_data *adata) } EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON); +static void set_acp_pdm_ring_buffer(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct acp_stream *stream = runtime->private_data; + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + + u32 physical_addr, pdm_size, period_bytes; + + period_bytes = frames_to_bytes(runtime, runtime->period_size); + pdm_size = frames_to_bytes(runtime, runtime->buffer_size); + physical_addr = stream->reg_offset + MEM_WINDOW_START; + + /* Init ACP PDM Ring buffer */ + writel(physical_addr, adata->acp_base + ACP_WOV_RX_RINGBUFADDR); + writel(pdm_size, adata->acp_base + ACP_WOV_RX_RINGBUFSIZE); + writel(period_bytes, adata->acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static void set_acp_pdm_clk(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + unsigned int pdm_ctrl; + + /* Enable default ACP PDM clk */ + writel(PDM_CLK_FREQ_MASK, adata->acp_base + ACP_WOV_CLK_CTRL); + pdm_ctrl = readl(adata->acp_base + ACP_WOV_MISC_CTRL); + pdm_ctrl |= PDM_MISC_CTRL_MASK; + writel(pdm_ctrl, adata->acp_base + ACP_WOV_MISC_CTRL); + set_acp_pdm_ring_buffer(substream, dai); +} + +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 ext_int_ctrl; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + /* Programming channel mask and sampling rate */ + writel(adata->ch_mask, adata->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS); + writel(PDM_DEC_64, adata->acp_base + ACP_WOV_PDM_DECIMATION_FACTOR); + + /* Enabling ACP Pdm interuppts */ + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, 0)); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, 0)); + set_acp_pdm_clk(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_pdm_params, SND_SOC_ACP_COMMON); + +static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_resource *rsrc = adata->rsrc; + struct acp_stream *stream = substream->runtime->private_data; + u32 reg_dma_size, reg_fifo_size, reg_fifo_addr; + u32 phy_addr, acp_fifo_addr, ext_int_ctrl; + unsigned int dir = substream->stream; + + switch (dai->driver->id) { + case I2S_SP_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_I2S_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_TX_FIFOADDR; + reg_fifo_size = ACP_I2S_TX_FIFOSIZE; + phy_addr = I2S_SP_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_I2S_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_RX_FIFOADDR; + reg_fifo_size = ACP_I2S_RX_FIFOSIZE; + phy_addr = I2S_SP_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_RX_RINGBUFADDR); + } + break; + case I2S_BT_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_BT_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_TX_FIFOADDR; + reg_fifo_size = ACP_BT_TX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_BT_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_RX_FIFOADDR; + reg_fifo_size = ACP_BT_RX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_RX_RINGBUFADDR); + } + break; + case I2S_HS_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_HS_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_TX_FIFOADDR; + reg_fifo_size = ACP_HS_TX_FIFOSIZE; + phy_addr = I2S_HS_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_HS_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_RX_FIFOADDR; + reg_fifo_size = ACP_HS_RX_FIFOSIZE; + phy_addr = I2S_HS_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_RX_RINGBUFADDR); + } + break; + default: + dev_err(dev, "Invalid dai id %x\n", dai->driver->id); + return -EINVAL; + } + + writel(DMA_SIZE, adata->acp_base + reg_dma_size); + writel(acp_fifo_addr, adata->acp_base + reg_fifo_addr); + writel(FIFO_SIZE, adata->acp_base + reg_fifo_size); + + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + ext_int_ctrl |= BIT(I2S_RX_THRESHOLD(rsrc->offset)) | + BIT(BT_RX_THRESHOLD(rsrc->offset)) | + BIT(I2S_TX_THRESHOLD(rsrc->offset)) | + BIT(BT_TX_THRESHOLD(rsrc->offset)) | + BIT(HS_RX_THRESHOLD(rsrc->offset)) | + BIT(HS_TX_THRESHOLD(rsrc->offset)); + + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + return 0; +} + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, + struct acp_stream *stream) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 tdm_fmt, reg_val, fmt_reg, val; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + tdm_fmt = adata->tdm_tx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_ITER; + fmt_reg = ACP_BTTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_ITER; + fmt_reg = ACP_I2STDM_TXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + fmt_reg = ACP_HSTDM_TXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_tx_resolution[stream->dai_id - 1] << 3; + } else { + tdm_fmt = adata->tdm_rx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_IRER; + fmt_reg = ACP_BTTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_IRER; + fmt_reg = ACP_I2STDM_RXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + fmt_reg = ACP_HSTDM_RXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_rx_resolution[stream->dai_id - 1] << 3; + } + writel(val, adata->acp_base + reg_val); + if (adata->tdm_mode == TDM_ENABLE) { + writel(tdm_fmt, adata->acp_base + fmt_reg); + val = readl(adata->acp_base + reg_val); + writel(val | 0x2, adata->acp_base + reg_val); + } + return set_acp_i2s_dma_fifo(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_i2s_params, SND_SOC_ACP_COMMON); + static int acp_power_on(struct acp_chip_info *chip) { u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index bc8e1de45170..b2b78a69dc24 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "amd.h" @@ -236,7 +237,11 @@ static int rembrandt_audio_probe(struct platform_device *pdev) acp6x_master_clock_generate(dev); acp_enable_interrupts(adata); acp_platform_register(dev); - + pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); return 0; } @@ -247,13 +252,48 @@ static void rembrandt_audio_remove(struct platform_device *pdev) acp_disable_interrupts(adata); acp_platform_unregister(dev); + pm_runtime_disable(&pdev->dev); +} + +static int __maybe_unused rmb_pcm_resume(struct device *dev) +{ + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_stream *stream; + struct snd_pcm_substream *substream; + snd_pcm_uframes_t buf_in_frames; + u64 buf_size; + + acp6x_master_clock_generate(dev); + spin_lock(&adata->acp_lock); + list_for_each_entry(stream, &adata->stream_list, list) { + if (stream) { + substream = stream->substream; + if (substream && substream->runtime) { + buf_in_frames = (substream->runtime->buffer_size); + buf_size = frames_to_bytes(substream->runtime, buf_in_frames); + config_pte_for_stream(adata, stream); + config_acp_dma(adata, stream, buf_size); + if (stream->dai_id) + restore_acp_i2s_params(substream, adata, stream); + else + restore_acp_pdm_params(substream, adata); + } + } + } + spin_unlock(&adata->acp_lock); + return 0; } +static const struct dev_pm_ops rmb_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, rmb_pcm_resume) +}; + static struct platform_driver rembrandt_driver = { .probe = rembrandt_audio_probe, .remove_new = rembrandt_audio_remove, .driver = { .name = "acp_asoc_rembrandt", + .pm = &rmb_dma_pm_ops, }, }; diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 8dc663c8d98a..1d8457383e3f 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -110,6 +110,7 @@ #define ACP_TIMEOUT 500 #define DELAY_US 5 +#define ACP_SUSPEND_DELAY_MS 2000 #define PDM_DMA_STAT 0x10 #define PDM_DMA_INTR_MASK 0x10000 @@ -213,6 +214,14 @@ void acp_disable_interrupts(struct acp_dev_data *adata); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); +void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream); +void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size); +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata); + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, struct acp_stream *stream); + static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction) { u64 byte_count, low = 0, high = 0; From patchwork Thu Jun 22 15:24:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Saba Kareem, Syed" X-Patchwork-Id: 111752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp5179944vqr; Thu, 22 Jun 2023 09:09:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VSE/SG0SAeJAmSCysxZ/Q+RfVVXhlfqbCF6JcalAqghKJK25b6J6iHkaaRcalrjA9ZKPF X-Received: by 2002:a05:6a20:748d:b0:10c:89cc:bc5f with SMTP id p13-20020a056a20748d00b0010c89ccbc5fmr22834060pzd.20.1687450199301; Thu, 22 Jun 2023 09:09:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687450199; cv=pass; d=google.com; s=arc-20160816; b=r2B4pCHs+KLWOeWDsGuBneeBA6xiwrnXwnMiG7QDBDB9o7xuM10bW8n4Dpqmhlr0oA dkki3/yOgiO3XjRwAjm5CtOHKGK4T4pb5M3e0wInXN2JsCBL3qRE9tXxpzuhNYw9vqUT ebegFLeK7A2C8q3ZN/KkqbhfA/y0LPoHDnJjcHCud0K/cfDjY78mwerTHHHsLf3K78Ab /NDvw9RWqPzBoqCw96nhrgyL3TeSeHGcrFeggViMd+2fWWvM8h7g/R4KMnH2VY/BA74o knj1fCf4ys/S5W0bbR6jp5Z1vWtBUf9UPj43mjkRLo+U0xdYRbAIzurt3jABtIpXwkic gstw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=I3e+thmzUW+cJ0w94+y0OelWV6SqaBOQETMzFAcHmBqOA9irWGLf0j2BA4tLzrOXFX epUQrNcDfq2/thMwr7csDJRWRiaetNeUdzW48vKlUPWc7Yo6mnwv0M410WDTj9vMJCLU naTL6r4u+cQQeQI59AznMiH66kAMfML4wp9Zd58cRyJJVtnNjRpAPMGpLo5+7ksJY7C0 9o0mQGTGhraQOsaPX2t7QVpS5KHwvxiPkDT5BekHmmhAkIj9fbdGfJa8OwB+w23+/DPq IIlXjTbiA2Iw7lA/Wi2L/4yScnt3Vw1TmgterF2Ek08vNnHPQ0cSHayTHWXS5bo3purn 1CBg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EmXbDNR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kl16-20020a170903075000b001ab089f7329si3269953plb.73.2023.06.22.09.09.32; Thu, 22 Jun 2023 09:09:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EmXbDNR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232600AbjFVP3i (ORCPT + 99 others); Thu, 22 Jun 2023 11:29:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232592AbjFVP3O (ORCPT ); Thu, 22 Jun 2023 11:29:14 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 840602968 for ; Thu, 22 Jun 2023 08:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m37EMcW3EFkQOsFpen9UnT0J8IbjH6jCsBkiRXk8q+MDDuk8NAwtkfOktJHCx3kOfIL4bvJWdSvyfmC9gSgeksy7VkbCY0o4uGr99HVQzkgJ4tBlb7dAhRwzhZQZCSAO2LN3l5PVZdtCXJS09XL6LcBgUBddi9z/GBrzco20avIEB2RShQG4CUNDj1WG1FczS++u7N72VRuxeUO4zzfCyBUZczKuRK8qbxRbcnsWHAmQUEn5ERGXZZ7K+7KkAX+xSUWU9//1dLgBtl1vx5l3PgqNcmJYnQa2lhGursILVLwfqO0viEJc5T7HY/SpKOcvSYHGH+GeM12zkCibgOY5qw== 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=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=nDyEcEYKfiFIz2IE4FMg74HDXd4fTNkUIiTRWDVdXGMsjkE8ptC1OO+nK0PlZtRfCqLse902TD4LKTdi7DJGla2M168l8Y8tFDSWw8grt3n8e7P9peXY8p5kdReSmqOSIAV9kA0sadkhymWrTQDpYtgWO8nuKzILaV67UTaGGWDvcL19ckKIkmjHG3M09uwWsMnan3RGpwNe9YRSofVBCwXuxHEsYTz4aqs6bwsyQdDbIkLz10XWjBya5uuZ3LjWqNC/nYKvToj9OtiaZzFNzvb145QIcsrT6hpJJF41DnUPjuy5wsorrh8yiOfddwNhh219t5NE0nUwwxIz96vRNw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Rwq6fDAuv0vFz/YvtKA/oSK/5+p+hkoQrRMmsbd4jtU=; b=EmXbDNR1jdS+o9QcqKQAmvm4c2hcZsUWhHrC67W9/HaFTt5u9ikC0bNO/fCgF74rPl0iOL+5Klb6aCEBS2CXrmtqq8pZYxPBHR//SDQMSrSXukDd9vQpRwbZv3DCLpObc3fLrkBOX0Gk8rFW8M9dSkmpLEOBlMRgwtbOmVwaZHs= Received: from SN7PR04CA0226.namprd04.prod.outlook.com (2603:10b6:806:127::21) by MW4PR12MB6852.namprd12.prod.outlook.com (2603:10b6:303:20b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Thu, 22 Jun 2023 15:27:33 +0000 Received: from SA2PEPF00001505.namprd04.prod.outlook.com (2603:10b6:806:127:cafe::a8) by SN7PR04CA0226.outlook.office365.com (2603:10b6:806:127::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24 via Frontend Transport; Thu, 22 Jun 2023 15:27:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by SA2PEPF00001505.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.17 via Frontend Transport; Thu, 22 Jun 2023 15:27:33 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 22 Jun 2023 10:27:32 -0500 Received: from amd-B450M-DS3H.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Thu, 22 Jun 2023 10:27:28 -0500 From: Syed Saba Kareem To: , CC: , , , Syed Saba Kareem , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , V Sujith Kumar Reddy , Nicolas Ferre , =?utf-8?q?Uwe_Kleine-K=C3=B6ni?= =?utf-8?q?g?= , "Venkata Prasad Potturu" , Ajit Kumar Pandey , open list Subject: [PATCH 12/12] ASoC: amd: acp: add pm ops support for rembrandt platform Date: Thu, 22 Jun 2023 20:54:00 +0530 Message-ID: <20230622152406.3709231-23-Syed.SabaKareem@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> References: <20230622152406.3709231-1-Syed.SabaKareem@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00001505:EE_|MW4PR12MB6852:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fb49249-e365-410f-92e7-08db73353327 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gI/g7sQI5hi5PPjlUXiK2Ke6xHh1eZ8Xa8NLlaYOfkZLp0eLiS1fWhKEFQIkCgYYpLIStXgLx0C8g/xJrnzTMKjC3cOoSLC0RkIwQLpDvyOLHNlipyRvhQvYGOYIbbIewN0CJNA68+D4Pfr9/dcc2V+cvhXeLwuFc/se6oqAUOz1Fo35lTe1XSY424UrTap3nkaigsIAM+nlOaXkrh0PnsYKBnuvkmymxMQgADHIOovIUpPvbOCXrEAX4ZjVHEyA8Nq2X0QwHfEVrWR022Dv+YAffIEdU3zUgA181Qhic0gqDXnv6svBtWRUIu4C0SNKrx8eCaOIweaZEkFo5p5L55uPhGUxjDH8yRlOie5SdMeJ7ZdzukBmpIAaK5yeU24eM0i9rNPN1vXUIZmdMJmdihf0zaEw5sYjhYbZK6SUpkOmSJH45Gg+Qi4DLJzroy5IEa/ITbl2z0MhdgH7D9sY47H5Qz1wNPyidl5p1EJRRSpTR8nYc5W4iUBLp3BxlpJN0D8NEXSjUOSvyojvHXt7Cwguidr+Vp9hI6gL69Gf2Cyzg5jmfWZUMy+/cklKhLPyJ+bcvQFUsH0BPc6RG8A26MC29xrssmSTNuHdHaM5ScpU7+/KWHZG+mlG1z1BZz3Akkxf+aXkfCZMUavCYxqE5EgYUTiGAwqCO3xiMpQmLeZCpNeUjG2zIacqFXIkIr3MXu1T25G0XVljC3z4Y31/60gBrVr2NbarW0x+tcr/wn/MZNPX5dGlG7GNXKgF5q8Thk3HbIjXtd1S6ELHlmJPtQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(396003)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(41300700001)(8676002)(316002)(8936002)(7696005)(36860700001)(47076005)(70586007)(4326008)(70206006)(86362001)(36756003)(6666004)(54906003)(110136005)(478600001)(40460700003)(1076003)(26005)(186003)(336012)(426003)(83380400001)(2616005)(40480700001)(5660300002)(30864003)(2906002)(82740400003)(81166007)(356005)(82310400005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jun 2023 15:27:33.1124 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fb49249-e365-410f-92e7-08db73353327 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00001505.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6852 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769419047172409123?= X-GMAIL-MSGID: =?utf-8?q?1769419780107030773?= Add pm ops for rembrandt platform. Signed-off-by: Syed Saba Kareem --- sound/soc/amd/acp/acp-legacy-common.c | 208 ++++++++++++++++++++++++++ sound/soc/amd/acp/acp-rembrandt.c | 42 +++++- sound/soc/amd/acp/amd.h | 9 ++ 3 files changed, 258 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c index 45a45d002915..ba58165cc6e6 100644 --- a/sound/soc/amd/acp/acp-legacy-common.c +++ b/sound/soc/amd/acp/acp-legacy-common.c @@ -37,6 +37,214 @@ void acp_disable_interrupts(struct acp_dev_data *adata) } EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON); +static void set_acp_pdm_ring_buffer(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct acp_stream *stream = runtime->private_data; + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + + u32 physical_addr, pdm_size, period_bytes; + + period_bytes = frames_to_bytes(runtime, runtime->period_size); + pdm_size = frames_to_bytes(runtime, runtime->buffer_size); + physical_addr = stream->reg_offset + MEM_WINDOW_START; + + /* Init ACP PDM Ring buffer */ + writel(physical_addr, adata->acp_base + ACP_WOV_RX_RINGBUFADDR); + writel(pdm_size, adata->acp_base + ACP_WOV_RX_RINGBUFSIZE); + writel(period_bytes, adata->acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE); + writel(0x01, adata->acp_base + ACPAXI2AXI_ATU_CTRL); +} + +static void set_acp_pdm_clk(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + unsigned int pdm_ctrl; + + /* Enable default ACP PDM clk */ + writel(PDM_CLK_FREQ_MASK, adata->acp_base + ACP_WOV_CLK_CTRL); + pdm_ctrl = readl(adata->acp_base + ACP_WOV_MISC_CTRL); + pdm_ctrl |= PDM_MISC_CTRL_MASK; + writel(pdm_ctrl, adata->acp_base + ACP_WOV_MISC_CTRL); + set_acp_pdm_ring_buffer(substream, dai); +} + +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 ext_int_ctrl; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + /* Programming channel mask and sampling rate */ + writel(adata->ch_mask, adata->acp_base + ACP_WOV_PDM_NO_OF_CHANNELS); + writel(PDM_DEC_64, adata->acp_base + ACP_WOV_PDM_DECIMATION_FACTOR); + + /* Enabling ACP Pdm interuppts */ + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, 0)); + ext_int_ctrl |= PDM_DMA_INTR_MASK; + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, 0)); + set_acp_pdm_clk(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_pdm_params, SND_SOC_ACP_COMMON); + +static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream, + struct snd_soc_dai *dai) +{ + struct device *dev = dai->component->dev; + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_resource *rsrc = adata->rsrc; + struct acp_stream *stream = substream->runtime->private_data; + u32 reg_dma_size, reg_fifo_size, reg_fifo_addr; + u32 phy_addr, acp_fifo_addr, ext_int_ctrl; + unsigned int dir = substream->stream; + + switch (dai->driver->id) { + case I2S_SP_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_I2S_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_TX_FIFOADDR; + reg_fifo_size = ACP_I2S_TX_FIFOSIZE; + phy_addr = I2S_SP_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_I2S_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + SP_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_RX_FIFOADDR; + reg_fifo_size = ACP_I2S_RX_FIFOSIZE; + phy_addr = I2S_SP_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_I2S_RX_RINGBUFADDR); + } + break; + case I2S_BT_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_BT_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_TX_FIFOADDR; + reg_fifo_size = ACP_BT_TX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_BT_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + BT_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_BT_RX_FIFOADDR; + reg_fifo_size = ACP_BT_RX_FIFOSIZE; + phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_BT_RX_RINGBUFADDR); + } + break; + case I2S_HS_INSTANCE: + if (dir == SNDRV_PCM_STREAM_PLAYBACK) { + reg_dma_size = ACP_HS_TX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_TX_FIFOADDR; + reg_fifo_size = ACP_HS_TX_FIFOSIZE; + phy_addr = I2S_HS_TX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_TX_RINGBUFADDR); + } else { + reg_dma_size = ACP_HS_RX_DMA_SIZE; + acp_fifo_addr = rsrc->sram_pte_offset + + HS_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_RX_FIFOADDR; + reg_fifo_size = ACP_HS_RX_FIFOSIZE; + phy_addr = I2S_HS_RX_MEM_WINDOW_START + stream->reg_offset; + writel(phy_addr, adata->acp_base + ACP_HS_RX_RINGBUFADDR); + } + break; + default: + dev_err(dev, "Invalid dai id %x\n", dai->driver->id); + return -EINVAL; + } + + writel(DMA_SIZE, adata->acp_base + reg_dma_size); + writel(acp_fifo_addr, adata->acp_base + reg_fifo_addr); + writel(FIFO_SIZE, adata->acp_base + reg_fifo_size); + + ext_int_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + ext_int_ctrl |= BIT(I2S_RX_THRESHOLD(rsrc->offset)) | + BIT(BT_RX_THRESHOLD(rsrc->offset)) | + BIT(I2S_TX_THRESHOLD(rsrc->offset)) | + BIT(BT_TX_THRESHOLD(rsrc->offset)) | + BIT(HS_RX_THRESHOLD(rsrc->offset)) | + BIT(HS_TX_THRESHOLD(rsrc->offset)); + + writel(ext_int_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used)); + return 0; +} + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, + struct acp_stream *stream) +{ + struct snd_soc_dai *dai; + struct snd_soc_pcm_runtime *soc_runtime; + u32 tdm_fmt, reg_val, fmt_reg, val; + + soc_runtime = asoc_substream_to_rtd(substream); + dai = asoc_rtd_to_cpu(soc_runtime, 0); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + tdm_fmt = adata->tdm_tx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_ITER; + fmt_reg = ACP_BTTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_ITER; + fmt_reg = ACP_I2STDM_TXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + fmt_reg = ACP_HSTDM_TXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_tx_resolution[stream->dai_id - 1] << 3; + } else { + tdm_fmt = adata->tdm_rx_fmt[stream->dai_id - 1]; + switch (stream->dai_id) { + case I2S_BT_INSTANCE: + reg_val = ACP_BTTDM_IRER; + fmt_reg = ACP_BTTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + reg_val = ACP_I2STDM_IRER; + fmt_reg = ACP_I2STDM_RXFRMT; + break; + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + fmt_reg = ACP_HSTDM_RXFRMT; + break; + default: + pr_err("Invalid dai id %x\n", stream->dai_id); + return -EINVAL; + } + val = adata->xfer_rx_resolution[stream->dai_id - 1] << 3; + } + writel(val, adata->acp_base + reg_val); + if (adata->tdm_mode == TDM_ENABLE) { + writel(tdm_fmt, adata->acp_base + fmt_reg); + val = readl(adata->acp_base + reg_val); + writel(val | 0x2, adata->acp_base + reg_val); + } + return set_acp_i2s_dma_fifo(substream, dai); +} +EXPORT_SYMBOL_NS_GPL(restore_acp_i2s_params, SND_SOC_ACP_COMMON); + static int acp_power_on(struct acp_chip_info *chip) { u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg; diff --git a/sound/soc/amd/acp/acp-rembrandt.c b/sound/soc/amd/acp/acp-rembrandt.c index bc8e1de45170..b2b78a69dc24 100644 --- a/sound/soc/amd/acp/acp-rembrandt.c +++ b/sound/soc/amd/acp/acp-rembrandt.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "amd.h" @@ -236,7 +237,11 @@ static int rembrandt_audio_probe(struct platform_device *pdev) acp6x_master_clock_generate(dev); acp_enable_interrupts(adata); acp_platform_register(dev); - + pm_runtime_set_autosuspend_delay(&pdev->dev, ACP_SUSPEND_DELAY_MS); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_mark_last_busy(&pdev->dev); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); return 0; } @@ -247,13 +252,48 @@ static void rembrandt_audio_remove(struct platform_device *pdev) acp_disable_interrupts(adata); acp_platform_unregister(dev); + pm_runtime_disable(&pdev->dev); +} + +static int __maybe_unused rmb_pcm_resume(struct device *dev) +{ + struct acp_dev_data *adata = dev_get_drvdata(dev); + struct acp_stream *stream; + struct snd_pcm_substream *substream; + snd_pcm_uframes_t buf_in_frames; + u64 buf_size; + + acp6x_master_clock_generate(dev); + spin_lock(&adata->acp_lock); + list_for_each_entry(stream, &adata->stream_list, list) { + if (stream) { + substream = stream->substream; + if (substream && substream->runtime) { + buf_in_frames = (substream->runtime->buffer_size); + buf_size = frames_to_bytes(substream->runtime, buf_in_frames); + config_pte_for_stream(adata, stream); + config_acp_dma(adata, stream, buf_size); + if (stream->dai_id) + restore_acp_i2s_params(substream, adata, stream); + else + restore_acp_pdm_params(substream, adata); + } + } + } + spin_unlock(&adata->acp_lock); + return 0; } +static const struct dev_pm_ops rmb_dma_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(NULL, rmb_pcm_resume) +}; + static struct platform_driver rembrandt_driver = { .probe = rembrandt_audio_probe, .remove_new = rembrandt_audio_remove, .driver = { .name = "acp_asoc_rembrandt", + .pm = &rmb_dma_pm_ops, }, }; diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h index 8dc663c8d98a..1d8457383e3f 100644 --- a/sound/soc/amd/acp/amd.h +++ b/sound/soc/amd/acp/amd.h @@ -110,6 +110,7 @@ #define ACP_TIMEOUT 500 #define DELAY_US 5 +#define ACP_SUSPEND_DELAY_MS 2000 #define PDM_DMA_STAT 0x10 #define PDM_DMA_INTR_MASK 0x10000 @@ -213,6 +214,14 @@ void acp_disable_interrupts(struct acp_dev_data *adata); /* Machine configuration */ int snd_amd_acp_find_config(struct pci_dev *pci); +void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream); +void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size); +void restore_acp_pdm_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata); + +int restore_acp_i2s_params(struct snd_pcm_substream *substream, + struct acp_dev_data *adata, struct acp_stream *stream); + static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction) { u64 byte_count, low = 0, high = 0;