From patchwork Fri Jun 30 07:05:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mastan Katragadda X-Patchwork-Id: 698440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6FB05EB64DA for ; Fri, 30 Jun 2023 08:37:04 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2C4D585D; Fri, 30 Jun 2023 10:36:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2C4D585D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688114222; bh=GA4bJIyqNhDtFsV4v4GpK/cgBuOiGUYkczYGnaOGOgY=; h=From:To:CC:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=FGFxse4dI8fNQvBsiYKbYADCC6KvAulYj5XDbSF+7qpMqIhnKU6FHKDXJQwpk3+VM xk2Z0IFBILwLmgjhqqzWKE/IkDABWWvgCpr3a/YwCv0sScsoN9evDAUTgSVKw29Nu4 U6eGsYEm/WZluSBy/BxhLNftbFKnprgDtBiJ595s= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E17F4F80212; Fri, 30 Jun 2023 10:34:52 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 77F27F805C7; Fri, 30 Jun 2023 10:34:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5C4E9F80246; Fri, 30 Jun 2023 09:06:24 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on20608.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8b::608]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9F851F800E3; Fri, 30 Jun 2023 09:06:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F851F800E3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=MjYOBpjW ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cWxPHAWUgCQJrzeATPosgkAsea2HnM3t+T/T7WGQuOFGWU5BN6O59MU908/ygMKJpPMaYkhkk6lrTGQmFNyblxQ8EouJwJqKBmXzg/a0OzltqXiWwRDwEFcqMm5e3bPoTvVlfc3BIttoKivjERYXSzmczzpdsCGcOJAkikykp2+K39Bn2hdBUFSbIsSq8SRYXaw8TcoH80k8MiagmPxlOOcPOmn+sqtiIwLeP/7PmzyJc6XnB+m9TEQVrAcLhwFwXQkJ0+eya36ikEkvRsM9DixGsF+Mi7+K1IhVyfjUFcJeVblAnqqpqjD5+Gt+rooNw5XkCYxOFnsS6NXHCy/cWg== 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=wuFMKD7yIcNFzIGWp009gnyt/GUGBjoGMbbqB9G1aOI=; b=kHD7kGA5awsvpE2ZKJqaLkVC4Ya2Yx8uZDXqIOWeYpQxT0Z05OGk3yr2tP2+j5ud3mn5DXJa6pCekLVBekZ+kkdM9TZoAXify7Q71IOroaeo7vK2f6f611jDwpQTlkhzocBgRBzm27QUHlkQx19629LsHwC4KeTaWg1FqhYiduruUKiSqmtJQ+edeeK9N6c/a2KafOEtD/y24hn0GzEPcD+FuWHn9hGBrXtg7P/KABzYh2R4fm8G7KipR6KZ3TL31KQuOXoln/Ngl4M/gac99ebs1DQJ3CQgPtHL9v+irLtp287tCx+FBHEPHjqYwtAGl1z/f2D01bDnzxVSgfkgnw== 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=wuFMKD7yIcNFzIGWp009gnyt/GUGBjoGMbbqB9G1aOI=; b=MjYOBpjW+A/sdudUI0uc9iWboCPen1kznuRkJZ2C5J5FAvHaNHN+Wi0h6G6JetFdjdF/5gUcPJdl53rjUjW2bG7jT0axnhPPXUMVyOujQBvZ6mJXQnGtYcwX1ri29vlwRySqAb473Rrm2oXM0iDOyL+dy8j5oN/nKmiLHqid1Qs= Received: from MW4PR04CA0250.namprd04.prod.outlook.com (2603:10b6:303:88::15) by MW4PR12MB7238.namprd12.prod.outlook.com (2603:10b6:303:229::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.24; Fri, 30 Jun 2023 07:06:11 +0000 Received: from CO1NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:303:88:cafe::f3) by MW4PR04CA0250.outlook.office365.com (2603:10b6:303:88::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 07:06:11 +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 CO1NAM11FT064.mail.protection.outlook.com (10.13.175.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.49 via Frontend Transport; Fri, 30 Jun 2023 07:06:10 +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; Fri, 30 Jun 2023 02:06:10 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Fri, 30 Jun 2023 02:06:09 -0500 Received: from mastan.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 30 Jun 2023 02:05:52 -0500 From: Mastan Katragadda To: CC: , , , , , , , Mastan Katragadda , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Vijendar Mukunda , Ajit Kumar Pandey , Ajye Huang , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , "open list" Subject: [PATCH 1/2] ASoC: SOF: amd: add revision check for sending sha dma completion command Date: Fri, 30 Jun 2023 12:35:42 +0530 Message-ID: <20230630070544.2167421-1-Mastan.Katragadda@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT064:EE_|MW4PR12MB7238:EE_ X-MS-Office365-Filtering-Correlation-Id: f2beed3f-26dd-4677-65cf-08db79387c08 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: poyV4lC/z4tJ/Rz87ImdvaWDJeW8MtFRQVGLz/5mHjI172rILDRCJCUuK2cUq24LW9LIb/cSbbrBZMdmV2csmuEs9TVFJXjg1r+vVWQCsKZMHALWMJZNozlMsQ2HSAaFtY4KgbVYzX/kS4DTdxLAm2XlFKFN8RALlRsoxwTv6fCBJ6mosyYGo8n3c+3Uv7KjCihyYOp3lMmXPl8G0U5xeBQKXbDljIEGMDvsmlgOOoVQdXF9idK+8GCeIOw/0acnA67Evdmji9iVXosHtKtobetNSWm26jMCqAcnnfwj29kNaSmosIWfGAyabfugi6wFp1le2AxzXfzFMP1j9TE4jKRBmyNf7F2kxwD8yiz5XKfvsb7DrqleWjN3OuKYCGsu4geyxMPWnAB6rkZ0GvF6lbHjKr6xWSlyQf3+Uf2LmfPUyMzkoz21cEGgbC7ce4mcQ/NkuYSIKcL6TUpPYVTMCPx5tII/vvkX7XtIobPokCitD+kw0DFci35pyk1HTj//Qon0K9lhbJa7IliTZjIvQK6hgw9mGIJx0SzytGIbP2+0F4bOsVB8TIRRYEuYdxTmCzV6DroRPa83BRGfRq0SWmvsqWeRFdqjE9Dtv+CWCyfH9T4NBCwwqQHjXk8QiKIlzZGQQzSbbxDxmnRcITdAG2QoA2EwvaR6DD3CEj9lLK1XFhllqZG+K1q2Bbq7zoEa4+V4o5Fq+E6+4zyJdNiTDUAQ+FHRd9+wz20XFgfHxNBjs4dgQUvczvcxMRLVws78rs1F6+eg2CvtlIepBrvVIA== 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)(136003)(39860400002)(346002)(451199021)(46966006)(36840700001)(40470700004)(83380400001)(7696005)(6666004)(54906003)(478600001)(70586007)(1076003)(2906002)(81166007)(186003)(26005)(82310400005)(316002)(41300700001)(70206006)(7416002)(5660300002)(8676002)(356005)(6916009)(8936002)(36756003)(4326008)(86362001)(82740400003)(336012)(2616005)(40480700001)(47076005)(36860700001)(40460700003)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 07:06:10.7549 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f2beed3f-26dd-4677-65cf-08db79387c08 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: CO1NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7238 X-MailFrom: Mastan.Katragadda@amd.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: 753VAZ2DS3RIONCAFNTOPJYBYQ3N5NWM X-Message-ID-Hash: 753VAZ2DS3RIONCAFNTOPJYBYQ3N5NWM X-Mailman-Approved-At: Fri, 30 Jun 2023 08:34:48 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ACP driver should send SHA DMA completion command to PSP module for RN platform only. Add a revision check for RN platform. Signed-off-by: Mastan Katragadda --- sound/soc/sof/amd/acp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index 2ae76bcd3590..afb505461ea1 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -217,6 +217,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr, unsigned int image_length) { struct snd_sof_dev *sdev = adata->dev; + const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata); unsigned int tx_count, fw_qualifier, val; int ret; @@ -251,9 +252,12 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr, return ret; } - ret = psp_send_cmd(adata, MBOX_ACP_SHA_DMA_COMMAND); - if (ret) - return ret; + /* psp_send_cmd only required for renoir platform (rev - 3) */ + if (desc->rev == 3) { + ret = psp_send_cmd(adata, MBOX_ACP_SHA_DMA_COMMAND); + if (ret) + return ret; + } ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER, fw_qualifier, fw_qualifier & DSP_FW_RUN_ENABLE, From patchwork Fri Jun 30 07:05:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mastan Katragadda X-Patchwork-Id: 697999 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F082EB64DD for ; Fri, 30 Jun 2023 08:37:17 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2586C83E; Fri, 30 Jun 2023 10:36:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2586C83E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1688114235; bh=56dzIQ+5Aqn7S8w5LTFhS8mYasFgP2qsplsua67ecPs=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=imGWOQDDF/CQFr6VAAKuYQu1s9HKVqCxa5i5dJYzEbD3rDDp5ILJylYwZYT08+lk/ q9coFuHymta1W4dpVsYe1lj9EpcIEoADOOiXvrnY+yknDCvMPcVvptmqh+FFUEI1fl 176uoxHa1acPz9PObKeyr2fXjhh6aNjFqGbHJ+7Y= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 62AA7F805CB; Fri, 30 Jun 2023 10:34:54 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id EACA0F805CB; Fri, 30 Jun 2023 10:34:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CE9B5F80246; Fri, 30 Jun 2023 09:06:52 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20612.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5a::612]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A6665F800E3; Fri, 30 Jun 2023 09:06:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A6665F800E3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=ipWqNu6j ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LD3pKCQ/WeU+gzlmF+5kshEqWiGUqjxtcNOjGm6PjM4ofTA5tAGBHUpCv2SfxyKO8FfjPDpzPAAgbQ6euJz7fgsujLGhv5EH/uMEKNPxnei4jtVbJ3tiUYSPFQ4jVDvHquXsUjDeZzFaPkiIeAs2u1/TkRQPCusNmkpBifC7pXbQIpHb6nmBHy9pDVw/4Whqe035JJ4MHOSC0TsmdC4fQCTo7cWiO4yR/jLC9VOfvyVQ6OGRNccrpU9F90O9Lqly3QBDQRfVE4XewlG6DTkk3U7i5mZKKJVwQTMImSEHX7AUBimAoh6O/RcgTJJNmwoPzHfPXtIGm6y4G0KMTnkskA== 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=kiSTON/LT+DJq1L7PPgM6zWQ7KjeH+GUxRBrqrMWSBc=; b=iykWnc0ME487npvQEAhO7xhNpTyLRK5frNVgANr1frC14OWDVMem0tDbCaEYjHBKBrnOv308WCpXWbGl0xlybT62z+Bj6qjSXxtYd/sSMAEFfoxXbB3v9mclYqgwdAM7YcU/IwWKAjZhjCG407pCSS0dKHBjkthIjvptIMqaUuBOxJxvLsDs8ADQauE8aZ3Dww9TF5GFCnusG0M60t0Ko39+qxGorpOgk1eLXXBV2LXk+pD1GvI9Up7vpxoa4yWcVt+NI+uJ5m5uQr8VJvm58w9hLAsw9Dk4vQPqqZpJ2Xj8EakkcKl4dB5bTG6Z2ZR+zm17BaG5+AmRhVuxnTQHwA== 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=kiSTON/LT+DJq1L7PPgM6zWQ7KjeH+GUxRBrqrMWSBc=; b=ipWqNu6joHcad/OJbM9rAVeOatnNZReJxRCo5qYMG5mjmsKtmKQA/XwAKVxtPf3fJAaAEtG2D/VLVw4dqnVsPj6Vh55aTNg4RwHnN7Oh/ZcLOfUA7Lop9cVNf98YjSWHfWR0I7to7OpV7LFkIrxm+id7Zaebm+llFdNFZ+whLec= Received: from DS7PR03CA0333.namprd03.prod.outlook.com (2603:10b6:8:55::15) by CH0PR12MB5220.namprd12.prod.outlook.com (2603:10b6:610:d3::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 07:06:40 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::f8) by DS7PR03CA0333.outlook.office365.com (2603:10b6:8:55::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 07:06: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=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6521.43 via Frontend Transport; Fri, 30 Jun 2023 07:06:40 +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; Fri, 30 Jun 2023 02:06:38 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Fri, 30 Jun 2023 00:06:30 -0700 Received: from mastan.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.23 via Frontend Transport; Fri, 30 Jun 2023 02:06:11 -0500 From: Mastan Katragadda To: CC: , , , , , , , Mastan Katragadda , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Jaroslav Kysela , Takashi Iwai , V sujith kumar Reddy , Vijendar Mukunda , Ajye Huang , Ajit Kumar Pandey , Paul Olaru , "moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS" , open list Subject: [PATCH 2/2] ASoC: SOF: amd: refactor PSP smn_read Date: Fri, 30 Jun 2023 12:35:43 +0530 Message-ID: <20230630070544.2167421-2-Mastan.Katragadda@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230630070544.2167421-1-Mastan.Katragadda@amd.com> References: <20230630070544.2167421-1-Mastan.Katragadda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT053:EE_|CH0PR12MB5220:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b7a888b-5bc1-474e-fe32-08db79388dbe X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Yy7RcAj458X943fDZX5mUkOrouqo6I10snrb9uar+fY+UODQywOzaFtlspO+uIBV3+ZqGh7H1a02Hr8kIKVLEoZjs9fGlHwaUu4ZXGWr1VNIk8s96Z5rSXicrGaw0Z54JzNHevujB1XLT+6Xqn1b5F14IaXKLsTCpTpGd9QGJY3AD05Mv0St1f7unEQWaxc4W6WWylXbmafrgLkUweI5Xlc5dgo6kp1vH8qVghSP1dVutTWRn2Laqoej55gaNB+s4J78Str6lPehC+/Y8ZHR65nwddOhX1PDQE+lQtmXnvIzhcOIPqHLVmMQZBwD4yqqfPZwpdW169eEG3LfN7C5TD/yiTnGGmbqLEfGVO0xb02VuVusv7T3qxS02Zz4Hdi/MsyjqT8IPEDK6VqLMGrA2tlNvQyrckw2X2TnPMn4vPP3ag82+MUV/ztD46p5zBIplQWuxP04HqUB+yBUPLvGLQ2+Rb5RikAYtJqa7gNSOcz+uyJs1iJkwmaTE37L1Xb1r43r3fMwV8XsXOr+BnJQ3uXNd+MQO0lW0GafFIR5ILeTt36zYyQbdOHYHOyvGpJRtwIaltS4VFAcZp/QLCSxU9ONLaOpEBDkKafLpUdaAswWPydB/CPot7+c0aWpzkISAjm6JfQI/o9JzNdI7LLSb87NqON/5xkYJ71bhox+LFJT6pMcn1AGTSSbT7IunOa+GytXECCLy0BTC5bgnhp5QFT2I/C04rJwUAda9OM4DvIwvWHfIs3ui30MfS5Q/q3HRMQGazkO9nS6r1M1mwoelA== 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)(376002)(396003)(136003)(39860400002)(346002)(451199021)(46966006)(36840700001)(40470700004)(86362001)(54906003)(8936002)(8676002)(5660300002)(82310400005)(7416002)(26005)(1076003)(7696005)(478600001)(6916009)(4326008)(70206006)(70586007)(41300700001)(316002)(6666004)(186003)(2616005)(2906002)(47076005)(40460700003)(83380400001)(336012)(426003)(36860700001)(40480700001)(36756003)(82740400003)(356005)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 07:06:40.5666 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b7a888b-5bc1-474e-fe32-08db79388dbe 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: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5220 X-MailFrom: Mastan.Katragadda@amd.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1 Message-ID-Hash: PCJWRWUEJKMIDKW36ELSNFJXFXKEVOGB X-Message-ID-Hash: PCJWRWUEJKMIDKW36ELSNFJXFXKEVOGB X-Mailman-Approved-At: Fri, 30 Jun 2023 08:34:48 +0000 X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Use the read_poll_timeout marco for PSP smn_read calls. Signed-off-by: Mastan Katragadda --- sound/soc/sof/amd/acp.c | 34 +++++++++++++++------------------- sound/soc/sof/amd/acp.h | 4 ++-- 2 files changed, 17 insertions(+), 21 deletions(-) diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c index afb505461ea1..c450931ae77e 100644 --- a/sound/soc/sof/amd/acp.c +++ b/sound/soc/sof/amd/acp.c @@ -28,12 +28,14 @@ static int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data) return 0; } -static int smn_read(struct pci_dev *dev, u32 smn_addr, u32 *data) +static int smn_read(struct pci_dev *dev, u32 smn_addr) { + u32 data = 0; + pci_write_config_dword(dev, 0x60, smn_addr); - pci_read_config_dword(dev, 0x64, data); + pci_read_config_dword(dev, 0x64, &data); - return 0; + return data; } static void init_dma_descriptor(struct acp_dev_data *adata) @@ -150,15 +152,13 @@ int configure_and_run_dma(struct acp_dev_data *adata, unsigned int src_addr, static int psp_mbox_ready(struct acp_dev_data *adata, bool ack) { struct snd_sof_dev *sdev = adata->dev; - int timeout; + int ret; u32 data; - for (timeout = ACP_PSP_TIMEOUT_COUNTER; timeout > 0; timeout--) { - msleep(20); - smn_read(adata->smn_dev, MP0_C2PMSG_114_REG, &data); - if (data & MBOX_READY_MASK) - return 0; - } + ret = read_poll_timeout(smn_read, data, data & MBOX_READY_MASK, MBOX_DELAY_US, + ACP_PSP_TIMEOUT_US, false, adata->smn_dev, MP0_C2PMSG_114_REG); + if (!ret) + return 0; dev_err(sdev->dev, "PSP error status %x\n", data & MBOX_STATUS_MASK); @@ -177,23 +177,19 @@ static int psp_mbox_ready(struct acp_dev_data *adata, bool ack) static int psp_send_cmd(struct acp_dev_data *adata, int cmd) { struct snd_sof_dev *sdev = adata->dev; - int ret, timeout; + int ret; u32 data; if (!cmd) return -EINVAL; /* Get a non-zero Doorbell value from PSP */ - for (timeout = ACP_PSP_TIMEOUT_COUNTER; timeout > 0; timeout--) { - msleep(MBOX_DELAY); - smn_read(adata->smn_dev, MP0_C2PMSG_73_REG, &data); - if (data) - break; - } + ret = read_poll_timeout(smn_read, data, data, MBOX_DELAY_US, ACP_PSP_TIMEOUT_US, false, + adata->smn_dev, MP0_C2PMSG_73_REG); - if (!timeout) { + if (ret) { dev_err(sdev->dev, "Failed to get Doorbell from MBOX %x\n", MP0_C2PMSG_73_REG); - return -EINVAL; + return ret; } /* Check if PSP is ready for new command */ diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h index dc624f727aa3..c3659dbc3745 100644 --- a/sound/soc/sof/amd/acp.h +++ b/sound/soc/sof/amd/acp.h @@ -61,12 +61,12 @@ #define HOST_BRIDGE_CZN 0x1630 #define HOST_BRIDGE_RMB 0x14B5 #define ACP_SHA_STAT 0x8000 -#define ACP_PSP_TIMEOUT_COUNTER 5 +#define ACP_PSP_TIMEOUT_US 1000000 #define ACP_EXT_INTR_ERROR_STAT 0x20000000 #define MP0_C2PMSG_114_REG 0x3810AC8 #define MP0_C2PMSG_73_REG 0x3810A24 #define MBOX_ACP_SHA_DMA_COMMAND 0x70000 -#define MBOX_DELAY 1000 +#define MBOX_DELAY_US 1000 #define MBOX_READY_MASK 0x80000000 #define MBOX_STATUS_MASK 0xFFFF