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: 695305 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 EA63EEB64D8 for ; Thu, 22 Jun 2023 15:27:31 +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 92C6283B; Thu, 22 Jun 2023 17:26:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 92C6283B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687447649; bh=eltY1OWYNCjxmVW0SKgtTKFGtqDk7DrsWkH2wF9b3YM=; 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=f68C5WnlD5DpBPOrBseDrDFHXmxhcjyPtxcJk6oOqA75lsbeb5ZpyQrJX8Cg0zlUy jEYRsv/dQKrr9ApkTPNAe9T3ByJLYzf6yuVvFsB1+Lh4hZ1mYGGo9MXNIMY7ycLw8j SoSUidmqcMdKyTTi4rwewu69OWuNTVy8pCdjev64= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C9BAAF80578; Thu, 22 Jun 2023 17:25:45 +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 29AAAF80568; Thu, 22 Jun 2023 17:25:45 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9D2F3F80564; Thu, 22 Jun 2023 17:25:41 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2062d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe5b::62d]) (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 3BB0AF80568 for ; Thu, 22 Jun 2023 17:25:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3BB0AF80568 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=I/TBx9aR 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 Message-ID-Hash: 2VJG7YBPNTQSWCQDGE6VTT2N24MIBFSF X-Message-ID-Hash: 2VJG7YBPNTQSWCQDGE6VTT2N24MIBFSF X-MailFrom: Syed.SabaKareem@amd.com 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header 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: 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 */