From patchwork Mon Jul 19 16:51:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D564EC07E9B for ; Mon, 19 Jul 2021 16:35:51 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD1776120A for ; Mon, 19 Jul 2021 16:35:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD1776120A Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C1DC71663; Mon, 19 Jul 2021 18:34:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C1DC71663 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712548; bh=yggAO1eq1wRpczQJJffdivbFvxSbSMaW91txVBhFSZc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=EaVkub0UyUvwM/ZSUILt6ejbkomC051/a9vveTTNJ+Jp/To+8opay87rPOO5nMsXX e19Vu9Af0SVv76Fe8YEpqx5B6thJ9Bzyh3vaOZLv3aD5Cx/b+cMqefsm8tlTtMyJkl 0nDqzn3d9jD8V3Jk15KWdHzf2y536c8Eozs7HcPs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6DD3CF800DA; Mon, 19 Jul 2021 18:34:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 678F5F804AB; Mon, 19 Jul 2021 18:34:48 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) (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 18CBFF800DA for ; Mon, 19 Jul 2021 18:34:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 18CBFF800DA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="yN12zBBS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZvKE1Nq+ihHXcpJcorZoDykgKzLl0MduHwkL8h7+bOF4dXF/FBWPJjxJZhGbm35b1EO/Ic3dLRRsNZNPzH/0/c6nGt/ZyTWVC72tddlkAEz0lr5K9JuY97cVuBRt5jjLLvMDKi4pdNzNeo9deZWBseFuU85+QwymnY5ayaOlEoBAP+HmiQhbzhMup+dQHgyFxwUN73Uv47Qvo/m2OKsZvjr0oKq7e51OD+mUN9vHbNGtJ/8RSHCcy+vpaxoXEpUja1R9zF7lLptPsh+MSIn8ksmRgL3NqenTVEU80Fp2XEt353hSs6XZtZVvBjGz1zKt5pz+Fdc128DgdcVCRePxhA== 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-SenderADCheck; bh=SZo0hjcW8Hf641fmLAgLQ2XLjpwm64N0nxRUH7NHiyg=; b=B2aCpf5iLCqXFh/FsFJqvUK7RSsM/D3hcYjx6Gx3qs6LKT6JMenlWZ8tNSmbiX0gwQ3uqpcP5RD16DTPRX7MRjTRUMYY1tHXx1tOa3ZbH1zp7CFipJxEObAj0TKBL/xiYEu4rU+JrNJA69mHDn3m0b5phFhBl7ixDlD9cuThlffvFU6MnLhtr4ClQ1kwchMB2WCrylJe84dT7CdKA60iKSccfSu4+8bABrZxxzrEu8obCzz9YIoDufiR4Dtij6BDALxe7NNZwikRfKqjcDaUNEBjntodaGwjGqt4zXNhif4nup51cA+/vzdvDZJjTgcVSqJu5sxHk5uVeZQGxBaOpg== 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=SZo0hjcW8Hf641fmLAgLQ2XLjpwm64N0nxRUH7NHiyg=; b=yN12zBBS+E48nANOCCG0YIHxQNWnKyQV+/KzLtNM5HrfOTcfbNmnX8EnXwc95QJAmLBIpc5ptzr2jW+dmNUxBSvL48p2aSKS07iFqWiQws4EO7/plfO9kepOuS57FRx90BgojEto3RiunWa7tWSnBE+oYkEpkOPmrK4GPxRV2kg= Received: from DM5PR20CA0004.namprd20.prod.outlook.com (2603:10b6:3:93::14) by CY4PR12MB1477.namprd12.prod.outlook.com (2603:10b6:910:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 16:34:27 +0000 Received: from DM6NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:3:93:cafe::7b) by DM5PR20CA0004.outlook.office365.com (2603:10b6:3:93::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:34:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT014.mail.protection.outlook.com (10.13.173.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:34:27 +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.2242.4; Mon, 19 Jul 2021 11:34:27 -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.2242.4; Mon, 19 Jul 2021 09:34:26 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:34:23 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 01/12] ASoC: amd: add Vangogh ACP5x IP register header Date: Mon, 19 Jul 2021 22:21:29 +0530 Message-ID: <20210719165140.16143-2-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0122ec90-a7cf-4442-3590-08d94ad313b3 X-MS-TrafficTypeDiagnostic: CY4PR12MB1477: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:46; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TJk2XvE2bkJsaeqmn2eDc0cbIHY7neuzMRh4i6uwgunLPvfX1gfL2DbH9T0R6T7jH3PT5E/Deu43DvYXc9XE6oyNjGnf9P4nh/YndSpa/IBaFCZxX3g6UwTQytXDR6xi3gpQNnkcr6pCaiJiqgjx78UfX73LCh3PRrNKw2/nDy1ASHPrP9RqoCH+TvK4W7xN3rHcNVeLLDNXP3H5m/jwjFtcFbRC/4G2JXtJS+NO/Bxig6vDxQ7NptQtw6Na9zCR10lp4xtpp+MS+uJbarYKlLEAerc5JP+LJSz34kKCv70O6ai6sbuzQM0Sy9v6jrkVspKCvBe3GFvxBlVkFsfgDQO6UTaCFKuTPAxLVZcM3LfCvOGnQrK0WxQSeBvxGREhuzQYces8RJcm3kB6bdDx2bWZnGwiNSqdktPfkE7KF3QVBYc8tR2Sc+F+8jDWo/7BKlV9JOrV2VGs16t5ndfjiNG0VHgN1vBVoBQ26hUuFiS/GUafAHkLjU4Y7nlQAmKQNFrtnL+uaDNcIhXADvJZzq3gFtNlzuXtHwjAj2t57hDgcHvvwxsfxQxFrAt2cM2jNM+fghR7nInFfNUpQ25LgTIO14tV7Efd5loP2XFT8/2QHRQP7VH0tLgPsSPkG0luE/RxAe3PNGx3dKjFXdnq1BHVtiXyJjrkZCeQlHxfWZS9HoF2qj7UsMtBzVrEGTYZd17c87ACIzda4DHPLZYT2actpWKnDhiBAYRLTk8XeWJDzEiWuUowKJ57erey3uaf 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:(4636009)(136003)(346002)(396003)(376002)(39860400002)(36840700001)(46966006)(2616005)(426003)(44832011)(81166007)(26005)(336012)(7696005)(356005)(70586007)(4326008)(82310400003)(36756003)(316002)(110136005)(30864003)(54906003)(70206006)(2906002)(83380400001)(8936002)(47076005)(36860700001)(5660300002)(82740400003)(86362001)(1076003)(478600001)(186003)(8676002)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:34:27.7603 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0122ec90-a7cf-4442-3590-08d94ad313b3 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: DM6NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1477 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Vijendar Mukunda Add register header for ACP5x IP in Vangogh platform. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/vg_chip_offset_byte.h | 337 ++++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 sound/soc/amd/vangogh/vg_chip_offset_byte.h diff --git a/sound/soc/amd/vangogh/vg_chip_offset_byte.h b/sound/soc/amd/vangogh/vg_chip_offset_byte.h new file mode 100644 index 000000000000..b1165ae142b7 --- /dev/null +++ b/sound/soc/amd/vangogh/vg_chip_offset_byte.h @@ -0,0 +1,337 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * AMD ACP 5.x Register Documentation + * + * Copyright 2021 Advanced Micro Devices, Inc. + */ + +#ifndef _acp_ip_OFFSET_HEADER +#define _acp_ip_OFFSET_HEADER + +/* Registers from ACP_DMA block */ +#define ACP_DMA_CNTL_0 0x1240000 +#define ACP_DMA_CNTL_1 0x1240004 +#define ACP_DMA_CNTL_2 0x1240008 +#define ACP_DMA_CNTL_3 0x124000C +#define ACP_DMA_CNTL_4 0x1240010 +#define ACP_DMA_CNTL_5 0x1240014 +#define ACP_DMA_CNTL_6 0x1240018 +#define ACP_DMA_CNTL_7 0x124001C +#define ACP_DMA_DSCR_STRT_IDX_0 0x1240020 +#define ACP_DMA_DSCR_STRT_IDX_1 0x1240024 +#define ACP_DMA_DSCR_STRT_IDX_2 0x1240028 +#define ACP_DMA_DSCR_STRT_IDX_3 0x124002C +#define ACP_DMA_DSCR_STRT_IDX_4 0x1240030 +#define ACP_DMA_DSCR_STRT_IDX_5 0x1240034 +#define ACP_DMA_DSCR_STRT_IDX_6 0x1240038 +#define ACP_DMA_DSCR_STRT_IDX_7 0x124003C +#define ACP_DMA_DSCR_CNT_0 0x1240040 +#define ACP_DMA_DSCR_CNT_1 0x1240044 +#define ACP_DMA_DSCR_CNT_2 0x1240048 +#define ACP_DMA_DSCR_CNT_3 0x124004C +#define ACP_DMA_DSCR_CNT_4 0x1240050 +#define ACP_DMA_DSCR_CNT_5 0x1240054 +#define ACP_DMA_DSCR_CNT_6 0x1240058 +#define ACP_DMA_DSCR_CNT_7 0x124005C +#define ACP_DMA_PRIO_0 0x1240060 +#define ACP_DMA_PRIO_1 0x1240064 +#define ACP_DMA_PRIO_2 0x1240068 +#define ACP_DMA_PRIO_3 0x124006C +#define ACP_DMA_PRIO_4 0x1240070 +#define ACP_DMA_PRIO_5 0x1240074 +#define ACP_DMA_PRIO_6 0x1240078 +#define ACP_DMA_PRIO_7 0x124007C +#define ACP_DMA_CUR_DSCR_0 0x1240080 +#define ACP_DMA_CUR_DSCR_1 0x1240084 +#define ACP_DMA_CUR_DSCR_2 0x1240088 +#define ACP_DMA_CUR_DSCR_3 0x124008C +#define ACP_DMA_CUR_DSCR_4 0x1240090 +#define ACP_DMA_CUR_DSCR_5 0x1240094 +#define ACP_DMA_CUR_DSCR_6 0x1240098 +#define ACP_DMA_CUR_DSCR_7 0x124009C +#define ACP_DMA_CUR_TRANS_CNT_0 0x12400A0 +#define ACP_DMA_CUR_TRANS_CNT_1 0x12400A4 +#define ACP_DMA_CUR_TRANS_CNT_2 0x12400A8 +#define ACP_DMA_CUR_TRANS_CNT_3 0x12400AC +#define ACP_DMA_CUR_TRANS_CNT_4 0x12400B0 +#define ACP_DMA_CUR_TRANS_CNT_5 0x12400B4 +#define ACP_DMA_CUR_TRANS_CNT_6 0x12400B8 +#define ACP_DMA_CUR_TRANS_CNT_7 0x12400BC +#define ACP_DMA_ERR_STS_0 0x12400C0 +#define ACP_DMA_ERR_STS_1 0x12400C4 +#define ACP_DMA_ERR_STS_2 0x12400C8 +#define ACP_DMA_ERR_STS_3 0x12400CC +#define ACP_DMA_ERR_STS_4 0x12400D0 +#define ACP_DMA_ERR_STS_5 0x12400D4 +#define ACP_DMA_ERR_STS_6 0x12400D8 +#define ACP_DMA_ERR_STS_7 0x12400DC +#define ACP_DMA_DESC_BASE_ADDR 0x12400E0 +#define ACP_DMA_DESC_MAX_NUM_DSCR 0x12400E4 +#define ACP_DMA_CH_STS 0x12400E8 +#define ACP_DMA_CH_GROUP 0x12400EC +#define ACP_DMA_CH_RST_STS 0x12400F0 + +/* Registers from ACP_AXI2AXIATU block */ +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1 0x1240C00 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_1 0x1240C04 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_2 0x1240C08 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_2 0x1240C0C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_3 0x1240C10 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_3 0x1240C14 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_4 0x1240C18 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_4 0x1240C1C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_5 0x1240C20 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_5 0x1240C24 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_6 0x1240C28 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_6 0x1240C2C +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_7 0x1240C30 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_7 0x1240C34 +#define ACPAXI2AXI_ATU_PAGE_SIZE_GRP_8 0x1240C38 +#define ACPAXI2AXI_ATU_BASE_ADDR_GRP_8 0x1240C3C +#define ACPAXI2AXI_ATU_CTRL 0x1240C40 + +/* Registers from ACP_CLKRST block */ +#define ACP_SOFT_RESET 0x1241000 +#define ACP_CONTROL 0x1241004 +#define ACP_STATUS 0x1241008 +#define ACP_DYNAMIC_CG_MASTER_CONTROL 0x1241010 + +/* Registers from ACP_MISC block */ +#define ACP_EXTERNAL_INTR_ENB 0x1241800 +#define ACP_EXTERNAL_INTR_CNTL 0x1241804 +#define ACP_EXTERNAL_INTR_STAT 0x1241808 +#define ACP_ERROR_STATUS 0x12418C4 +#define ACP_SW_I2S_ERROR_REASON 0x12418C8 +#define ACP_MEM_PG_STS 0x12418CC +#define ACP_PGMEM_DEEP_SLEEP_CTRL 0x12418D0 +#define ACP_PGMEM_SHUT_DOWN_CTRL 0x12418D4 + +/* Registers from ACP_PGFSM block */ +#define ACP_PIN_CONFIG 0x1241400 +#define ACP_PAD_PULLUP_CTRL 0x1241404 +#define ACP_PAD_PULLDOWN_CTRL 0x1241408 +#define ACP_PAD_DRIVE_STRENGTH_CTRL 0x124140C +#define ACP_PAD_SCHMEN_CTRL 0x1241410 +#define ACP_SW_PAD_KEEPER_EN 0x1241414 +#define ACP_SW_WAKE_EN 0x1241418 +#define ACP_I2S_WAKE_EN 0x124141C +#define ACP_PME_EN 0x1241420 +#define ACP_PGFSM_CONTROL 0x1241424 +#define ACP_PGFSM_STATUS 0x1241428 +#define ACP_CLKMUX_SEL 0x124142C +#define ACP_DEVICE_STATE 0x1241430 +#define AZ_DEVICE_STATE 0x1241434 +#define ACP_INTR_URGENCY_TIMER 0x1241438 +#define AZ_INTR_URGENCY_TIMER 0x124143C +#define ACP_AON_SW_INTR_TRIG 0x1241440 + +/* Registers from ACP_SCRATCH block */ +#define ACP_SCRATCH_REG_0 0x1250000 +#define ACP_SCRATCH_REG_1 0x1250004 +#define ACP_SCRATCH_REG_2 0x1250008 +#define ACP_SCRATCH_REG_3 0x125000C +#define ACP_SCRATCH_REG_4 0x1250010 +#define ACP_SCRATCH_REG_5 0x1250014 +#define ACP_SCRATCH_REG_6 0x1250018 +#define ACP_SCRATCH_REG_7 0x125001C +#define ACP_SCRATCH_REG_8 0x1250020 +#define ACP_SCRATCH_REG_9 0x1250024 +#define ACP_SCRATCH_REG_10 0x1250028 +#define ACP_SCRATCH_REG_11 0x125002C +#define ACP_SCRATCH_REG_12 0x1250030 +#define ACP_SCRATCH_REG_13 0x1250034 +#define ACP_SCRATCH_REG_14 0x1250038 +#define ACP_SCRATCH_REG_15 0x125003C +#define ACP_SCRATCH_REG_16 0x1250040 +#define ACP_SCRATCH_REG_17 0x1250044 +#define ACP_SCRATCH_REG_18 0x1250048 +#define ACP_SCRATCH_REG_19 0x125004C +#define ACP_SCRATCH_REG_20 0x1250050 +#define ACP_SCRATCH_REG_21 0x1250054 +#define ACP_SCRATCH_REG_22 0x1250058 +#define ACP_SCRATCH_REG_23 0x125005C +#define ACP_SCRATCH_REG_24 0x1250060 +#define ACP_SCRATCH_REG_25 0x1250064 +#define ACP_SCRATCH_REG_26 0x1250068 +#define ACP_SCRATCH_REG_27 0x125006C +#define ACP_SCRATCH_REG_28 0x1250070 +#define ACP_SCRATCH_REG_29 0x1250074 +#define ACP_SCRATCH_REG_30 0x1250078 +#define ACP_SCRATCH_REG_31 0x125007C +#define ACP_SCRATCH_REG_32 0x1250080 +#define ACP_SCRATCH_REG_33 0x1250084 +#define ACP_SCRATCH_REG_34 0x1250088 +#define ACP_SCRATCH_REG_35 0x125008C +#define ACP_SCRATCH_REG_36 0x1250090 +#define ACP_SCRATCH_REG_37 0x1250094 +#define ACP_SCRATCH_REG_38 0x1250098 +#define ACP_SCRATCH_REG_39 0x125009C +#define ACP_SCRATCH_REG_40 0x12500A0 +#define ACP_SCRATCH_REG_41 0x12500A4 +#define ACP_SCRATCH_REG_42 0x12500A8 +#define ACP_SCRATCH_REG_43 0x12500AC +#define ACP_SCRATCH_REG_44 0x12500B0 +#define ACP_SCRATCH_REG_45 0x12500B4 +#define ACP_SCRATCH_REG_46 0x12500B8 +#define ACP_SCRATCH_REG_47 0x12500BC +#define ACP_SCRATCH_REG_48 0x12500C0 +#define ACP_SCRATCH_REG_49 0x12500C4 +#define ACP_SCRATCH_REG_50 0x12500C8 +#define ACP_SCRATCH_REG_51 0x12500CC +#define ACP_SCRATCH_REG_52 0x12500D0 +#define ACP_SCRATCH_REG_53 0x12500D4 +#define ACP_SCRATCH_REG_54 0x12500D8 +#define ACP_SCRATCH_REG_55 0x12500DC +#define ACP_SCRATCH_REG_56 0x12500E0 +#define ACP_SCRATCH_REG_57 0x12500E4 +#define ACP_SCRATCH_REG_58 0x12500E8 +#define ACP_SCRATCH_REG_59 0x12500EC +#define ACP_SCRATCH_REG_60 0x12500F0 +#define ACP_SCRATCH_REG_61 0x12500F4 +#define ACP_SCRATCH_REG_62 0x12500F8 +#define ACP_SCRATCH_REG_63 0x12500FC +#define ACP_SCRATCH_REG_64 0x1250100 +#define ACP_SCRATCH_REG_65 0x1250104 +#define ACP_SCRATCH_REG_66 0x1250108 +#define ACP_SCRATCH_REG_67 0x125010C +#define ACP_SCRATCH_REG_68 0x1250110 +#define ACP_SCRATCH_REG_69 0x1250114 +#define ACP_SCRATCH_REG_70 0x1250118 +#define ACP_SCRATCH_REG_71 0x125011C +#define ACP_SCRATCH_REG_72 0x1250120 +#define ACP_SCRATCH_REG_73 0x1250124 +#define ACP_SCRATCH_REG_74 0x1250128 +#define ACP_SCRATCH_REG_75 0x125012C +#define ACP_SCRATCH_REG_76 0x1250130 +#define ACP_SCRATCH_REG_77 0x1250134 +#define ACP_SCRATCH_REG_78 0x1250138 +#define ACP_SCRATCH_REG_79 0x125013C +#define ACP_SCRATCH_REG_80 0x1250140 +#define ACP_SCRATCH_REG_81 0x1250144 +#define ACP_SCRATCH_REG_82 0x1250148 +#define ACP_SCRATCH_REG_83 0x125014C +#define ACP_SCRATCH_REG_84 0x1250150 +#define ACP_SCRATCH_REG_85 0x1250154 +#define ACP_SCRATCH_REG_86 0x1250158 +#define ACP_SCRATCH_REG_87 0x125015C +#define ACP_SCRATCH_REG_88 0x1250160 +#define ACP_SCRATCH_REG_89 0x1250164 +#define ACP_SCRATCH_REG_90 0x1250168 +#define ACP_SCRATCH_REG_91 0x125016C +#define ACP_SCRATCH_REG_92 0x1250170 +#define ACP_SCRATCH_REG_93 0x1250174 +#define ACP_SCRATCH_REG_94 0x1250178 +#define ACP_SCRATCH_REG_95 0x125017C +#define ACP_SCRATCH_REG_96 0x1250180 +#define ACP_SCRATCH_REG_97 0x1250184 +#define ACP_SCRATCH_REG_98 0x1250188 +#define ACP_SCRATCH_REG_99 0x125018C +#define ACP_SCRATCH_REG_100 0x1250190 +#define ACP_SCRATCH_REG_101 0x1250194 +#define ACP_SCRATCH_REG_102 0x1250198 +#define ACP_SCRATCH_REG_103 0x125019C +#define ACP_SCRATCH_REG_104 0x12501A0 +#define ACP_SCRATCH_REG_105 0x12501A4 +#define ACP_SCRATCH_REG_106 0x12501A8 +#define ACP_SCRATCH_REG_107 0x12501AC +#define ACP_SCRATCH_REG_108 0x12501B0 +#define ACP_SCRATCH_REG_109 0x12501B4 +#define ACP_SCRATCH_REG_110 0x12501B8 +#define ACP_SCRATCH_REG_111 0x12501BC +#define ACP_SCRATCH_REG_112 0x12501C0 +#define ACP_SCRATCH_REG_113 0x12501C4 +#define ACP_SCRATCH_REG_114 0x12501C8 +#define ACP_SCRATCH_REG_115 0x12501CC +#define ACP_SCRATCH_REG_116 0x12501D0 +#define ACP_SCRATCH_REG_117 0x12501D4 +#define ACP_SCRATCH_REG_118 0x12501D8 +#define ACP_SCRATCH_REG_119 0x12501DC +#define ACP_SCRATCH_REG_120 0x12501E0 +#define ACP_SCRATCH_REG_121 0x12501E4 +#define ACP_SCRATCH_REG_122 0x12501E8 +#define ACP_SCRATCH_REG_123 0x12501EC +#define ACP_SCRATCH_REG_124 0x12501F0 +#define ACP_SCRATCH_REG_125 0x12501F4 +#define ACP_SCRATCH_REG_126 0x12501F8 +#define ACP_SCRATCH_REG_127 0x12501FC +#define ACP_SCRATCH_REG_128 0x1250200 + +/* Registers from ACP_AUDIO_BUFFERS block */ +#define ACP_I2S_RX_RINGBUFADDR 0x1242000 +#define ACP_I2S_RX_RINGBUFSIZE 0x1242004 +#define ACP_I2S_RX_LINKPOSITIONCNTR 0x1242008 +#define ACP_I2S_RX_FIFOADDR 0x124200C +#define ACP_I2S_RX_FIFOSIZE 0x1242010 +#define ACP_I2S_RX_DMA_SIZE 0x1242014 +#define ACP_I2S_RX_LINEARPOSCNTR_HIGH 0x1242018 +#define ACP_I2S_RX_LINEARPOSCNTR_LOW 0x124201C +#define ACP_I2S_RX_INTR_WATERMARK_SIZE 0x1242020 +#define ACP_I2S_TX_RINGBUFADDR 0x1242024 +#define ACP_I2S_TX_RINGBUFSIZE 0x1242028 +#define ACP_I2S_TX_LINKPOSITIONCNTR 0x124202C +#define ACP_I2S_TX_FIFOADDR 0x1242030 +#define ACP_I2S_TX_FIFOSIZE 0x1242034 +#define ACP_I2S_TX_DMA_SIZE 0x1242038 +#define ACP_I2S_TX_LINEARPOSCNTR_HIGH 0x124203C +#define ACP_I2S_TX_LINEARPOSCNTR_LOW 0x1242040 +#define ACP_I2S_TX_INTR_WATERMARK_SIZE 0x1242044 +#define ACP_BT_RX_RINGBUFADDR 0x1242048 +#define ACP_BT_RX_RINGBUFSIZE 0x124204C +#define ACP_BT_RX_LINKPOSITIONCNTR 0x1242050 +#define ACP_BT_RX_FIFOADDR 0x1242054 +#define ACP_BT_RX_FIFOSIZE 0x1242058 +#define ACP_BT_RX_DMA_SIZE 0x124205C +#define ACP_BT_RX_LINEARPOSCNTR_HIGH 0x1242060 +#define ACP_BT_RX_LINEARPOSCNTR_LOW 0x1242064 +#define ACP_BT_RX_INTR_WATERMARK_SIZE 0x1242068 +#define ACP_BT_TX_RINGBUFADDR 0x124206C +#define ACP_BT_TX_RINGBUFSIZE 0x1242070 +#define ACP_BT_TX_LINKPOSITIONCNTR 0x1242074 +#define ACP_BT_TX_FIFOADDR 0x1242078 +#define ACP_BT_TX_FIFOSIZE 0x124207C +#define ACP_BT_TX_DMA_SIZE 0x1242080 +#define ACP_BT_TX_LINEARPOSCNTR_HIGH 0x1242084 +#define ACP_BT_TX_LINEARPOSCNTR_LOW 0x1242088 +#define ACP_BT_TX_INTR_WATERMARK_SIZE 0x124208C +#define ACP_HS_RX_RINGBUFADDR 0x1242090 +#define ACP_HS_RX_RINGBUFSIZE 0x1242094 +#define ACP_HS_RX_LINKPOSITIONCNTR 0x1242098 +#define ACP_HS_RX_FIFOADDR 0x124209C +#define ACP_HS_RX_FIFOSIZE 0x12420A0 +#define ACP_HS_RX_DMA_SIZE 0x12420A4 +#define ACP_HS_RX_LINEARPOSCNTR_HIGH 0x12420A8 +#define ACP_HS_RX_LINEARPOSCNTR_LOW 0x12420AC +#define ACP_HS_RX_INTR_WATERMARK_SIZE 0x12420B0 +#define ACP_HS_TX_RINGBUFADDR 0x12420B4 +#define ACP_HS_TX_RINGBUFSIZE 0x12420B8 +#define ACP_HS_TX_LINKPOSITIONCNTR 0x12420BC +#define ACP_HS_TX_FIFOADDR 0x12420C0 +#define ACP_HS_TX_FIFOSIZE 0x12420C4 +#define ACP_HS_TX_DMA_SIZE 0x12420C8 +#define ACP_HS_TX_LINEARPOSCNTR_HIGH 0x12420CC +#define ACP_HS_TX_LINEARPOSCNTR_LOW 0x12420D0 +#define ACP_HS_TX_INTR_WATERMARK_SIZE 0x12420D4 + +/* Registers from ACP_I2S_TDM block */ +#define ACP_I2STDM_IER 0x1242400 +#define ACP_I2STDM_IRER 0x1242404 +#define ACP_I2STDM_RXFRMT 0x1242408 +#define ACP_I2STDM_ITER 0x124240C +#define ACP_I2STDM_TXFRMT 0x1242410 +#define ACP_I2STDM0_MSTRCLKGEN 0x1242414 +#define ACP_I2STDM1_MSTRCLKGEN 0x1242418 +#define ACP_I2STDM2_MSTRCLKGEN 0x124241C +#define ACP_I2STDM_REFCLKGEN 0x1242420 + +/* Registers from ACP_BT_TDM block */ +#define ACP_BTTDM_IER 0x1242800 +#define ACP_BTTDM_IRER 0x1242804 +#define ACP_BTTDM_RXFRMT 0x1242808 +#define ACP_BTTDM_ITER 0x124280C +#define ACP_BTTDM_TXFRMT 0x1242810 +#define ACP_HSTDM_IER 0x1242814 +#define ACP_HSTDM_IRER 0x1242818 +#define ACP_HSTDM_RXFRMT 0x124281C +#define ACP_HSTDM_ITER 0x1242820 +#define ACP_HSTDM_TXFRMT 0x1242824 +#endif From patchwork Mon Jul 19 16:51:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 470E1C07E95 for ; Mon, 19 Jul 2021 16:36:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6690B61351 for ; Mon, 19 Jul 2021 16:36:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6690B61351 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 002141660; Mon, 19 Jul 2021 18:35:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 002141660 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712563; bh=RapNfJCmf8ZlQXu7KM5CxzYXsOxpq0zfTsnF4qGFrBw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ejNgAkXgStqT1DDp+PnaILQqN8VzPz77IF/4MWpITh6rc92zesXobUX+0RYlL5ITQ oRPHJqYWL7A7p/RwLM7fKEX0WYrkfkktbKmOktV4ez19udEo0xlmXs2g4LfmR/toCY e5zGfLrm3qgfTBlOj+adgt54yW3Y7He6oTMdobqI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F51FF804E3; Mon, 19 Jul 2021 18:34:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDCDEF804E4; Mon, 19 Jul 2021 18:34:53 +0200 (CEST) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) (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 71A5EF804E2 for ; Mon, 19 Jul 2021 18:34:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 71A5EF804E2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="oW3syCb+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nASOM9jzo/4g3osfpKRHwkGoc+QJgUj7WQ825+tR9SrL8yHqr/CD9/UhCwc5z2xaLyaGSqG1nXtwflSofiJYxE+JDcC5uXDbpppJ6qBDD5RR37FjNM6toHI3M0A0oWz4yKxyxbZ3nLUKWpibrovhyiZL6RDy5Cb3DLeQoWQ1cIoIv5YwdbJZF0DBwrsC+rzE650Nm3L8A3qVygMIPbs9c+bj1Hz752vbCvd+OpqzBWyXFz34h1F9nyocmcHulP8Q4y5abVM4IHsnPWDI1UfF9+Z7i9VZD6timO0H2CRpvYs1wzFHZbomVbk4a9OPwLyg8+L6HnpdQg2P65u1Q8+SFQ== 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-SenderADCheck; bh=F/mRnln9nL4+VO/WHQSHKDyZI44RU76z0zND9SQL7gE=; b=UNrCjVUZkFD9XCzqn3V2qzRtb6jLy0ZfyigZIfvBHYar0UEzSsWC9GYHjnaPbeXKXQD6gxGqQeCStVpvynSU6eeQI9oy+LaRK43+t2xEM9bSs14OoBmtcXu12pzBbjoW9Xz31bKt4MyPjuF8XZ/0j9BLuaJVQ1OMiKZq6pp3Hjw7Td6JcLeGO6mOlmqr9zW04AHojpI3m7lIp4GUNxep+bPViVBYLNhjIwn407tiXlNf0YcwQIxPVJSRWo1jgZ04R4SSyPM4OQuCOqQYfdpMvV4MVsr1L4ZIB1Gqoj1a6UbWpK4UX/vtUI2xsABCxBR9U7r1IEwJWbtbPrtjK+xnnQ== 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=F/mRnln9nL4+VO/WHQSHKDyZI44RU76z0zND9SQL7gE=; b=oW3syCb+tXooN7Wn7IGytD1niM6NaypNFAE9WnIDYqN6srUbffGZVZwSPIT+URWwLstfoCIIcim2hN0IT+RGZw72yNmOpWsIcaRBOo1O9xnC7V2MMLo18VsqNttHiT4sELa7L93P4Dc90o34fHrfT/bpVinmq0n7g/fR4NmllI4= Received: from DM5PR20CA0030.namprd20.prod.outlook.com (2603:10b6:3:13d::16) by SA0PR12MB4367.namprd12.prod.outlook.com (2603:10b6:806:94::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 16:34:46 +0000 Received: from DM6NAM11FT058.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13d:cafe::89) by DM5PR20CA0030.outlook.office365.com (2603:10b6:3:13d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:34:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT058.mail.protection.outlook.com (10.13.172.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:34:45 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2242.4; Mon, 19 Jul 2021 11:34:44 -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.2242.4; Mon, 19 Jul 2021 09:34:44 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:34:35 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 02/12] ASoC: amd: add Vangogh ACP PCI driver Date: Mon, 19 Jul 2021 22:21:30 +0530 Message-ID: <20210719165140.16143-3-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ee59e9e-1737-4613-6106-08d94ad31e7e X-MS-TrafficTypeDiagnostic: SA0PR12MB4367: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3044; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e6kO9kHkPAvNp2qEMGgvqQE3FOBQeWh8CeN2vVu09cvwJFziLcxH442QK3C4knm7usJ4dO/s4DuaPTWM49oOTTr2jL7ozb5xNGnLEbi7uKDr2KC1PPy6vukTquqKnld+0DVBy+o644VxkV2IH9CuyNyVE3oe3nAYQ55Af0vdtKZPn4GYip05xd3nV0Unwqb0kQIejFstfg/yQV+KtFSJnkocZUwAvtMa8k3ZOEKxBsCIeE4vjFwxdUtbIs7p5YZIbgfGMqP8XAp6oy3HX6X+bi8TrWlFf1a8QEJN/sak78QOVV83OkFyB2obsBMCZ8iSLKuO37Bi3ayD9DK7RPlFfcj6cLBQ2ad2GA9dJqOPQ0wQ7wrkliwd+P7VnVDx8vem8a+n2GKi0r03ERAuZ3HvOwgnV1bxO7anW3FNvzJ1l52WRjGI7AaTTw/WowGvTDkom3944CsYTCPi8XWdGlEI12YiIBagH2j80mAe5vxpjO1/jbHxMxOVkmhsqov0lE2YabGqBNvhB/I6ncam+7S04IbAmAbasr6PTk77r0NO9tHBB42UlK/EqtODxkpQmcs6PuW5IDUG+dntbrOjJEFgf/Ev9UEQmm+QnpxyYWKpHxUrU30eFHGrenvQKZFVzG+HtPBEc4Kf240FNKWJO4jGQ1HR8MN9y0QHPE7W5R9TAM1rIH8wTGrYbyDQewoUVHUzStTBysmbo+fnbsRzO89rkUTlqIYHQrQFHC/KghgPAHM= 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:(4636009)(39860400002)(376002)(136003)(396003)(346002)(46966006)(36840700001)(8676002)(478600001)(336012)(426003)(7696005)(2616005)(44832011)(36756003)(81166007)(356005)(47076005)(54906003)(316002)(70206006)(70586007)(26005)(186003)(2906002)(82310400003)(86362001)(82740400003)(110136005)(83380400001)(4326008)(6666004)(8936002)(5660300002)(1076003)(36860700001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:34:45.7620 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ee59e9e-1737-4613-6106-08d94ad31e7e 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: DM6NAM11FT058.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4367 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Vijendar Mukunda ACP is a PCI audio device. This patch adds PCI driver to bind to this device and get PCI resources. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 25 +++++++++ sound/soc/amd/vangogh/pci-acp5x.c | 87 +++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x.h create mode 100644 sound/soc/amd/vangogh/pci-acp5x.c diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h new file mode 100644 index 000000000000..8afa8144af4e --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * AMD ALSA SoC PCM Driver + * + * Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + */ + +#include "vg_chip_offset_byte.h" + +#define ACP5x_PHY_BASE_ADDRESS 0x1240000 +#define ACP_DEVICE_ID 0x15E2 + +/* common header file uses exact offset rather than relative + * offset which requires substraction logic from base_addr + * for accessing ACP5x MMIO space registers + */ +static inline u32 acp_readl(void __iomem *base_addr) +{ + return readl(base_addr - ACP5x_PHY_BASE_ADDRESS); +} + +static inline void acp_writel(u32 val, void __iomem *base_addr) +{ + writel(val, base_addr - ACP5x_PHY_BASE_ADDRESS); +} diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c new file mode 100644 index 000000000000..e56d060a5cb9 --- /dev/null +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD Vangogh ACP PCI Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include + +#include "acp5x.h" + +struct acp5x_dev_data { + void __iomem *acp5x_base; +}; + +static int snd_acp5x_probe(struct pci_dev *pci, + const struct pci_device_id *pci_id) +{ + struct acp5x_dev_data *adata; + int ret; + u32 addr; + + if (pci->revision != 0x50) + return -ENODEV; + + if (pci_enable_device(pci)) { + dev_err(&pci->dev, "pci_enable_device failed\n"); + return -ENODEV; + } + + ret = pci_request_regions(pci, "AMD ACP5x audio"); + if (ret < 0) { + dev_err(&pci->dev, "pci_request_regions failed\n"); + goto disable_pci; + } + + adata = devm_kzalloc(&pci->dev, sizeof(struct acp5x_dev_data), + GFP_KERNEL); + if (!adata) { + ret = -ENOMEM; + goto release_regions; + } + addr = pci_resource_start(pci, 0); + adata->acp5x_base = devm_ioremap(&pci->dev, addr, + pci_resource_len(pci, 0)); + if (!adata->acp5x_base) { + ret = -ENOMEM; + goto release_regions; + } + pci_set_master(pci); + pci_set_drvdata(pci, adata); + +release_regions: + pci_release_regions(pci); +disable_pci: + pci_disable_device(pci); + + return ret; +} + +static void snd_acp5x_remove(struct pci_dev *pci) +{ + pci_release_regions(pci); + pci_disable_device(pci); +} + +static const struct pci_device_id snd_acp5x_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_AMD, ACP_DEVICE_ID), + .class = PCI_CLASS_MULTIMEDIA_OTHER << 8, + .class_mask = 0xffffff }, + { 0, }, +}; +MODULE_DEVICE_TABLE(pci, snd_acp5x_ids); + +static struct pci_driver acp5x_driver = { + .name = KBUILD_MODNAME, + .id_table = snd_acp5x_ids, + .probe = snd_acp5x_probe, + .remove = snd_acp5x_remove, +}; + +module_pci_driver(acp5x_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD Vangogh ACP PCI driver"); +MODULE_LICENSE("GPL v2"); From patchwork Mon Jul 19 16:51:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E2E3C07E9B for ; Mon, 19 Jul 2021 16:36:35 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C62B61363 for ; Mon, 19 Jul 2021 16:36:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8C62B61363 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AE1611681; Mon, 19 Jul 2021 18:35:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AE1611681 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712591; bh=/dd6Z3iy3jZpdbqE0fhIkk9rPhylYq455zDOOAOM2AU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=GVKOkn+0gNr9vylSAZEF2ex4lpiqm0u8VI7Bf2duoIUR4dxtKpc1iXqljOwMGovUI QQA03oUJbtBD28E2D6ug5rGwHw0UsSIGHlEFDWPyXNqYPT+4YgzOjyQRmPSrnDPlMI sE043Bt/1t9ZbjcixNJ7R6VZ4TqrpkGP17S3Qk/Q= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BFD8BF800C5; Mon, 19 Jul 2021 18:35:19 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 40592F804CB; Mon, 19 Jul 2021 18:35:18 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2065.outbound.protection.outlook.com [40.107.236.65]) (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 D50AEF80218 for ; Mon, 19 Jul 2021 18:35:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D50AEF80218 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VRw5yKrR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IkaHU4BR2irPpZ9Y72RjrCbdc65i8MB2oRK2hUGKmzdWxYoap2JewvK7Osn3MsM68B1xHkSiyYvubn0Lq9rlE9Wzd0+AjPrjcgtr0BqXpwRPhS0yxTIHlqXX9WinTJysKMkgs69/CPPftuefRRHJJUY+Rtxh68FGa9TOozh9j1d3VWnv9oc40k8T24yNFptGcvz9XDCXYYxa1tcbCkj8prfx8kOixtdFM++II80bJINNRUN7a0MWO+PVBOuSmvcBGPjVeHdGU7hlVr6S6vEy71166sPGURGv0Pf9enu6MDw6FzTY+QVN71BsglFgHwOuL/9P+mlfopb7AAE0YOB9GQ== 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-SenderADCheck; bh=l2/jxCJkE0XAdeEzUkmyD7xCbQvWBCiLfJMyp7DZt8A=; b=iMFhdvVnD3TEq+KPV+ax3cjhbWeOomxqB1LuHsX6r0qsZ0bayK99r1oFwTUbdmWne7LJo0cEL6HMJ977k4Hv9jRiP16fYc4Bc93coqM4H3EawdcO5+75af9M1o3EGQ6VA4tTnWyFChlfqZjMwOWf6N25XrU+Jk0lQAT1FxgWWIrbAqJwIHxP0S0ZB56tYRWUdJcP1QH17j+etZuxaU3t7KfAWwIvPFzCf2gqeJ2chX3Y7bxQpJaZDCqFkzMPgoNxoIWoOqrH9nFXtVCqPBEfW2TvDbkpxEOMCbItFdCgq2ANsxdc+x3NDnvHtu+xkgWcVhQDDGUrRB0czWqwzkMGPw== 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=l2/jxCJkE0XAdeEzUkmyD7xCbQvWBCiLfJMyp7DZt8A=; b=VRw5yKrR7/ND5GjECzJM1OLh9shNueMmZNMlFa2bPJ57qyB56mFO5iuBujUNqgpBUZ5n3lFeF6UcyxhjNXBS6asL9t9P0uXgFiLGB22QjY5/4/Bcrjw8nH6U2tolKUefBBKA/JNkPpWRCIEPXGG1SejJqEeTSThqIYpCRv+Li3s= Received: from DS7PR03CA0101.namprd03.prod.outlook.com (2603:10b6:5:3b7::16) by PH0PR12MB5402.namprd12.prod.outlook.com (2603:10b6:510:ef::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Mon, 19 Jul 2021 16:35:01 +0000 Received: from DM6NAM11FT056.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b7:cafe::c7) by DS7PR03CA0101.outlook.office365.com (2603:10b6:5:3b7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:01 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT056.mail.protection.outlook.com (10.13.173.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:01 +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.2242.4; Mon, 19 Jul 2021 11:35:00 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:34:51 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 03/12] ASoc: amd: add acp5x init/de-init functions Date: Mon, 19 Jul 2021 22:21:31 +0530 Message-ID: <20210719165140.16143-4-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1ca58542-542e-4f8d-04db-08d94ad327bf X-MS-TrafficTypeDiagnostic: PH0PR12MB5402: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:175; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WtE4YwxKlM82p0F1QM47+O9MHV/1mD4K8WKetZCAcfxw1RTzyjWGTZKwDaPUOdhPc5kyaJC+kybo/hGBr1SXdGkZZDQeRk/xf6waIcZ4bgyOCXNgARltxJQMyW39k+ExS3fzE3MrT3DQBlU4Ph4Db8BqriWl+zxdhwo4Yy4TFUqBcd9PnPVNBpCEAShIM7VHNYgs2+JPt0h2q/mrJSzZXjgs0elLc1UR2lsYkUuM7NTDfpeNQZNQp+dhhCYraZHQRcU9dOEkIOLvz2NfAATL+nZ7HgWNFkcMf3U2C0agD60zoNvWwzHSjirxFQz3/PoDRQk1+aDNg7LO+5tpZ7/pfqxlXIr43XyiPd8TOhsuTDUR1yQyZ9FedWsqQ7WplSTmEuWg4M1/sWfHWEOd4E9VNKGwRmCyV5m9V86qWaslKZd872bmHrbavoPIA0Dbq91vGBSJNu3eQoAlBenFUdU+Dwa9qlHqimjwdPw5WTWDc0YjyFWQPtZooM+30jEMkqqvsza5ILZJaKKgfRJLtXtw4MobDpZ5UhpkCW0tuKCLpbYS1ZB6kpcQW6IBpmt1xo8dnMTb5PIRe9O3DqkSbv/MKSo2AXPWf3y3RZWMeBIBG4QvOQTNkL/4/jcJfI6oYQ3uc8ZDdggK+uPfoAPDoKlS6biqxtLwB6NlhUjroQRzJIP77jiDvVjhZkVdvPPvpdaeRmsqD4MOOYY88I+cmuXOEU6iSWQlysC0HWdsHQet5Pn54h+yS8nOC6vxVphLKWrI53cmyphu6V16/mETUoL/UNyhG+kTcp63NLqYZjg2gN8= 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:(4636009)(46966006)(36840700001)(186003)(26005)(8936002)(82310400003)(81166007)(356005)(70206006)(316002)(86362001)(70586007)(7696005)(6666004)(47076005)(8676002)(508600001)(36756003)(336012)(54906003)(110136005)(36860700001)(4326008)(426003)(5660300002)(2906002)(1076003)(2616005)(44832011)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:35:01.3941 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ca58542-542e-4f8d-04db-08d94ad327bf 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: DM6NAM11FT056.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5402 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Vangogh ACP PCI driver init/deinit functions. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 12 ++++ sound/soc/amd/vangogh/pci-acp5x.c | 106 ++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index 8afa8144af4e..708586109315 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -9,6 +9,18 @@ #define ACP5x_PHY_BASE_ADDRESS 0x1240000 #define ACP_DEVICE_ID 0x15E2 +#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_ERR_INTR_MASK 0x20000000 +#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index e56d060a5cb9..523b962fe35e 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "acp5x.h" @@ -14,6 +15,101 @@ struct acp5x_dev_data { void __iomem *acp5x_base; }; +static int acp5x_power_on(void __iomem *acp5x_base) +{ + u32 val; + int timeout; + + val = acp_readl(acp5x_base + ACP_PGFSM_STATUS); + + if (val == 0) + return val; + + if ((val & ACP_PGFSM_STATUS_MASK) != + ACP_POWER_ON_IN_PROGRESS) + acp_writel(ACP_PGFSM_CNTL_POWER_ON_MASK, + acp5x_base + ACP_PGFSM_CONTROL); + timeout = 0; + while (++timeout < 500) { + val = acp_readl(acp5x_base + ACP_PGFSM_STATUS); + if ((val & ACP_PGFSM_STATUS_MASK) == ACP_POWERED_ON) + return 0; + udelay(1); + } + return -ETIMEDOUT; +} + +static int acp5x_reset(void __iomem *acp5x_base) +{ + u32 val; + int timeout; + + acp_writel(1, acp5x_base + ACP_SOFT_RESET); + timeout = 0; + while (++timeout < 500) { + val = acp_readl(acp5x_base + ACP_SOFT_RESET); + if (val & ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK) + break; + cpu_relax(); + } + acp_writel(0, acp5x_base + ACP_SOFT_RESET); + timeout = 0; + while (++timeout < 500) { + val = acp_readl(acp5x_base + ACP_SOFT_RESET); + if (!val) + return 0; + cpu_relax(); + } + return -ETIMEDOUT; +} + +static void acp5x_enable_interrupts(void __iomem *acp5x_base) +{ + acp_writel(0x01, acp5x_base + ACP_EXTERNAL_INTR_ENB); +} + +static void acp5x_disable_interrupts(void __iomem *acp5x_base) +{ + acp_writel(ACP_EXT_INTR_STAT_CLEAR_MASK, acp5x_base + + ACP_EXTERNAL_INTR_STAT); + acp_writel(0x00, acp5x_base + ACP_EXTERNAL_INTR_CNTL); + acp_writel(0x00, acp5x_base + ACP_EXTERNAL_INTR_ENB); +} + +static int acp5x_init(void __iomem *acp5x_base) +{ + int ret; + + /* power on */ + ret = acp5x_power_on(acp5x_base); + if (ret) { + pr_err("ACP5x power on failed\n"); + return ret; + } + /* Reset */ + ret = acp5x_reset(acp5x_base); + if (ret) { + pr_err("ACP5x reset failed\n"); + return ret; + } + acp5x_enable_interrupts(acp5x_base); + return 0; +} + +static int acp5x_deinit(void __iomem *acp5x_base) +{ + int ret; + + acp5x_disable_interrupts(acp5x_base); + /* Reset */ + ret = acp5x_reset(acp5x_base); + if (ret) { + pr_err("ACP5x reset failed\n"); + return ret; + } + return 0; +} + static int snd_acp5x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -50,6 +146,9 @@ static int snd_acp5x_probe(struct pci_dev *pci, } pci_set_master(pci); pci_set_drvdata(pci, adata); + ret = acp5x_init(adata->acp5x_base); + if (ret) + goto release_regions; release_regions: pci_release_regions(pci); @@ -61,6 +160,13 @@ static int snd_acp5x_probe(struct pci_dev *pci, static void snd_acp5x_remove(struct pci_dev *pci) { + struct acp5x_dev_data *adata; + int ret; + + adata = pci_get_drvdata(pci); + ret = acp5x_deinit(adata->acp5x_base); + if (ret) + dev_err(&pci->dev, "ACP de-init failed\n"); pci_release_regions(pci); pci_disable_device(pci); } From patchwork Mon Jul 19 16:51:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386283 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFE9EC07E95 for ; Mon, 19 Jul 2021 16:36:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F41DC6135F for ; Mon, 19 Jul 2021 16:36:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F41DC6135F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 9ED351686; Mon, 19 Jul 2021 18:35:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9ED351686 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712604; bh=uUsjQ0ZJhmFgNvogc4RIW5nt9Rvt/cTA3JOSWQ8lx9s=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=pf+CqSANE4t5AMJg7ZyQk3Cd4qpvui+5Q5X+s8H9iqO5OcwBc026mQ0h+eDIAVGUY hl7K/otPdE5Hw+ZD7BSxC2huFOnh9LyNcsIK1TbY+Pg5PWDnPkRHx6FU82FldrMTTG 6PnJeXWWYstzAbw4laGLCnr3k+PpY5By15fw2rsw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4EDDCF804DA; Mon, 19 Jul 2021 18:35:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B1E6DF804DF; Mon, 19 Jul 2021 18:35:28 +0200 (CEST) Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2056.outbound.protection.outlook.com [40.107.101.56]) (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 A34E5F804D0 for ; Mon, 19 Jul 2021 18:35:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A34E5F804D0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CVQnj6k0" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L1GjHsAZ6SXUfnIXkQ37sioFHEQen7mLso6fGVPt/DWoT0hn876Us50DioSt5hSeAPiIfBRODLw0+hpUNb9vhZRRk5tSIqEsfvgHNClnf0962imnBEwJ5yxR0vNlgXvHbsL/0SqCdW+egR2Wzy6/I7jp89U59BriMf/nM3B9yQ1EaL2gDXrRhd3BmVNYDiCMWGU00rqqzNBKLxKjTnYczBEarGkwg6V0367OFeNDZX0nQXDlF0R0e9ycWqYGKEIPdBU28VhsCtWdFY/uG3BMypX5A6kDEcSjDTbCBM8jKlaP6PC3KCWPJCi6vBaK3rMXsI1MFvgPVdRc28KQSwBD/g== 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-SenderADCheck; bh=OA4jKcOAxvuYyc8Wc43GPzHv7QEt6orLbIomXiUEZTE=; b=AjEffxUbDSLCMc6y/iacoIImz+kE+lCkaKah4k+HGIcX/jox8kBU01mbhMEXMBdXGRTHDptN7vxVBdLcCOKSqBVLkCgevrC6YDOYL3mbzT2GtejQAixfQD72wDE2niHDi1i7D60NxWBT1AXAOnEhjL3t/zb7QYnRIVAC+0TE8Vf+EmT9hA6MfOYyPNlibTPYMxC4UaWxOiKc/fFz3BodM2axBFT9PGovbrWQNsWWHSzq21VFUOLQeIfmzmWvcfIX6N6nro/RNNRHX8ybX0eYGfF7TXEqo/tqa5fQK2CvZdi+YMB36oDVFoR/pAimRhPKbbdwbVQa7x64DAWiclEAmw== 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=OA4jKcOAxvuYyc8Wc43GPzHv7QEt6orLbIomXiUEZTE=; b=CVQnj6k0WFUkFpP9hHHkQXb9VmcLG86t2GArbazarZn4HXJLDkGdBep/1OTE2Ip4p0z2XvoJ0e2WhA2ZQiyKTDVVK1tbAyFKMFkNJd7VYeJ3nn62ba2JhM+Jmrv82agyRhA0W3sX0c/MW5cPYiQQb0aP8OQeqQdVqhdEZzuqM7s= Received: from DM5PR13CA0023.namprd13.prod.outlook.com (2603:10b6:3:23::33) by CY4PR1201MB0120.namprd12.prod.outlook.com (2603:10b6:910:1c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Mon, 19 Jul 2021 16:35:17 +0000 Received: from DM6NAM11FT068.eop-nam11.prod.protection.outlook.com (2603:10b6:3:23:cafe::33) by DM5PR13CA0023.outlook.office365.com (2603:10b6:3:23::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.11 via Frontend Transport; Mon, 19 Jul 2021 16:35:17 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT068.mail.protection.outlook.com (10.13.173.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:17 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Mon, 19 Jul 2021 11:35:16 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 19 Jul 2021 11:35:16 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:35:07 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 04/12] ASoC: amd: create acp5x platform devices Date: Mon, 19 Jul 2021 22:21:32 +0530 Message-ID: <20210719165140.16143-5-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: faaa921a-ecbb-4604-bd13-08d94ad33160 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0120: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:901; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AhV15x8PIOLNvpAakwgTkMeFJaKZkLAUXV0AQV0nSO9KkDzJ/jokG3UL+V3RnAntgoKpre2raVIUZxDz3hezX0H/J0JFSQ02VXhYw0Z/tIVSZVCdih5NEJRSY2l5ZfM6OOYkqwBI+9Anqr6+Y7xVpXo7E0YIg0RvApX36dHNw3ez357cJtbQKch/XnCRrJUteRgJbi8XFRoxCk3PJyGq/8wb/ljVCpvM3sAT1YmxmZKmCG8H0WFa2Dioc81siX4tKSR1YSpxKE41Y0TYhLT0koadkJdFH2IqK2STvMQLFUQjOhTejDGrkmTXDRyzG95dEnXJ5haLBMfZjd4rHFkm/yvg0KDo5o8hTxLgfsnF6pYbhmJNMIr3onwcGuDoMhGA/5LM3axr4hKCSt05aupFO2L33SUxYTWy7Lby2910NbXzXRWGIzeaznQp0FqMsQXCutzqBHMbteRFXJ8/YoD604cAsX7FntHI1IuTyqA8fJA5Pfi0MMBA8wzAbFXieFhfqfFKT6boQW511rHGcXpIZ9OJkIREOq7IiWNlIZa2d1ZZ69Yo58IpMD1KMGFBoTZ6c30E+S8gDPb5tLkrGRCsD4TiWmnbk6lZpPFmkYo+MUASyagFC5yPxo1/MCdj8xxNDmI5EvZspgZ7nF1DjqEsotX1Hz75u8sz55d0tmovC0pP1AKjP4C5jj+EXVP21mxSoqiMhdUbqUnMuNBLqgOao8jKzn8uOUSacRg6tGUwH36omtbQXpVbnf3DHN7uMdtP3gD9onCjfhjZGARY97H5mMb4xvXqujOd5TwVF2vjaxA= 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:(4636009)(376002)(136003)(346002)(39860400002)(396003)(36840700001)(46966006)(7696005)(6666004)(70206006)(47076005)(81166007)(44832011)(316002)(2616005)(82310400003)(70586007)(356005)(186003)(5660300002)(4326008)(1076003)(8936002)(82740400003)(110136005)(36860700001)(336012)(8676002)(54906003)(83380400001)(26005)(86362001)(478600001)(36756003)(426003)(2906002)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:35:17.5544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: faaa921a-ecbb-4604-bd13-08d94ad33160 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: DM6NAM11FT068.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0120 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" ACP5.x IP has multiple I2S controllers and DMA controller. Create platform devices for I2S HS controller instance, I2S SP controller instance and DMA contrller. Pass PCI resources like MMIO, irq to these platform devices. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 10 ++++ sound/soc/amd/vangogh/pci-acp5x.c | 95 ++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index 708586109315..bbf29fd2b12f 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -22,6 +22,16 @@ #define ACP_ERR_INTR_MASK 0x20000000 #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +#define ACP5x_DEVS 0x03 +#define ACP5x_REG_START 0x1240000 +#define ACP5x_REG_END 0x1250200 +#define ACP5x_I2STDM_REG_START 0x1242400 +#define ACP5x_I2STDM_REG_END 0x1242410 +#define ACP5x_HS_TDM_REG_START 0x1242814 +#define ACP5x_HS_TDM_REG_END 0x1242824 +#define I2S_MODE 0x00 +#define ACP5x_I2S_MODE 0x00 + /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr * for accessing ACP5x MMIO space registers diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index 523b962fe35e..3cc15a15b745 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -8,11 +8,16 @@ #include #include #include +#include +#include #include "acp5x.h" struct acp5x_dev_data { void __iomem *acp5x_base; + bool acp5x_audio_mode; + struct resource *res; + struct platform_device *pdev[3]; }; static int acp5x_power_on(void __iomem *acp5x_base) @@ -114,9 +119,12 @@ static int snd_acp5x_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { struct acp5x_dev_data *adata; - int ret; - u32 addr; + struct platform_device_info pdevinfo[3]; + unsigned int irqflags; + int ret, i; + u32 addr, val; + irqflags = IRQF_SHARED; if (pci->revision != 0x50) return -ENODEV; @@ -150,6 +158,83 @@ static int snd_acp5x_probe(struct pci_dev *pci, if (ret) goto release_regions; + val = acp_readl(adata->acp5x_base + ACP_PIN_CONFIG); + switch (val) { + case I2S_MODE: + adata->res = devm_kzalloc(&pci->dev, + sizeof(struct resource) * 4, + GFP_KERNEL); + if (!adata->res) { + ret = -ENOMEM; + goto de_init; + } + + adata->res[0].name = "acp5x_i2s_iomem"; + adata->res[0].flags = IORESOURCE_MEM; + adata->res[0].start = addr; + adata->res[0].end = addr + (ACP5x_REG_END - ACP5x_REG_START); + + adata->res[1].name = "acp5x_i2s_sp"; + adata->res[1].flags = IORESOURCE_MEM; + adata->res[1].start = addr + ACP5x_I2STDM_REG_START; + adata->res[1].end = addr + ACP5x_I2STDM_REG_END; + + adata->res[2].name = "acp5x_i2s_hs"; + adata->res[2].flags = IORESOURCE_MEM; + adata->res[2].start = addr + ACP5x_HS_TDM_REG_START; + adata->res[2].end = addr + ACP5x_HS_TDM_REG_END; + + adata->res[3].name = "acp5x_i2s_irq"; + adata->res[3].flags = IORESOURCE_IRQ; + adata->res[3].start = pci->irq; + adata->res[3].end = adata->res[3].start; + + adata->acp5x_audio_mode = ACP5x_I2S_MODE; + + memset(&pdevinfo, 0, sizeof(pdevinfo)); + pdevinfo[0].name = "acp5x_i2s_dma"; + pdevinfo[0].id = 0; + pdevinfo[0].parent = &pci->dev; + pdevinfo[0].num_res = 4; + pdevinfo[0].res = &adata->res[0]; + pdevinfo[0].data = &irqflags; + pdevinfo[0].size_data = sizeof(irqflags); + + pdevinfo[1].name = "acp5x_i2s_playcap"; + pdevinfo[1].id = 0; + pdevinfo[1].parent = &pci->dev; + pdevinfo[1].num_res = 1; + pdevinfo[1].res = &adata->res[1]; + + pdevinfo[2].name = "acp5x_i2s_playcap"; + pdevinfo[2].id = 1; + pdevinfo[2].parent = &pci->dev; + pdevinfo[2].num_res = 1; + pdevinfo[2].res = &adata->res[2]; + + for (i = 0; i < ACP5x_DEVS; i++) { + adata->pdev[i] = + platform_device_register_full(&pdevinfo[i]); + if (IS_ERR(adata->pdev[i])) { + dev_err(&pci->dev, "cannot register %s device\n", + pdevinfo[i].name); + ret = PTR_ERR(adata->pdev[i]); + goto unregister_devs; + } + } + break; + default: + dev_info(&pci->dev, "ACP audio mode : %d\n", val); + } + return 0; + +unregister_devs: + if (val == I2S_MODE) + for (i = 0; i < ACP5x_DEVS; i++) + platform_device_unregister(adata->pdev[i]); +de_init: + if (acp5x_deinit(adata->acp5x_base)) + dev_err(&pci->dev, "ACP de-init failed\n"); release_regions: pci_release_regions(pci); disable_pci: @@ -161,9 +246,13 @@ static int snd_acp5x_probe(struct pci_dev *pci, static void snd_acp5x_remove(struct pci_dev *pci) { struct acp5x_dev_data *adata; - int ret; + int i, ret; adata = pci_get_drvdata(pci); + if (adata->acp5x_audio_mode == ACP5x_I2S_MODE) { + for (i = 0; i < ACP5x_DEVS; i++) + platform_device_unregister(adata->pdev[i]); + } ret = acp5x_deinit(adata->acp5x_base); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); From patchwork Mon Jul 19 16:51:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D6EAC07E95 for ; Mon, 19 Jul 2021 16:37:24 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC28B61283 for ; Mon, 19 Jul 2021 16:37:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC28B61283 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 5D4FC167B; Mon, 19 Jul 2021 18:36:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5D4FC167B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712642; bh=CK1a2OJJk4U28NU2zy/nASwWAdXk22hFFAlHn07eL00=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Q9wbPo/N2pZQnuhXERo/KE9i0ViNm1/q82509RBq0YmrXHo1lZ9XOYr3BBeGPST1d mIe1SHv7fO4t1isgo4Z9ezhFiu4+1T93mvYLVOUS+I8kJnLgeqLDO3UCnE2k+urH8c hHtLcN5PUncLZQso7D9HKBBiptrmlKYpL+V/IYck= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8BF01F804F1; Mon, 19 Jul 2021 18:35:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8787CF804F2; Mon, 19 Jul 2021 18:35:43 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2084.outbound.protection.outlook.com [40.107.102.84]) (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 0D81DF80227 for ; Mon, 19 Jul 2021 18:35:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0D81DF80227 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="GyqiPJlZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PQWM/vPiG/gdJoSkHuGQJL/n6OBpJees+qVyu9+50gAY4V+e6QSj3lW0333tuocnrfnJd0EBjUVOAORcAc9g/EoNReg+kj+bqbA61NncYGVkLgcEzeML5gc7xlYbNKce5OhZmm+BvKbgt1gsf5zFCJSGcMARYtlJmXvY7aX0vQe+K+UeV98qZDrnPTliM1Ih3o2MDOhSmNnvoUYslZdfTobuk4hfdKu+4Vgy4ifChVdIbOp73KA1GWmuLFB1xLkc1elZcCqor9pGCDQGnaq/QxbgktllHAlW5inzNsyCs3yYgw+BnoBI8Ex+manIkySJEUV+Hat7fEZIKpSsQE2iww== 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-SenderADCheck; bh=lljWRm+TtuqWEDD4r9IXuRrFTizOWIwsoTzgvjq67kU=; b=h8TNFHjpepnFAzBFFdFCd1QUrpKt48r72LQQpp1mxZ82LKGvC+OJn1clGO6cLjUwCoNE1JVyDqPag/FB9nhUUsj/0u72bOKf/0tL3ybtA7Cx/QCxzxJ9u7HKvJVt4qFG5t5XvstCaRwcCdpU/yUVsYlUYN4hGr3adhaD0wD790ZLqUtZjEzK7BF5SNqE2eeo+cPhC4J8sNHK9Jt5tpFXpg7qTwwJulR+ixfnplBpIwa7aTZVLHmiP0JkGHqIhy6u2hYbrUBKql99nn0WuWclK4Xby6ABOy8q9GmsiDQ5T5CTxZPzZMBOgAKwpwcp+q9l7Ns5lorNU7CFfs4Vm07ghQ== 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=lljWRm+TtuqWEDD4r9IXuRrFTizOWIwsoTzgvjq67kU=; b=GyqiPJlZmnmoRnUujZydS4Vi6M1Dm0uwf9J47uIJiKVAk6mo6YdmbTchse3BP1N3daAWqoZkarU1yo5ye6uaWrEWFrBEy4c6dO8lTTI5+V/z+4yTRhHFkmKWV5w4RkWCFoZXyuc33GJRuqixRivzgUVY+0S53cmajLeTiMsd8hg= Received: from DM5PR16CA0025.namprd16.prod.outlook.com (2603:10b6:4:15::11) by MWHPR12MB1632.namprd12.prod.outlook.com (2603:10b6:301:10::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Mon, 19 Jul 2021 16:35:35 +0000 Received: from DM6NAM11FT057.eop-nam11.prod.protection.outlook.com (2603:10b6:4:15:cafe::ed) by DM5PR16CA0025.outlook.office365.com (2603:10b6:4:15::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT057.mail.protection.outlook.com (10.13.172.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:35 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Mon, 19 Jul 2021 11:35:34 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 19 Jul 2021 11:35:34 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:35:25 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 05/12] ASoC: amd: add ACP5x PCM platform driver Date: Mon, 19 Jul 2021 22:21:33 +0530 Message-ID: <20210719165140.16143-6-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7957f9eb-e352-4d53-0b17-08d94ad33bcf X-MS-TrafficTypeDiagnostic: MWHPR12MB1632: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: O/+bzAW3gN5wqMbuCm5UsMmKS8743IgTl9MvOz86Wt7JpLI3fqeROqjUuRJ2LpNDUkGpaH65i+c6Efc8HxZdY42nHO3UrdPF+6iNsLyUsXdn61uWNyDicutCzSPbuqWdEvbeJqZrwQ/FNRjjR/zUE74PFRCMA6T8tTbR9ol9/JoowB61kZz/lMJnbBsZuxSokFBgcASm2AaFgqvgLc+sjBVwZT+tVt334bw9B59OFblk0xY7MEfrY/LXClbwGymH7sMmPs77sLeDLF8fAsqEGgdG8MI/03vklsBiIc1G1nipBFiws9xDLM+aPo8EInurHmlj6U0ML3QwOJqyjfxE9+BdGLgsV9pjTgUIvLAJnvvGkeAu+vm6l3nd/6M0hdbNn1EsJia6ISObduKxmEQUlW0c51k7OCbuEv8X0xpSpnllEEhABr/8fx0x76ZjwdbEzeir6ih3MveaARjF5E5IeNgL1r2v4cR5L1z9zdwi4d5ClVkige0vrl3a4SMqApN+bQpipKJ5f/QHqMyKg/aPA7pf1ldIFNhKixsGUXtSa29IUigaKZ4I0dM3WCu5k8ThYC1IIVBiyq3ssVws19SAmIiiHmxGh5FktIFnJYS9pCB9FANz1Di3OZuRZV1OBahc01cPEJh8HOS/YFSnUiH2qyqiRyx2WF64alfL/3iTIQ/FQIX/f9+EGebErA6Cqd1Imv+YysCL1LVRpVVDeb05AGC4Om1c5ciwlTgVJfb1+OjvNZ0NgHToExP4MaeNkaAq 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:(4636009)(46966006)(36840700001)(36756003)(316002)(2616005)(81166007)(336012)(110136005)(86362001)(44832011)(356005)(26005)(82310400003)(47076005)(36860700001)(5660300002)(4326008)(8936002)(2906002)(54906003)(508600001)(83380400001)(426003)(6666004)(70586007)(8676002)(1076003)(186003)(70206006)(7696005)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:35:35.0575 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7957f9eb-e352-4d53-0b17-08d94ad33bcf 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: DM6NAM11FT057.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1632 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" PCM platform driver binds to the platform device created by ACP5x PCI device. PCM driver registers ALSA DMA components with ASoC framework. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 73 +++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 77 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x-pcm-dma.c diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c new file mode 100644 index 000000000000..2ff11bb88305 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD ALSA SoC PCM Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp5x.h" + +#define DRV_NAME "acp5x_i2s_dma" + +static const struct snd_soc_component_driver acp5x_i2s_component = { + .name = DRV_NAME, +}; + +static int acp5x_audio_probe(struct platform_device *pdev) +{ + struct resource *res; + struct i2s_dev_data *adata; + int status; + + if (!pdev->dev.platform_data) { + dev_err(&pdev->dev, "platform_data not retrieved\n"); + return -ENODEV; + } + irqflags = *((unsigned int *)(pdev->dev.platform_data)); + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENODEV; + } + + adata = devm_kzalloc(&pdev->dev, sizeof(*adata), GFP_KERNEL); + if (!adata) + return -ENOMEM; + + adata->acp5x_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (!adata->acp5x_base) + return -ENOMEM; + dev_set_drvdata(&pdev->dev, adata); + status = devm_snd_soc_register_component(&pdev->dev, + &acp5x_i2s_component, + NULL, 0); + if (status) { + dev_err(&pdev->dev, "Fail to register acp i2s component\n"); + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp5x_dma_driver = { + .probe = acp5x_audio_probe, + .driver = { + .name = "acp5x_i2s_dma", + }, +}; + +module_platform_driver(acp5x_dma_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP 5.x PCM Driver"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index bbf29fd2b12f..d2853738eb17 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -32,6 +32,10 @@ #define I2S_MODE 0x00 #define ACP5x_I2S_MODE 0x00 +struct i2s_dev_data { + void __iomem *acp5x_base; +}; + /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr * for accessing ACP5x MMIO space registers From patchwork Mon Jul 19 16:51:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3736EC12002 for ; Mon, 19 Jul 2021 16:37:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C8F1E61357 for ; Mon, 19 Jul 2021 16:37:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8F1E61357 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 448D9166F; Mon, 19 Jul 2021 18:36:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 448D9166F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712656; bh=f1WyYPNQ8367FwSm7hs/sqycYydrpX9QAy7SfV5jiKE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SpJnt2o/1/DpelqFLXEJSLkJY3T2SBcaDS0nqyyZ4i2S+mn3Bba5fh93OibG1YHHz zaMi3Q4gKfCsg95WPzPoSoasPZhXU07hLsrZxecT1NZOLzDo3/BI1/X2tiFCXHSdke 7pR9V6bpQgAD+nmP4nbBDc3OlhxwiITDVgFA3/gg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D843FF804AC; Mon, 19 Jul 2021 18:36:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 37304F804CB; Mon, 19 Jul 2021 18:36:03 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2040.outbound.protection.outlook.com [40.107.243.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2DBCEF800DA for ; Mon, 19 Jul 2021 18:35:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2DBCEF800DA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZNSU26zF" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gO24ArL3vF6WxNINlHm8ivjXUWX+aaAUHykbL9KWGUhkVvvuZ2ICz/F0VEOo8x9CN4FimBVjdeYqj31uDj60jgLdHs9/TuOw47OKW98qrIzkhQjiGOeILkzWul9TL0D58hEoUEyBi+EjP9+iswN7b3o9Vu3Bs1drffIvjxKTNgW3G+3JpgjvB1qmM6ChI2/IsU6aIyuUXWssC+PdV9Hdx3IiayiKDcE/7qQMJ2nQnC/20kRnNBlTWEhj/KeCI3oNlKZIdOBHb2/9yFyepq7wXIwbevGjio9lBLM42FiF40zHJdop6Jtur9butx07dIB9+j6EplweMqn0SjBymk133Q== 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-SenderADCheck; bh=7I7qTPyqne9xeCxqxwzH/JlVcKX2CwomKSXRizo0UlI=; b=Zi+S9B/REvI6n8vat14mv+wZYH2f6ihSroPpI9MMLdR9WrymSCc2LnvjjP3szTvDVCViStUaCCmDXmEyEI9uTHGmkaQdfO2Aek0IFjwdNFl5C8C8QPP0BwSSNVH9Ee3o+xtivRgM1LNbsWLmqLep0NBpAew8VKFPUKXmd755AkT/UrkSZ4Gd59LXS8PmQsbev0isK+FXDUSOyfgCM6EgNdVXqz+QF95i5WMjp+myCZqtKpSVdOcufUlKtRTAKlGAz9luVq2xUJD1Y74ycwFHtAbLAwY2rPCXosX4Zc+BNq3PUYBkbdBc9X4qYNdyUyYSkscwYeLXnG6NHdzhVVKdTQ== 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=7I7qTPyqne9xeCxqxwzH/JlVcKX2CwomKSXRizo0UlI=; b=ZNSU26zF0EkLgHQFzaOHLlT+3ui6T5/klshF10LHb//dk0pLvqCFSjEHkTG8LuT/IUobceJFC/h+6bfbJpyImbqwwZcAX/4swUL6jq1q+tW8D50UAZ9b8PFCAXt9MnKhagYXuEmoXzyVblCe8EpZkb4Z5+aSzFcet4wCvCoWvNE= Received: from DM3PR14CA0131.namprd14.prod.outlook.com (2603:10b6:0:53::15) by MW2PR12MB2553.namprd12.prod.outlook.com (2603:10b6:907:9::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 16:35:51 +0000 Received: from DM6NAM11FT030.eop-nam11.prod.protection.outlook.com (2603:10b6:0:53:cafe::d1) by DM3PR14CA0131.outlook.office365.com (2603:10b6:0:53::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT030.mail.protection.outlook.com (10.13.172.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:35:51 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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.2242.4; Mon, 19 Jul 2021 11:35:50 -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.2242.4; Mon, 19 Jul 2021 09:35:50 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:35:41 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver Date: Mon, 19 Jul 2021 22:21:34 +0530 Message-ID: <20210719165140.16143-7-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a010330e-f024-43fa-6ff6-08d94ad345a7 X-MS-TrafficTypeDiagnostic: MW2PR12MB2553: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:45; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ir7EAJRxuEelkvgo7Mxtt5PgLsgdRXY1NZT+Ymmkf+yneDcrZEhS3xfcTGH+DVtNZbQ75FTtLxxNw7h1GygOXVA9xf7Mem1kSQ+5CtZ0+Mw8kWsLP7kRXODcjmfzce+2fipjikJs6zIToFnw5n7pkSjLwXwzuselTufuOEi00yjWazZXQ1ioZZkHSkT+YZBVrSdrTDNpOYPSDJNsH2a1GB8I2aryfd65zbBQ3k+a502ffZ6s063QVrryPNwn/sBRJ6EFm/K05fKA/2E2BmpwKLP8QZAJIz8gIUAVDBYYJj6f9eDQvdS+PWIspGxVCoxAFhx+S/CeoSL5nqX8GCVEwEHfiCMvRI81NXX+FXx3j9ouZKa6yDjGyKpkjZ7kyg4oeNvQ3IYtkLyBUy+Rfi7fnw2PQyg4QEOGUFLP0jI1j5XHhUacA87ha1ol0vIbbna6pTOgVYZJb/U4ACWVFEkYwgDWW8+xurWQInvicPH+lKo2nd6vTI7peCTBnz73vr2SiGLmW7MVikELU6vEceUBZWcIPpCA+olB7+zbAKeFLh74GFqP4DrDMozVulwIB1UW2u5OSmeUeN4jdyAEi8Se2vf9hH4pW/XOQkDJLtgscE1KX3eSC/jgeETW5FNoW9LGCAo/76+7MAqXO06LIRtj8QP1Cb88guCB6ZyXMyJLvJcjKtjhXOIzpXSp09GP2vm8vXukmSo9zFbH/zW6Ine970jVZ22VL6e5jUI+QxQP+30U8N7FO273FFIBmigDSWtJ 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:(4636009)(396003)(39860400002)(136003)(376002)(346002)(46966006)(36840700001)(110136005)(70586007)(70206006)(54906003)(478600001)(26005)(8936002)(6666004)(7696005)(186003)(86362001)(8676002)(336012)(356005)(5660300002)(1076003)(44832011)(2616005)(426003)(316002)(4326008)(36756003)(82310400003)(2906002)(81166007)(47076005)(82740400003)(83380400001)(36860700001)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:35:51.5682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a010330e-f024-43fa-6ff6-08d94ad345a7 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: DM6NAM11FT030.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2553 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Whenever audio data equal to the I2S FIFO watermark level are produced/consumed, interrupt is generated. Acknowledge the interrupt. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 61 +++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 9 ++++ 2 files changed, 70 insertions(+) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 2ff11bb88305..76a965a8ec3c 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -21,10 +21,57 @@ static const struct snd_soc_component_driver acp5x_i2s_component = { .name = DRV_NAME, }; +static irqreturn_t i2s_irq_handler(int irq, void *dev_id) +{ + struct i2s_dev_data *vg_i2s_data; + u16 irq_flag; + u32 val; + + vg_i2s_data = dev_id; + if (!vg_i2s_data) + return IRQ_NONE; + + irq_flag = 0; + val = acp_readl(vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + if ((val & BIT(HS_TX_THRESHOLD)) && vg_i2s_data->play_stream) { + acp_writel(BIT(HS_TX_THRESHOLD), vg_i2s_data->acp5x_base + + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->play_stream); + irq_flag = 1; + } + if ((val & BIT(I2S_TX_THRESHOLD)) && + vg_i2s_data->i2ssp_play_stream) { + acp_writel(BIT(I2S_TX_THRESHOLD), + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_play_stream); + irq_flag = 1; + } + + if ((val & BIT(HS_RX_THRESHOLD)) && vg_i2s_data->capture_stream) { + acp_writel(BIT(HS_RX_THRESHOLD), vg_i2s_data->acp5x_base + + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->capture_stream); + irq_flag = 1; + } + if ((val & BIT(I2S_RX_THRESHOLD)) && + vg_i2s_data->i2ssp_capture_stream) { + acp_writel(BIT(I2S_RX_THRESHOLD), + vg_i2s_data->acp5x_base + ACP_EXTERNAL_INTR_STAT); + snd_pcm_period_elapsed(vg_i2s_data->i2ssp_capture_stream); + irq_flag = 1; + } + + if (irq_flag) + return IRQ_HANDLED; + else + return IRQ_NONE; +} + static int acp5x_audio_probe(struct platform_device *pdev) { struct resource *res; struct i2s_dev_data *adata; + unsigned int irqflags; int status; if (!pdev->dev.platform_data) { @@ -47,6 +94,14 @@ static int acp5x_audio_probe(struct platform_device *pdev) resource_size(res)); if (!adata->acp5x_base) return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_IRQ FAILED\n"); + return -ENODEV; + } + + adata->i2s_irq = res->start; dev_set_drvdata(&pdev->dev, adata); status = devm_snd_soc_register_component(&pdev->dev, &acp5x_i2s_component, @@ -55,6 +110,12 @@ static int acp5x_audio_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Fail to register acp i2s component\n"); return -ENODEV; } + status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, + irqflags, "ACP5x_I2S_IRQ", adata); + if (status) { + dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); + return -ENODEV; + } return 0; } diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index d2853738eb17..18df2b5a4283 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -31,9 +31,18 @@ #define ACP5x_HS_TDM_REG_END 0x1242824 #define I2S_MODE 0x00 #define ACP5x_I2S_MODE 0x00 +#define I2S_RX_THRESHOLD 27 +#define I2S_TX_THRESHOLD 28 +#define HS_TX_THRESHOLD 24 +#define HS_RX_THRESHOLD 23 struct i2s_dev_data { + unsigned int i2s_irq; void __iomem *acp5x_base; + struct snd_pcm_substream *play_stream; + struct snd_pcm_substream *capture_stream; + struct snd_pcm_substream *i2ssp_play_stream; + struct snd_pcm_substream *i2ssp_capture_stream; }; /* common header file uses exact offset rather than relative From patchwork Mon Jul 19 16:51:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386289 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1480C07E9B for ; Mon, 19 Jul 2021 16:38:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 261D36135D for ; Mon, 19 Jul 2021 16:38:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 261D36135D Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AAA56168A; Mon, 19 Jul 2021 18:37:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AAA56168A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712681; bh=4r4zx+3OdomscaQumqchDIOYnNG1d8Wge57W1CXFdJI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=b4CD1lxAITZTyH0gRaDrLFnD49cvd5wRB+DcuOY//YV+2tanK+pIcQwA0lVFnX5GO 1dXHjPtWMFmXyKvAio6nYDKDQdbdEB7pLpyi7fGupETh45+KlkTry7YwNSz+ujj+nn Dtsy8XFmlNPYLCOaTDawi+OJZ8VlPLe/1amZaDso= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 98551F804F2; Mon, 19 Jul 2021 18:36:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 95871F804F2; Mon, 19 Jul 2021 18:36:15 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2085.outbound.protection.outlook.com [40.107.244.85]) (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 5592FF804E0 for ; Mon, 19 Jul 2021 18:36:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5592FF804E0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="5jFwy5/b" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZ9yFJhJtNYsDUU2WicZ64kw/QebmMUa3utnVTksbhHVPckX2zkKWHzruRC7DR1cR7hmgm1ovaMBuCX6sWlPW/jfFRNpTjeAXB7fvJGlhvxMjgrF7dDhXAA7HZxm3tKNmA3yAIq4S+ETF9RxdJBnbV2cWoa9hgAhn5GHcCCn/DQdz6ufsiHkE0JeuESah9uG8eRZgL20w5QCV4sGkNRpXr3Gx5wkpuimoN+ygbI+Iu2Dvirxvqn4JW3Sl7ZyoY1/euCLPaIYbK6JScd3lCECpyPb8tEov8V4/9lEm+n15XGN7kctjlJeM5USXQ9ay6X/9tb293llSgsMveCBXINcOQ== 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-SenderADCheck; bh=dgeCdC2eVN9ZkdBpQGaFlbw2xcwdjxOz111xgqMe83Y=; b=mhNViw1rab7bThIluy+LNXfknVCQcpCKX51m8xpIvCKtCWdrSiNX40rwtLx1e5lgF/wdOqggP6GaoZ9tp0ABCKfaxMGw2Vhp1NAKug1/5R4JYopY90tvj2EebHEwByPXRq4qzV+JIojaGQvZ0NhYHj3BYd7gMPpUFKBHhPOO+bRcI51H49wAqClLBTm1lSAQoq8hMlMtBA8LA/+FzeGrkNQMHgWIq2uCBBBbINslb95TybF/JuMDyWzbWO7IJo2Wf3lrXSdkKFtR2hYDnfWAcH1OMzr7lfhePyzLRfrTmeGu2H0CQUORqVW7ZIE2ieRypz3X6GbZkILXSpCRIa2LbA== 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=dgeCdC2eVN9ZkdBpQGaFlbw2xcwdjxOz111xgqMe83Y=; b=5jFwy5/bCgitq/RPGRVEmoZF0mk3euUdeCxHiWmsZzm9yUUKZiAwTK0j0e1MsCc0EVlPDto/8klZrZDmjxfKS1CSg7Vjgsb5HAUvlX5Lo3pbWKTwea6OA80GgNNz/H+9DS1NoapfhvLSRFuRl3BGoNtyrhQeYJDNBuki4aM79gA= Received: from DS7PR03CA0076.namprd03.prod.outlook.com (2603:10b6:5:3bb::21) by SA0PR12MB4493.namprd12.prod.outlook.com (2603:10b6:806:72::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Mon, 19 Jul 2021 16:36:07 +0000 Received: from DM6NAM11FT011.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3bb:cafe::ad) by DS7PR03CA0076.outlook.office365.com (2603:10b6:5:3bb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT011.mail.protection.outlook.com (10.13.172.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:06 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2242.4; Mon, 19 Jul 2021 11:36:06 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:35:57 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 07/12] ASoC: amd: add ACP5x pcm dma driver ops Date: Mon, 19 Jul 2021 22:21:35 +0530 Message-ID: <20210719165140.16143-8-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 667d800b-e487-48f3-007d-08d94ad34ed0 X-MS-TrafficTypeDiagnostic: SA0PR12MB4493: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pk02aFaVt43/5MXcJstnao8FLjmTchKajWvkPLpUE6QEF0OVMuoqkZ+0HhnAhtB4Mbvaet3XhKqhjEf+mnx4EYKarzff1lomUPBF6tSHsCkcL4cZz+F5xWhXEpnms5ihxZkpPAkfQPC1wo8/4+moBTLRADuwlXlFQimYylkl147eCnq3azrVAjrTdRPX1gFLYHeKo0StnL5WrEZyYiX8bM61awr7iDmiEsbzKfu5bxQCy4Psyi1ByYgI66gj47jgo3m6mp7LWWPBLD4s8If0vjSmqikNxxvLGvNjr1v1J04+81aqiBmpUPBvUoIGLRC4U+yTNxRQ4VH3jDOeYxCzR30SiVtLfPQop3qkNTirfDU3g6ExvR1s0s2Pazjsa1lE1WnXRiPeCpuyg5pNk6Wr9WP0I6ZoiCzh7U+2tJkZzm5vHx9vgipX4wMwuXgEgbUBzHpoTx/ZDdUZXbqjcCWxlUN1MupNPIYGvDP+IvbhJ5aUQu58vaGaae7K93vu/Xdr5Y4bX8UsKwSSl4hoPeh9/Q0AkhgcnAcRi9iks6FqkN4fko8ajRhHjGAP4hj4z6Il/KnDy9L4M8OdtWTW9s2/49UpmX+angQHy3Cyxd+9qFfAEeCLeoX7u44WdTzysD2bnXtPSxEEOsOGGp9GoroyFpnM3EpsYRyy3tag5JMsfmWB4YUx+xkX2RDx5h1hXdGdYe0MoA51kieVv0C1DQFjKOIu+/VRpVUSlmqrbwS2qadFR2wKsTEVPYQMla8Q903ZuxmKlByTQra4qaaO8WmB2A== 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:(4636009)(46966006)(36840700001)(8936002)(81166007)(8676002)(426003)(30864003)(70206006)(70586007)(2906002)(5660300002)(356005)(336012)(1076003)(2616005)(44832011)(316002)(36860700001)(186003)(82310400003)(110136005)(4326008)(54906003)(83380400001)(36756003)(26005)(6666004)(508600001)(47076005)(86362001)(7696005)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:36:06.9085 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 667d800b-e487-48f3-007d-08d94ad34ed0 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: DM6NAM11FT011.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4493 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This patch adds ACP5x PCM driver DMA operations. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 305 +++++++++++++++++++++++++- sound/soc/amd/vangogh/acp5x.h | 106 +++++++++ 2 files changed, 409 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 76a965a8ec3c..a2bd53dc86b9 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -17,8 +17,42 @@ #define DRV_NAME "acp5x_i2s_dma" -static const struct snd_soc_component_driver acp5x_i2s_component = { - .name = DRV_NAME, +static const struct snd_pcm_hardware acp5x_pcm_hardware_playback = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_96000, + .rate_min = 8000, + .rate_max = 96000, + .buffer_bytes_max = PLAYBACK_MAX_NUM_PERIODS * PLAYBACK_MAX_PERIOD_SIZE, + .period_bytes_min = PLAYBACK_MIN_PERIOD_SIZE, + .period_bytes_max = PLAYBACK_MAX_PERIOD_SIZE, + .periods_min = PLAYBACK_MIN_NUM_PERIODS, + .periods_max = PLAYBACK_MAX_NUM_PERIODS, +}; + +static const struct snd_pcm_hardware acp5x_pcm_hardware_capture = { + .info = SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_BLOCK_TRANSFER | + SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_96000, + .rate_min = 8000, + .rate_max = 96000, + .buffer_bytes_max = CAPTURE_MAX_NUM_PERIODS * CAPTURE_MAX_PERIOD_SIZE, + .period_bytes_min = CAPTURE_MIN_PERIOD_SIZE, + .period_bytes_max = CAPTURE_MAX_PERIOD_SIZE, + .periods_min = CAPTURE_MIN_NUM_PERIODS, + .periods_max = CAPTURE_MAX_NUM_PERIODS, }; static irqreturn_t i2s_irq_handler(int irq, void *dev_id) @@ -67,6 +101,273 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id) return IRQ_NONE; } +static void config_acp5x_dma(struct i2s_stream_instance *rtd, int direction) +{ + u16 page_idx; + u32 low, high, val, acp_fifo_addr, reg_fifo_addr; + u32 reg_dma_size, reg_fifo_size; + dma_addr_t addr; + + addr = rtd->dma_addr; + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + val = ACP_SRAM_HS_PB_PTE_OFFSET; + break; + case I2S_SP_INSTANCE: + default: + val = ACP_SRAM_SP_PB_PTE_OFFSET; + } + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + val = ACP_SRAM_HS_CP_PTE_OFFSET; + break; + case I2S_SP_INSTANCE: + default: + val = ACP_SRAM_SP_CP_PTE_OFFSET; + } + } + /* Group Enable */ + acp_writel(ACP_SRAM_PTE_OFFSET | BIT(31), rtd->acp5x_base + + ACPAXI2AXI_ATU_BASE_ADDR_GRP_1); + acp_writel(PAGE_SIZE_4K_ENABLE, rtd->acp5x_base + + ACPAXI2AXI_ATU_PAGE_SIZE_GRP_1); + + for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) { + /* Load the low address of page int ACP SRAM through SRBM */ + low = lower_32_bits(addr); + high = upper_32_bits(addr); + + acp_writel(low, rtd->acp5x_base + ACP_SCRATCH_REG_0 + val); + high |= BIT(31); + acp_writel(high, rtd->acp5x_base + ACP_SCRATCH_REG_0 + val + 4); + /* Move to next physically contiguous page */ + val += 8; + addr += PAGE_SIZE; + } + + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_dma_size = ACP_HS_TX_DMA_SIZE; + acp_fifo_addr = ACP_SRAM_PTE_OFFSET + + HS_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_TX_FIFOADDR; + reg_fifo_size = ACP_HS_TX_FIFOSIZE; + acp_writel(I2S_HS_TX_MEM_WINDOW_START, + rtd->acp5x_base + ACP_HS_TX_RINGBUFADDR); + break; + + case I2S_SP_INSTANCE: + default: + reg_dma_size = ACP_I2S_TX_DMA_SIZE; + acp_fifo_addr = ACP_SRAM_PTE_OFFSET + + SP_PB_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_TX_FIFOADDR; + reg_fifo_size = ACP_I2S_TX_FIFOSIZE; + acp_writel(I2S_SP_TX_MEM_WINDOW_START, + rtd->acp5x_base + ACP_I2S_TX_RINGBUFADDR); + } + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_dma_size = ACP_HS_RX_DMA_SIZE; + acp_fifo_addr = ACP_SRAM_PTE_OFFSET + + HS_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_HS_RX_FIFOADDR; + reg_fifo_size = ACP_HS_RX_FIFOSIZE; + acp_writel(I2S_HS_RX_MEM_WINDOW_START, + rtd->acp5x_base + ACP_HS_RX_RINGBUFADDR); + break; + + case I2S_SP_INSTANCE: + default: + reg_dma_size = ACP_I2S_RX_DMA_SIZE; + acp_fifo_addr = ACP_SRAM_PTE_OFFSET + + SP_CAPT_FIFO_ADDR_OFFSET; + reg_fifo_addr = ACP_I2S_RX_FIFOADDR; + reg_fifo_size = ACP_I2S_RX_FIFOSIZE; + acp_writel(I2S_SP_RX_MEM_WINDOW_START, + rtd->acp5x_base + ACP_I2S_RX_RINGBUFADDR); + } + } + acp_writel(DMA_SIZE, rtd->acp5x_base + reg_dma_size); + acp_writel(acp_fifo_addr, rtd->acp5x_base + reg_fifo_addr); + acp_writel(FIFO_SIZE, rtd->acp5x_base + reg_fifo_size); + acp_writel(BIT(I2S_RX_THRESHOLD) | BIT(HS_RX_THRESHOLD) + | BIT(I2S_TX_THRESHOLD) | BIT(HS_TX_THRESHOLD), + rtd->acp5x_base + ACP_EXTERNAL_INTR_CNTL); +} + +static int acp5x_dma_open(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct snd_soc_pcm_runtime *prtd; + struct i2s_dev_data *adata; + struct i2s_stream_instance *i2s_data; + int ret; + + runtime = substream->runtime; + prtd = asoc_substream_to_rtd(substream); + component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); + adata = dev_get_drvdata(component->dev); + + i2s_data = kzalloc(sizeof(*i2s_data), GFP_KERNEL); + if (!i2s_data) + return -EINVAL; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + runtime->hw = acp5x_pcm_hardware_playback; + else + runtime->hw = acp5x_pcm_hardware_capture; + + ret = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (ret < 0) { + dev_err(component->dev, "set integer constraint failed\n"); + kfree(i2s_data); + return ret; + } + i2s_data->acp5x_base = adata->acp5x_base; + runtime->private_data = i2s_data; + return ret; +} + +static int acp5x_dma_hw_params(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct i2s_stream_instance *rtd; + struct snd_soc_pcm_runtime *prtd; + struct snd_soc_card *card; + struct acp5x_platform_info *pinfo; + struct i2s_dev_data *adata; + u64 size; + + prtd = asoc_substream_to_rtd(substream); + card = prtd->card; + pinfo = snd_soc_card_get_drvdata(card); + adata = dev_get_drvdata(component->dev); + rtd = substream->runtime->private_data; + + if (!rtd) + return -EINVAL; + + if (pinfo) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + rtd->i2s_instance = pinfo->play_i2s_instance; + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + adata->play_stream = substream; + break; + case I2S_SP_INSTANCE: + default: + adata->i2ssp_play_stream = substream; + } + } else { + rtd->i2s_instance = pinfo->cap_i2s_instance; + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + adata->capture_stream = substream; + break; + case I2S_SP_INSTANCE: + default: + adata->i2ssp_capture_stream = substream; + } + } + } else { + dev_err(component->dev, "pinfo failed\n"); + } + size = params_buffer_bytes(params); + rtd->dma_addr = substream->dma_buffer.addr; + rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); + config_acp5x_dma(rtd, substream->stream); + return 0; +} + +static snd_pcm_uframes_t acp5x_dma_pointer(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct i2s_stream_instance *rtd; + u32 pos; + u32 buffersize; + u64 bytescount; + + rtd = substream->runtime->private_data; + buffersize = frames_to_bytes(substream->runtime, + substream->runtime->buffer_size); + bytescount = acp_get_byte_count(rtd, substream->stream); + if (bytescount > rtd->bytescount) + bytescount -= rtd->bytescount; + pos = do_div(bytescount, buffersize); + return bytes_to_frames(substream->runtime, pos); +} + +static int acp5x_dma_new(struct snd_soc_component *component, + struct snd_soc_pcm_runtime *rtd) +{ + struct device *parent = component->dev->parent; + + snd_pcm_set_managed_buffer_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, + parent, MIN_BUFFER, MAX_BUFFER); + return 0; +} + +static int acp5x_dma_mmap(struct snd_soc_component *component, + struct snd_pcm_substream *substream, + struct vm_area_struct *vma) +{ + return snd_pcm_lib_default_mmap(substream, vma); +} + +static int acp5x_dma_close(struct snd_soc_component *component, + struct snd_pcm_substream *substream) +{ + struct snd_soc_pcm_runtime *prtd; + struct i2s_dev_data *adata; + struct i2s_stream_instance *ins; + + prtd = asoc_substream_to_rtd(substream); + component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); + adata = dev_get_drvdata(component->dev); + ins = substream->runtime->private_data; + if (!ins) + return -EINVAL; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (ins->i2s_instance) { + case I2S_HS_INSTANCE: + adata->play_stream = NULL; + break; + case I2S_SP_INSTANCE: + default: + adata->i2ssp_play_stream = NULL; + } + } else { + switch (ins->i2s_instance) { + case I2S_HS_INSTANCE: + adata->capture_stream = NULL; + break; + case I2S_SP_INSTANCE: + default: + adata->i2ssp_capture_stream = NULL; + } + } + kfree(ins); + return 0; +} + +static const struct snd_soc_component_driver acp5x_i2s_component = { + .name = DRV_NAME, + .open = acp5x_dma_open, + .close = acp5x_dma_close, + .hw_params = acp5x_dma_hw_params, + .pointer = acp5x_dma_pointer, + .mmap = acp5x_dma_mmap, + .pcm_construct = acp5x_dma_new, +}; + static int acp5x_audio_probe(struct platform_device *pdev) { struct resource *res; diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index 18df2b5a4283..b7bd5cb1906d 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -6,6 +6,7 @@ */ #include "vg_chip_offset_byte.h" +#include #define ACP5x_PHY_BASE_ADDRESS 0x1240000 #define ACP_DEVICE_ID 0x15E2 @@ -36,6 +37,39 @@ #define HS_TX_THRESHOLD 24 #define HS_RX_THRESHOLD 23 +#define I2S_SP_INSTANCE 0x01 +#define I2S_HS_INSTANCE 0x02 + +#define ACP_SRAM_PTE_OFFSET 0x02050000 +#define ACP_SRAM_SP_PB_PTE_OFFSET 0x0 +#define ACP_SRAM_SP_CP_PTE_OFFSET 0x100 +#define ACP_SRAM_HS_PB_PTE_OFFSET 0x200 +#define ACP_SRAM_HS_CP_PTE_OFFSET 0x300 +#define PAGE_SIZE_4K_ENABLE 0x2 +#define I2S_SP_TX_MEM_WINDOW_START 0x4000000 +#define I2S_SP_RX_MEM_WINDOW_START 0x4020000 +#define I2S_HS_TX_MEM_WINDOW_START 0x4040000 +#define I2S_HS_RX_MEM_WINDOW_START 0x4060000 + +#define SP_PB_FIFO_ADDR_OFFSET 0x500 +#define SP_CAPT_FIFO_ADDR_OFFSET 0x700 +#define HS_PB_FIFO_ADDR_OFFSET 0x900 +#define HS_CAPT_FIFO_ADDR_OFFSET 0xB00 +#define PLAYBACK_MIN_NUM_PERIODS 2 +#define PLAYBACK_MAX_NUM_PERIODS 8 +#define PLAYBACK_MAX_PERIOD_SIZE 8192 +#define PLAYBACK_MIN_PERIOD_SIZE 1024 +#define CAPTURE_MIN_NUM_PERIODS 2 +#define CAPTURE_MAX_NUM_PERIODS 8 +#define CAPTURE_MAX_PERIOD_SIZE 8192 +#define CAPTURE_MIN_PERIOD_SIZE 1024 + +#define MAX_BUFFER (PLAYBACK_MAX_PERIOD_SIZE * PLAYBACK_MAX_NUM_PERIODS) +#define MIN_BUFFER MAX_BUFFER +#define FIFO_SIZE 0x100 +#define DMA_SIZE 0x40 +#define FRM_LEN 0x100 + struct i2s_dev_data { unsigned int i2s_irq; void __iomem *acp5x_base; @@ -45,6 +79,31 @@ struct i2s_dev_data { struct snd_pcm_substream *i2ssp_capture_stream; }; +struct i2s_stream_instance { + u16 num_pages; + u16 i2s_instance; + u16 direction; + u16 channels; + u32 xfer_resolution; + u32 val; + dma_addr_t dma_addr; + u64 bytescount; + void __iomem *acp5x_base; +}; + +union acp_dma_count { + struct { + u32 low; + u32 high; + } bcount; + u64 bytescount; +}; + +struct acp5x_platform_info { + u16 play_i2s_instance; + u16 cap_i2s_instance; +}; + /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr * for accessing ACP5x MMIO space registers @@ -58,3 +117,50 @@ static inline void acp_writel(u32 val, void __iomem *base_addr) { writel(val, base_addr - ACP5x_PHY_BASE_ADDRESS); } + +static inline u64 acp_get_byte_count(struct i2s_stream_instance *rtd, + int direction) +{ + union acp_dma_count byte_count; + + if (direction == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + byte_count.bcount.high = + acp_readl(rtd->acp5x_base + + ACP_HS_TX_LINEARPOSCNTR_HIGH); + byte_count.bcount.low = + acp_readl(rtd->acp5x_base + + ACP_HS_TX_LINEARPOSCNTR_LOW); + break; + case I2S_SP_INSTANCE: + default: + byte_count.bcount.high = + acp_readl(rtd->acp5x_base + + ACP_I2S_TX_LINEARPOSCNTR_HIGH); + byte_count.bcount.low = + acp_readl(rtd->acp5x_base + + ACP_I2S_TX_LINEARPOSCNTR_LOW); + } + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + byte_count.bcount.high = + acp_readl(rtd->acp5x_base + + ACP_HS_RX_LINEARPOSCNTR_HIGH); + byte_count.bcount.low = + acp_readl(rtd->acp5x_base + + ACP_HS_RX_LINEARPOSCNTR_LOW); + break; + case I2S_SP_INSTANCE: + default: + byte_count.bcount.high = + acp_readl(rtd->acp5x_base + + ACP_I2S_RX_LINEARPOSCNTR_HIGH); + byte_count.bcount.low = + acp_readl(rtd->acp5x_base + + ACP_I2S_RX_LINEARPOSCNTR_LOW); + } + } + return byte_count.bytescount; +} From patchwork Mon Jul 19 16:51:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC2FC07E95 for ; Mon, 19 Jul 2021 16:38:32 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 021176135F for ; Mon, 19 Jul 2021 16:38:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 021176135F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8ACD4168D; Mon, 19 Jul 2021 18:37:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8ACD4168D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712710; bh=uMfAuahQa3w2+TgSn7RJOjcQS2kHiZSPVY3V0+HEmEk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hym02xu4QhojD0USIA3K/krxSCeiq9n1RqS+hLHsizNfKznZoJX3yhhzjWX6/imLB jgnQWeUSLPdhtWRsV8zadb3i9JSW8LincQpkOyyMk+5tyehnYy3a5KOrWwS3C3NZoG mC54aH4jsWDiJ60x9ZZSA1L+m04em9EMX7wvqz1s= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5B7D8F80256; Mon, 19 Jul 2021 18:36:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 00D74F80256; Mon, 19 Jul 2021 18:36:35 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2060.outbound.protection.outlook.com [40.107.243.60]) (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 93E98F804DF for ; Mon, 19 Jul 2021 18:36:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 93E98F804DF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="4fxP+waX" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VyUeut1V4n/AyCx+1KpY+GQ0bO0YFZqAQ+T/naNuPn3o9iJaqvNsXawXaxx84IIZsSv/57pOtD2ee7o9OkVoZOoeqmJ9ueSRmRoHLq7eVpb92pHviQlCWqgeXqdtJH9QA6KMP8xl9HGk4QoUUMF3oI8maoTqK//Plg3yxx9wBnzU9Slc04YU/kTKepKB9mRh5XP59jVmmfYPGMVEhU1dgbEd5WzuGs16/y9/Iviw2Glg9eKBduHUQVQmTJK2G+mM6B0u5nnys4lzFbgfa/vYTfGyw7KftLdi2arOoe85i9fq/iC5vLtt7Au0dHzBDc1s+5NzEgg1mBHewix1zHsocg== 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-SenderADCheck; bh=7ZObopLkWupT74c0200RM9GP6BMvRZmQxozZF7X8PMM=; b=hRwGhRDhNpzO51BtJrxjxuYmJ/a5qvEAXjQMkYeEPfaQPvtan6ZsFP0UkABCwP04u40+VpIk1IYQc8tn5KH9772grhfH8Bfe+uWz81pYnmdY3Qbo4S23PFUnuLwlWrILPYOAWACRWu3fU9397McHQ88SzhKKec6rSmPKgLB2GzZmBmsjlW8kwiSo2LBa620fudCJ7/5AUIbQ2AciKbZSnNC4tYR3qxOCie1YWsKtzQ0JiaBlOm0DnPNWjNKO3kPws0vWO2tjCj3j4gJrF4jNvPm+uCkoDfD3xz3zNhi83LzCCSItodfrUt2vDDwz4ZWaT80qPwliK9FO6R6KMCKqqw== 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=7ZObopLkWupT74c0200RM9GP6BMvRZmQxozZF7X8PMM=; b=4fxP+waX530hGpCNn3RhUYjgDwjlLGYpGKt1YMtzYIZz+aRZ8lRiu7Q7g7kNnnJcnl3kNgfXybnW//bPqOTn4mURuaqGF9aJWb7L1kIDo7TyyprjXgK4OkQcLffAPw154xelj4w6xpPy4SjfGCIgLrk8qp1iDRlo0hPgK+3Of6M= Received: from DM6PR18CA0013.namprd18.prod.outlook.com (2603:10b6:5:15b::26) by DM6PR12MB2683.namprd12.prod.outlook.com (2603:10b6:5:52::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 16:36:25 +0000 Received: from DM6NAM11FT004.eop-nam11.prod.protection.outlook.com (2603:10b6:5:15b:cafe::ec) by DM6PR18CA0013.outlook.office365.com (2603:10b6:5:15b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT004.mail.protection.outlook.com (10.13.172.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:24 +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.2242.4; Mon, 19 Jul 2021 11:36:24 -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.2242.4; Mon, 19 Jul 2021 09:36:23 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:36:15 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 08/12] ASoC: amd: add vangogh i2s controller driver Date: Mon, 19 Jul 2021 22:21:36 +0530 Message-ID: <20210719165140.16143-9-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c2fe4a41-d0b4-4511-3e78-08d94ad35978 X-MS-TrafficTypeDiagnostic: DM6PR12MB2683: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WBHTDnie1E03TUViElMs0u/E4neRoJbQ2Gvcon7hnqnOeL0Hbeewd3vJaYKORpUlR/jDb9z+6z0Ykdj6XaQLcdeeRfyiyw6VSHCMuz0rIdIfwQalEkRtLQkwNevmM7TLQXzKh8hXOaeCeUtCTJsjdb0Bl3DKcZWWABi2Z6b4wl2kqwsQsC9PAn/FW6hmz+rLjKPKm7+vs4MwNKs0kzzHuZRQhRqVzyEaNUqoGnARrbNvZOoZDiXMPSZSdC5VZ9vZUMeFhh0lVjHEO9kAyQVQJHNcW2PzyUJOc2KJDx/j/c3djohZajFsMxBAJYzXHK7rfujlNrSaWkF5rbXSNSjc9zyD0ZWpNB/a+N8miAm7qz2j5M7Q1vlAKMkob9/2fPGVSlDcSX/1BJbhf/xk5+MhNCPtJ7ZYoKJXNUwsAWvoDfWjSh5q3VFakJO7p2eWdWQKJVsSXnJWvgzioi5P9TB+azauEP6NbmyKt7XOy2ZkxhWK259ZN6TcCzWAqZylzTzQptSVaDvUPwrCzSHw4fFI060CSoFmhOTEVMV9ngNcG7BPKyH1rPzBa5vADsCl8kgyomdQvj5tT/jD6chj9Fh38hjzS+mdgJgymW2iBTchlgZQMQ8Jb/ief2jJ5Z56JiZlXinKp6BgxBqTUs8Qkp2H72KcmHvCbPinfUC2sMd77DMchrxauzbaSg/nuKg8Fkljs8ZBxRs1lhSYmcH6Dp1viWEJH2IhYFU+nrSJHdZbWtQ= 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:(4636009)(396003)(39860400002)(346002)(376002)(136003)(36840700001)(46966006)(426003)(356005)(2616005)(7696005)(86362001)(82740400003)(8936002)(336012)(1076003)(36756003)(36860700001)(110136005)(54906003)(81166007)(82310400003)(316002)(478600001)(44832011)(4326008)(2906002)(186003)(6666004)(70206006)(70586007)(47076005)(26005)(8676002)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:36:24.8153 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c2fe4a41-d0b4-4511-3e78-08d94ad35978 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: DM6NAM11FT004.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2683 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Vangogh I2S controller driver to support two I2S controller instances. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-i2s.c | 90 +++++++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 94 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x-i2s.c diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c new file mode 100644 index 000000000000..93fd0372df29 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD ALSA SoC PCM Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp5x.h" + +#define DRV_NAME "acp5x_i2s_playcap" + +static const struct snd_soc_component_driver acp5x_dai_component = { + .name = "acp5x-i2s", +}; + +static struct snd_soc_dai_driver acp5x_i2s_dai = { + .playback = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, + .capture = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, +}; + +static int acp5x_dai_probe(struct platform_device *pdev) +{ + struct resource *res; + struct i2s_dev_data *adata; + int ret; + + adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), + GFP_KERNEL); + if (!adata) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENOMEM; + } + adata->acp5x_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (IS_ERR(adata->acp5x_base)) + return PTR_ERR(adata->acp5x_base); + + adata->master_mode = I2S_MASTER_MODE_ENABLE; + dev_set_drvdata(&pdev->dev, adata); + ret = devm_snd_soc_register_component(&pdev->dev, + &acp5x_dai_component, + &acp5x_i2s_dai, 1); + if (ret) { + dev_err(&pdev->dev, "Fail to register acp i2s dai\n"); + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp5x_dai_driver = { + .probe = acp5x_dai_probe, + .driver = { + .name = "acp5x_i2s_playcap", + }, +}; + +module_platform_driver(acp5x_dai_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP5.x CPU DAI Driver"); +MODULE_ALIAS("platform:" DRV_NAME); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index b7bd5cb1906d..fbd5cdf44cb8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -70,7 +70,11 @@ #define DMA_SIZE 0x40 #define FRM_LEN 0x100 +#define I2S_MASTER_MODE_ENABLE 0x01 +#define I2S_MASTER_MODE_DISABLE 0x00 + struct i2s_dev_data { + bool master_mode; unsigned int i2s_irq; void __iomem *acp5x_base; struct snd_pcm_substream *play_stream; From patchwork Mon Jul 19 16:51:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386297 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63DDAC07E9D for ; Mon, 19 Jul 2021 16:38:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94B27613D0 for ; Mon, 19 Jul 2021 16:38:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94B27613D0 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 32D361616; Mon, 19 Jul 2021 18:38:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 32D361616 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712732; bh=tCU6B92TPbanDhETSvKNQF/vvWhTT5RUYKxNTERaa0A=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Wzz8m7/2pRWWqTCy2R8QMISZTHHI133yC3D7EJINf2S2pQS17S5SCWUxYpvFf17wU CgE1xfT2if1arFYgoSHQDXU5duA18UYlzS177GzzYv3/RU1OoppsDTOH13H1u9rfc2 wHqUlvGnd5lkHpZSXtq6VWRB5bX8g6J2/5UPAaJE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 43778F804E3; Mon, 19 Jul 2021 18:36:50 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 92A92F804E5; Mon, 19 Jul 2021 18:36:48 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) (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 9F3D9F804DA for ; Mon, 19 Jul 2021 18:36:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9F3D9F804DA Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="isJpxTQv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=drLVN79gZkTEFhaEFNIf6ToVrR4q3dCark2nmPFISj4MAHmkJ9tQfuUgjMmh03fBrnKXVf+Zq5KByhutr3qlpfY4VBlJWm9hjXUGqLUHkla1AX1upAMXG0c2aAe6WIeSZiFfKXHLkh4o6lZuQlftjQfMe3f6LahbTPXqq++DeKUmwkx+ArhmDwPhDwkSm3ytg7/mNb6qZxFmLX8uYlLRz2fR9oWM5iNZlCfLlnbU3oiuu1Nh0HNYAekkvR2vNzPY8p4/eSpJ0O9zO7jtzvO6dM1mDF0ySwewEdypPqNKuJNaSLcUxOeg1wqEmAHY1Ch/WQ4ckVxKwe+76lQ7NQZgRA== 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-SenderADCheck; bh=D3cdqVVMVzrZ51z3DnYBCLOaJK4D5V8Po4aGrs5n0GU=; b=i5ZTY7/24NDXqLaGpOie+oQK4vKThstxz0nIprpI1cb/twDUUBB5EtHjTePSq5kktDQMKSf+ehfmxBbXsa2mb/e9XH1CSmtuDxl5tV8ZxWUH60xTvyKMaRLAbAz/7ed20xaceCLsvvQKqRO70gyG50jOKpH7+vRWyjvNZ5yUBEviNbXHtCzRVnkqaS3E7yTagoGWU0lyVItRL5TfjP23XscLoE8t37/jKPu2LK7mSEtBqHlnVV7Lia9+n1ZkEVQQHH0wl+ZeGKRsmiAk6conTQ+5RKKl6iHbg/5i9o/i6Zk4C9w/IYbSC24rSQ6zWyrQ8yHSNTAtg6YGp2rpTIT1Dw== 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=D3cdqVVMVzrZ51z3DnYBCLOaJK4D5V8Po4aGrs5n0GU=; b=isJpxTQvFqBqJWlVo4eaiXA9OHbbfuPVLd7LUrKAlwQa8VKUU+Xe3WDrJnGIJjfyvV+/MrSv/KeApZYAtc/VEWyHRC5IELEk2SakNBmc1aCA8HgloG8EYdQrO7yKcUHq1I6+oGCoquStIgJhkNHlhm4KJjIIv+aral/QU3eG7hg= Received: from DM6PR17CA0005.namprd17.prod.outlook.com (2603:10b6:5:1b3::18) by DM6PR12MB5520.namprd12.prod.outlook.com (2603:10b6:5:208::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Mon, 19 Jul 2021 16:36:41 +0000 Received: from DM6NAM11FT006.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::67) by DM6PR17CA0005.outlook.office365.com (2603:10b6:5:1b3::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT006.mail.protection.outlook.com (10.13.173.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:41 +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.2242.4; Mon, 19 Jul 2021 11:36:40 -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.2242.4; Mon, 19 Jul 2021 09:36:40 -0700 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:36:31 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 09/12] ASoC: amd: add vangogh i2s dai driver ops Date: Mon, 19 Jul 2021 22:21:37 +0530 Message-ID: <20210719165140.16143-10-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7953545c-762c-4d30-7913-08d94ad36344 X-MS-TrafficTypeDiagnostic: DM6PR12MB5520: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:462; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WGQ15NEZT2nH4ElbYpHMD8N3ikRDHCs59Q7Evm/eV4ew8bMZTti1sfMNaWqVOx0EF7U9tIXVWqMLPS3QjDdGv+H99/f0mP5H3eSmRl33M4ReCRbdGSN9xKsn6IYaiGy0GViAiuGlRqsxebemLLAEhK5Z4wp7P2n0Aw+tCMYScDyb5j8B1p39MfdazFxAE8efbMiIwQqWOLS6uTD5WPam4YOKzoDJucRdqw6KQE3dtwO/b2qm8qyBKLjcjQjwEFk1O2GwXXsV9FkVEMjncmevWfA6nO2fCAwNbNWUTdGC2jz79g1tq5RIt4GnYFG6/kz9S/mlSEtlL0UR/bm+bOSZSAl6f8lU5oLRcQ+05meXwynM0h8vbxaECyAYAQ/GMaBeVxdSned2Un0mipm+ynR3PgF1Vg7+usTI+CEs1TOEUBnaEsriQCkDViTLEq33z9Vyp5aJQcAUThYCQvXqz9cBuxG0YIPgluYRj3hgXtIJWsgxEt1rxQJSOIMmu74FSbNsH9Tki+NY4xKCbTHCnPEwXSq2/RnyAcciSg+i4aHB+nOf0hq6a0n5pB7iiegAe48NZvnFKTH/rdLKmlowybYOfC+DTBLW/sJ75kNc85QoCBosZAEWQmSqob0xo6+oimLA6q5USJfONpFtID5vetsxIb+HR2BcQ7haVmCatSD16cui7ALzbdz9aj/qoZ63/2RCOpi6BEFN2PJ+u547kW53IXRWigRYuGqgpNbCaYidQHs= 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:(4636009)(396003)(39860400002)(346002)(376002)(136003)(36840700001)(46966006)(26005)(5660300002)(2616005)(316002)(44832011)(478600001)(186003)(1076003)(110136005)(7696005)(8936002)(47076005)(54906003)(336012)(36860700001)(86362001)(70206006)(426003)(82310400003)(2906002)(8676002)(4326008)(83380400001)(70586007)(356005)(36756003)(82740400003)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:36:41.2543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7953545c-762c-4d30-7913-08d94ad36344 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: DM6NAM11FT006.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5520 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Vangogh i2s dai driver ops. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-i2s.c | 339 ++++++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 22 ++ 2 files changed, 361 insertions(+) diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c index 93fd0372df29..313761df9053 100644 --- a/sound/soc/amd/vangogh/acp5x-i2s.c +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -17,6 +17,344 @@ #define DRV_NAME "acp5x_i2s_playcap" +static int acp5x_i2s_set_fmt(struct snd_soc_dai *cpu_dai, + unsigned int fmt) +{ + struct i2s_dev_data *adata; + int mode; + + adata = snd_soc_dai_get_drvdata(cpu_dai); + mode = fmt & SND_SOC_DAIFMT_FORMAT_MASK; + switch (mode) { + case SND_SOC_DAIFMT_I2S: + adata->tdm_mode = TDM_DISABLE; + break; + case SND_SOC_DAIFMT_DSP_A: + adata->tdm_mode = TDM_ENABLE; + break; + default: + return -EINVAL; + } + mode = fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK; + switch (mode) { + case SND_SOC_DAIFMT_CBC_CFC: + adata->master_mode = I2S_MASTER_MODE_ENABLE; + break; + case SND_SOC_DAIFMT_CBP_CFP: + adata->master_mode = I2S_MASTER_MODE_DISABLE; + break; + } + return 0; +} + +static int acp5x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, + u32 tx_mask, u32 rx_mask, + int slots, int slot_width) +{ + struct i2s_dev_data *adata; + u32 frm_len; + u16 slot_len; + + adata = snd_soc_dai_get_drvdata(cpu_dai); + + /* These values are as per Hardware Spec */ + switch (slot_width) { + case SLOT_WIDTH_8: + slot_len = 8; + break; + case SLOT_WIDTH_16: + slot_len = 16; + break; + case SLOT_WIDTH_24: + slot_len = 24; + break; + case SLOT_WIDTH_32: + slot_len = 0; + break; + default: + return -EINVAL; + } + frm_len = FRM_LEN | (slots << 15) | (slot_len << 18); + adata->tdm_fmt = frm_len; + return 0; +} + +static int acp5x_i2s_hwparams(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params, + struct snd_soc_dai *dai) +{ + struct i2s_stream_instance *rtd; + struct snd_soc_pcm_runtime *prtd; + struct snd_soc_card *card; + struct acp5x_platform_info *pinfo; + struct i2s_dev_data *adata; + union acp_i2stdm_mstrclkgen mclkgen; + + u32 val; + u32 reg_val, frmt_reg, master_reg; + u32 lrclk_div_val, bclk_div_val; + + lrclk_div_val = 0; + bclk_div_val = 0; + prtd = asoc_substream_to_rtd(substream); + rtd = substream->runtime->private_data; + card = prtd->card; + adata = snd_soc_dai_get_drvdata(dai); + pinfo = snd_soc_card_get_drvdata(card); + if (pinfo) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + rtd->i2s_instance = pinfo->play_i2s_instance; + else + rtd->i2s_instance = pinfo->cap_i2s_instance; + } + + /* These values are as per Hardware Spec */ + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_U8: + case SNDRV_PCM_FORMAT_S8: + rtd->xfer_resolution = 0x0; + break; + case SNDRV_PCM_FORMAT_S16_LE: + rtd->xfer_resolution = 0x02; + break; + case SNDRV_PCM_FORMAT_S24_LE: + rtd->xfer_resolution = 0x04; + break; + case SNDRV_PCM_FORMAT_S32_LE: + rtd->xfer_resolution = 0x05; + break; + default: + return -EINVAL; + } + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + frmt_reg = ACP_HSTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_ITER; + frmt_reg = ACP_I2STDM_TXFRMT; + } + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + frmt_reg = ACP_HSTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_IRER; + frmt_reg = ACP_I2STDM_RXFRMT; + } + } + if (adata->tdm_mode) { + val = acp_readl(rtd->acp5x_base + reg_val); + acp_writel(val | 0x2, rtd->acp5x_base + reg_val); + acp_writel(adata->tdm_fmt, rtd->acp5x_base + frmt_reg); + } + val = acp_readl(rtd->acp5x_base + reg_val); + val &= ~ACP5x_ITER_IRER_SAMP_LEN_MASK; + val = val | (rtd->xfer_resolution << 3); + acp_writel(val, rtd->acp5x_base + reg_val); + + if (adata->master_mode) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + master_reg = ACP_I2STDM2_MSTRCLKGEN; + break; + case I2S_SP_INSTANCE: + default: + master_reg = ACP_I2STDM0_MSTRCLKGEN; + break; + } + mclkgen.bits.i2stdm_master_mode = 0x1; + if (adata->tdm_mode) + mclkgen.bits.i2stdm_format_mode = 0x01; + else + mclkgen.bits.i2stdm_format_mode = 0x0; + switch (params_format(params)) { + case SNDRV_PCM_FORMAT_S16_LE: + switch (params_rate(params)) { + case 8000: + bclk_div_val = 768; + break; + case 16000: + bclk_div_val = 384; + break; + case 24000: + bclk_div_val = 256; + break; + case 32000: + bclk_div_val = 192; + break; + case 44100: + case 48000: + bclk_div_val = 128; + break; + case 88200: + case 96000: + bclk_div_val = 64; + break; + case 192000: + bclk_div_val = 32; + break; + default: + return -EINVAL; + } + lrclk_div_val = 32; + break; + case SNDRV_PCM_FORMAT_S32_LE: + switch (params_rate(params)) { + case 8000: + bclk_div_val = 384; + break; + case 16000: + bclk_div_val = 192; + break; + case 24000: + bclk_div_val = 128; + break; + case 32000: + bclk_div_val = 96; + break; + case 44100: + case 48000: + bclk_div_val = 64; + break; + case 88200: + case 96000: + bclk_div_val = 32; + break; + case 192000: + bclk_div_val = 16; + break; + default: + return -EINVAL; + } + lrclk_div_val = 64; + break; + default: + return -EINVAL; + } + mclkgen.bits.i2stdm_bclk_div_val = bclk_div_val; + mclkgen.bits.i2stdm_lrclk_div_val = lrclk_div_val; + acp_writel(mclkgen.u32_all, rtd->acp5x_base + master_reg); + } + return 0; +} + +static int acp5x_i2s_trigger(struct snd_pcm_substream *substream, + int cmd, struct snd_soc_dai *dai) +{ + struct i2s_stream_instance *rtd; + u32 ret, val, period_bytes, reg_val, ier_val, water_val; + u32 buf_size, buf_reg; + + rtd = substream->runtime->private_data; + period_bytes = frames_to_bytes(substream->runtime, + substream->runtime->period_size); + buf_size = frames_to_bytes(substream->runtime, + substream->runtime->buffer_size); + switch (cmd) { + case SNDRV_PCM_TRIGGER_START: + case SNDRV_PCM_TRIGGER_RESUME: + case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: + rtd->bytescount = acp_get_byte_count(rtd, + substream->stream); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + water_val = + ACP_HS_TX_INTR_WATERMARK_SIZE; + reg_val = ACP_HSTDM_ITER; + ier_val = ACP_HSTDM_IER; + buf_reg = ACP_HS_TX_RINGBUFSIZE; + break; + case I2S_SP_INSTANCE: + default: + water_val = + ACP_I2S_TX_INTR_WATERMARK_SIZE; + reg_val = ACP_I2STDM_ITER; + ier_val = ACP_I2STDM_IER; + buf_reg = ACP_I2S_TX_RINGBUFSIZE; + } + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + water_val = + ACP_HS_RX_INTR_WATERMARK_SIZE; + reg_val = ACP_HSTDM_IRER; + ier_val = ACP_HSTDM_IER; + buf_reg = ACP_HS_RX_RINGBUFSIZE; + break; + case I2S_SP_INSTANCE: + default: + water_val = + ACP_I2S_RX_INTR_WATERMARK_SIZE; + reg_val = ACP_I2STDM_IRER; + ier_val = ACP_I2STDM_IER; + buf_reg = ACP_I2S_RX_RINGBUFSIZE; + } + } + acp_writel(period_bytes, rtd->acp5x_base + water_val); + acp_writel(buf_size, rtd->acp5x_base + buf_reg); + val = acp_readl(rtd->acp5x_base + reg_val); + val = val | BIT(0); + acp_writel(val, rtd->acp5x_base + reg_val); + acp_writel(1, rtd->acp5x_base + ier_val); + ret = 0; + break; + case SNDRV_PCM_TRIGGER_STOP: + case SNDRV_PCM_TRIGGER_SUSPEND: + case SNDRV_PCM_TRIGGER_PAUSE_PUSH: + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_ITER; + } + + } else { + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_IRER; + } + } + val = acp_readl(rtd->acp5x_base + reg_val); + val = val & ~BIT(0); + acp_writel(val, rtd->acp5x_base + reg_val); + + if (!(acp_readl(rtd->acp5x_base + ACP_HSTDM_ITER) & BIT(0)) && + !(acp_readl(rtd->acp5x_base + ACP_HSTDM_IRER) & BIT(0))) + acp_writel(0, rtd->acp5x_base + ACP_HSTDM_IER); + if (!(acp_readl(rtd->acp5x_base + ACP_I2STDM_ITER) & BIT(0)) && + !(acp_readl(rtd->acp5x_base + ACP_I2STDM_IRER) & BIT(0))) + acp_writel(0, rtd->acp5x_base + ACP_I2STDM_IER); + ret = 0; + break; + default: + ret = -EINVAL; + break; + } + return ret; +} + +static struct snd_soc_dai_ops acp5x_i2s_dai_ops = { + .hw_params = acp5x_i2s_hwparams, + .trigger = acp5x_i2s_trigger, + .set_fmt = acp5x_i2s_set_fmt, + .set_tdm_slot = acp5x_i2s_set_tdm_slot, +}; + static const struct snd_soc_component_driver acp5x_dai_component = { .name = "acp5x-i2s", }; @@ -40,6 +378,7 @@ static struct snd_soc_dai_driver acp5x_i2s_dai = { .rate_min = 8000, .rate_max = 96000, }, + .ops = &acp5x_i2s_dai_ops, }; static int acp5x_dai_probe(struct platform_device *pdev) diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index fbd5cdf44cb8..a798f89416af 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -73,9 +73,20 @@ #define I2S_MASTER_MODE_ENABLE 0x01 #define I2S_MASTER_MODE_DISABLE 0x00 +#define SLOT_WIDTH_8 0x08 +#define SLOT_WIDTH_16 0x10 +#define SLOT_WIDTH_24 0x18 +#define SLOT_WIDTH_32 0x20 +#define TDM_ENABLE 1 +#define TDM_DISABLE 0 +#define ACP5x_ITER_IRER_SAMP_LEN_MASK 0x38 + struct i2s_dev_data { + bool tdm_mode; bool master_mode; unsigned int i2s_irq; + u16 i2s_instance; + u32 tdm_fmt; void __iomem *acp5x_base; struct snd_pcm_substream *play_stream; struct snd_pcm_substream *capture_stream; @@ -108,6 +119,17 @@ struct acp5x_platform_info { u16 cap_i2s_instance; }; +union acp_i2stdm_mstrclkgen { + struct { + u32 i2stdm_master_mode : 1; + u32 i2stdm_format_mode : 1; + u32 i2stdm_lrclk_div_val : 9; + u32 i2stdm_bclk_div_val : 11; + u32:10; + } bitfields, bits; + u32 u32_all; +}; + /* common header file uses exact offset rather than relative * offset which requires substraction logic from base_addr * for accessing ACP5x MMIO space registers From patchwork Mon Jul 19 16:51:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386299 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E85EBC07E95 for ; Mon, 19 Jul 2021 16:39:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 702416023F for ; Mon, 19 Jul 2021 16:39:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 702416023F Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 17541165E; Mon, 19 Jul 2021 18:38:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 17541165E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712764; bh=PR5ASM4q+HRQe63kCfiLiEjvqgbjhyCeXfViwZjv8lg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JtWenXjXRagD8962L1V6NfcpvBMXtzCUIZuRqS7oZsQ0idOyjhB2g2A5mU5Y39rEh NzEsSG36rP4OeygTNvfCNb/NQ0b8iXZ55YNSB/axbj3ErdTffUASCswqT1Vkr+DqRz h0aU/TDCRflaAKfu0bHtcvFJQFkr5oWxWIsSUZ9I= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2CE07F804E5; Mon, 19 Jul 2021 18:37:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6C3BDF8050F; Mon, 19 Jul 2021 18:37:06 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2059.outbound.protection.outlook.com [40.107.236.59]) (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 7A704F804D0 for ; Mon, 19 Jul 2021 18:36:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7A704F804D0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="PS/q4SUR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mYyTiSk3RUBkhQVXS5iT8AnWoFVdoojV5MrTQ74tFclluuC5QaBLtx1T1/v5HrGDhSYEBsgZ4sG+Sm/uDFsAt2NNAT5SYH7bJX4ZXSMAB1G5z+haRhsvr+MmUQZwCbtjsR3L5Unm99EC/gMBNS1TuiUhVwGaISaeIRmuJzi0G9TiG0hmn+7Z14Blji6IQi2/7gtGd1PIXnqhgAz0rvttEznPjrw8QqFedI1pEQH5l/Tc7NhciahA5Tyk6iqmFnN0+N2VuqD00HeczjeSNbEnJgphvC2i7b9qUAUgrJpDROotOp3PF5eY5fkeCeCuWqO33FQoSZS5/oL3x8kh93C/Iw== 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-SenderADCheck; bh=jzweO5aHJ6u0lcRGN9/URZ7qHzpwtiDPqwAmbkVNQks=; b=N9hcB8/D5YJxXNa8aDPurrkjzczpu+c/wVK0Y0SrZfUtcyTRZk+TuJRA8XMQvX+MOa+nxlmB7Rd1mjJPlyiFaV6MLhz3s/3jpmLuAYI79z1Frec34fwVIjAlPgLlay6m/RP0UZr791d9009NY7hOoYXIzx+ILzw8dVaLKOVuXGc2F2OaiuCCZyfSwVNAPQuwIIEzuo/SQ/23/+/94G3CbCEbs9U7wRXsKKX1oOhJ+oaJbjiQE39TwJG4nghOcu/Iq7VfOTPqJtNNkKO+CDjb2IOz5++kieinje3Oi7DzeGU8un5eOCZVzuTNwc0r6Zb0NVvDoqXcqcRqphq9Tq4l+w== 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=jzweO5aHJ6u0lcRGN9/URZ7qHzpwtiDPqwAmbkVNQks=; b=PS/q4SURsblYucmkH3OSHkwJ+eUmG6/79qDzRRqm5eYY3OeuoRQ+E4Q8aQrImvzmqxP2P1D8lmNNVZTAHz66QBn4MZhcIv/zLVmzW4KLPr6pVuNWAXe9/kUaQboY49ISPnQU5K32FdyGcCwcjrN5r+Sm8QUT7KvxQ7/HS00dRuQ= Received: from DM3PR11CA0010.namprd11.prod.outlook.com (2603:10b6:0:54::20) by SA0PR12MB4591.namprd12.prod.outlook.com (2603:10b6:806:9d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Mon, 19 Jul 2021 16:36:54 +0000 Received: from DM6NAM11FT015.eop-nam11.prod.protection.outlook.com (2603:10b6:0:54:cafe::77) by DM3PR11CA0010.outlook.office365.com (2603:10b6:0:54::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Mon, 19 Jul 2021 16:36:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT015.mail.protection.outlook.com (10.13.172.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:36:54 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2242.4; Mon, 19 Jul 2021 11:36:53 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:36:44 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 10/12] ASoC: amd: add vangogh pci driver pm ops Date: Mon, 19 Jul 2021 22:21:38 +0530 Message-ID: <20210719165140.16143-11-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 565c333b-14e4-48ce-2d8a-08d94ad36b1c X-MS-TrafficTypeDiagnostic: SA0PR12MB4591: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Pz/0YOeqBnMUaC1GNU9r7h539wNwvfAobSL5sTw+3cJLN8lboR4NMdzIrUFiGHTX+hqeP7EAyVfppON/fKNVdqJGiQo98tAkqOMX5KlzhopsekjGnSYAwfXAXqqeSZJd0DKAKy+jtGcqGMmhpqyhM1qMnb6/1wHo9Jb4QSrUPkLB+ZXBSNe3szde01DXb1pyxZ/ltiNCTgHCuOjk1lyKKOEcaLZkFnMqAOqBhek3BR6VdPqKJFp97uVYwZdnMMAFGxJNBg3EuturL0DlrSeAMVwESuPDLOc/ik0AlvNL2slBQJwKM18xS8Ko6vqQi6K77Jbty9y60XwFft2NurYxehpxbnkMiGsnYwvIIzWRtmOTnMFVZZU1ZQop3c4OktmBmF4YQmt/AhxpR075LW636z1I3kjw12wxfD3JvIr4SNL00ui5wPDx1ttiFMcIhOi5d6R4GtgQL0QDu9RNVPUFAmTzV9jsAl3QvlwP52j0kabP73LxxVj2KmAKb0ZfTGj4scjueiKeAOsHewkoKp4MBvoszp2c+dgfnyDIxPYKiu/PDMegUAVe3nTURKUfyQy5wbrS9OhLTIJzHIEzZMZWWO0FxsP433loMl5pLlViCtOs1crhroasIGxfW/Rmd+b4QcN1oVTzj8qmVZ2/+UeM9ipDI2plgCDgh2QQ7TphitDo9U1kpEoR4/KMFxU2xb+Q8qcbIBlP0tgwBW2bYyh5hccsshcT8otHbTg1yYZHSts= 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:(4636009)(39860400002)(376002)(136003)(346002)(396003)(46966006)(36840700001)(478600001)(82310400003)(54906003)(83380400001)(1076003)(26005)(70206006)(70586007)(36756003)(36860700001)(186003)(6666004)(7696005)(81166007)(44832011)(2616005)(8676002)(47076005)(336012)(356005)(4326008)(8936002)(426003)(316002)(110136005)(5660300002)(2906002)(86362001)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:36:54.4050 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 565c333b-14e4-48ce-2d8a-08d94ad36b1c 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: DM6NAM11FT015.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4591 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Vangogh acp pci driver pm ops. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/pci-acp5x.c | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sound/soc/amd/vangogh/pci-acp5x.c b/sound/soc/amd/vangogh/pci-acp5x.c index 3cc15a15b745..844614c758d9 100644 --- a/sound/soc/amd/vangogh/pci-acp5x.c +++ b/sound/soc/amd/vangogh/pci-acp5x.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "acp5x.h" @@ -226,6 +227,10 @@ static int snd_acp5x_probe(struct pci_dev *pci, default: dev_info(&pci->dev, "ACP audio mode : %d\n", val); } + pm_runtime_set_autosuspend_delay(&pci->dev, 2000); + pm_runtime_use_autosuspend(&pci->dev); + pm_runtime_put_noidle(&pci->dev); + pm_runtime_allow(&pci->dev); return 0; unregister_devs: @@ -243,6 +248,41 @@ static int snd_acp5x_probe(struct pci_dev *pci, return ret; } +static int snd_acp5x_suspend(struct device *dev) +{ + int ret; + struct acp5x_dev_data *adata; + + adata = dev_get_drvdata(dev); + ret = acp5x_deinit(adata->acp5x_base); + if (ret) + dev_err(dev, "ACP de-init failed\n"); + else + dev_dbg(dev, "ACP de-initialized\n"); + + return ret; +} + +static int snd_acp5x_resume(struct device *dev) +{ + int ret; + struct acp5x_dev_data *adata; + + adata = dev_get_drvdata(dev); + ret = acp5x_init(adata->acp5x_base); + if (ret) { + dev_err(dev, "ACP init failed\n"); + return ret; + } + return 0; +} + +static const struct dev_pm_ops acp5x_pm = { + SET_RUNTIME_PM_OPS(snd_acp5x_suspend, + snd_acp5x_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(snd_acp5x_suspend, snd_acp5x_resume) +}; + static void snd_acp5x_remove(struct pci_dev *pci) { struct acp5x_dev_data *adata; @@ -256,6 +296,8 @@ static void snd_acp5x_remove(struct pci_dev *pci) ret = acp5x_deinit(adata->acp5x_base); if (ret) dev_err(&pci->dev, "ACP de-init failed\n"); + pm_runtime_forbid(&pci->dev); + pm_runtime_get_noresume(&pci->dev); pci_release_regions(pci); pci_disable_device(pci); } @@ -273,6 +315,9 @@ static struct pci_driver acp5x_driver = { .id_table = snd_acp5x_ids, .probe = snd_acp5x_probe, .remove = snd_acp5x_remove, + .driver = { + .pm = &acp5x_pm, + } }; module_pci_driver(acp5x_driver); From patchwork Mon Jul 19 16:51:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B37F8C07E9B for ; Mon, 19 Jul 2021 16:39:43 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCACA60FE4 for ; Mon, 19 Jul 2021 16:39:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CCACA60FE4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 543081614; Mon, 19 Jul 2021 18:38:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 543081614 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712781; bh=l1s6JxMerMvwOX7gUHqfvGu6PT+9hLlOdo4J/s+JqxE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ByjRsI4shFqGIIjGCO8P7C74czxdp028L5fFIXJixgdX8gNi4ByUJtJlFL0mGfyMl xG3dJS1SJZBAOI8OkRyyQfSjYh5LG7c0gFIka5LKYPKpDtNKmk9LBJ19XqRAgLaFGS VapW4fpF/L7uZ1mmBN7wq3QAUQZ28gX8jf+V3ZZ0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D9BFCF804E0; Mon, 19 Jul 2021 18:37:16 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1792BF80510; Mon, 19 Jul 2021 18:37:16 +0200 (CEST) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08on2078.outbound.protection.outlook.com [40.107.102.78]) (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 9FE6CF804E0 for ; Mon, 19 Jul 2021 18:37:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9FE6CF804E0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="lMvADkTT" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=INAv05iudmG1duWjiMQr6ktbF/aldHnOv5h7LMbGtLitOiC3lrEpYU6OK+G1WMUt4JnEhZpAAc6XOHMA9CnceB4gAlBLFWIyxlomKEYDbOh8qCbCEj/sTupcLVb/H+iTZzUU6oZZ7QYBL6605EiEhJKVLB3syBd4nhvH5w5r/w0yHBWXRZPL6A8U3yNzSFdPRCF9/q1vIIkucNf4OnGievKAgPSp0K5WAb18IlylOjT61U6Zfxs2afN7YhvwJ/Mah46jnvTF9JEvkifu07rLW+D+TMoPBweSALD4PqY0MvdtKlDKTf/Y7GFMVGAvUhlulzJVWGC73zg/qypWINmS4w== 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-SenderADCheck; bh=xZEF2JRkAVbKFJI/YNtTTk3UBubzBxXN/w5gaswdT9g=; b=KhhUP6bCDIUwSJqMPIJudQEt7fz5OiLxxetRVLBmYmHumlcxucdJKeWsoKhQxkYc7+2SRIYaVkTVa3ogmbYEUee7PJ838Ih2r6NZzMTiohwa0d7LSWz+yiPhh3l8aMWeh5vIYjmyhUuhKo/T1ROzUGHQJLdfKS64i21UEOn18aB+WwJuw5yBbNeQ0Ce3J58IL6I4z2RgFCfRcZhQATnJn3AqoFKiQpa0/MlP8IppH8i+GHAJfz9mvFteyVAGvfEykjVji28kp7KmtDrAbIxU8DALQ5Uuo51wWTdJMoqALO40nyY/NquGkmWTBDIA26aIToEK9583qGXVMQvwPKAcog== 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=xZEF2JRkAVbKFJI/YNtTTk3UBubzBxXN/w5gaswdT9g=; b=lMvADkTTg0fBXDbcy6lDeCrFu6ZCRXblDxL/jtjevRrsPU75t0MNxFWFtq452vmCvCAZhyKHi83Xa+q19SswTdcAUjUorrN8tYIrwpDrwlIM2EsMSk7r3hR4AbRDyrC3muR5yi4WBkqizh4VPBpCITmyebz6lV2EGP1OekuLYGo= Received: from DM6PR06CA0102.namprd06.prod.outlook.com (2603:10b6:5:336::35) by BN9PR12MB5066.namprd12.prod.outlook.com (2603:10b6:408:133::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Mon, 19 Jul 2021 16:37:08 +0000 Received: from DM6NAM11FT065.eop-nam11.prod.protection.outlook.com (2603:10b6:5:336:cafe::95) by DM6PR06CA0102.outlook.office365.com (2603:10b6:5:336::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Mon, 19 Jul 2021 16:37:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT065.mail.protection.outlook.com (10.13.172.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:37:07 +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.2242.4; Mon, 19 Jul 2021 11:37:06 -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.2242.4; Mon, 19 Jul 2021 11:37:06 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:36:57 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 11/12] ASoC: amd: add vangogh i2s dma driver pm ops Date: Mon, 19 Jul 2021 22:21:39 +0530 Message-ID: <20210719165140.16143-12-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 900ae299-cefb-44e5-c50f-08d94ad372f1 X-MS-TrafficTypeDiagnostic: BN9PR12MB5066: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:346; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HI6tHzYcs9BmUJkjhGb4UF/M81WT5q4X20+Zxf79+kZUniwCY+hRh92tkb2puzs2UAEXqJo4fe9qkVWPXkRFHJ19vh9JXc+xiOFlP1E4WcZkD5Ej5k6Azzjcg/rkOVmZPkxIuSBny1mUCoF82XbsFDPOcmn+y4YX8PozwcPK5vKrQwwT5R0qoRyepbbl7W3y3x4VyJMT099PTHAlkcgrdtNdgt7rFqBwebxH7KvwFFqlGw5fTqE4Il2QK4pZ+PmeAKjqZQydlvJBuSh5nk8DKapMOGl0zb5jFJPl9uajKNT8bcdSjkkm3sxwwKsi0IR+nvFOYsz7q/DzUL7eRCk+pCnQ1JiBzJSvldNin9kRhkLLM81EMK6AyWp6DyFjFLnwMVnsU+Ok0jZfesCi15lrGkMPHosVPfYcpmd5Rmz1QHjSVsZarmpp7mVWtmiiaNCAhw4REgd04yigVOK2EWMMmG728xOM2MP+wYHSSVIZWE8yHx8fpUaDDvbCm66RgQxMVgKwO08dIcApsSgqlk7nbuP2tlZl0ta0XKv3qXwfeXWQqHpT1smtTb96msa77ePnjVUbnGVkPX+mDd+M9fF2SsPcepaLDa8FYyM1DNWQajPOH8cypOm8B1+zCllhfngJpJRzCnPMWy1SrntrYwG8lhSL95q/JSG+WlbFZER5JKjXvmqGQ0x6SMetouHNgZi6EQZKoAunmbKk74ZcdM4IScKb85342uP0ZMcCPy9yxa4= 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:(4636009)(39860400002)(396003)(346002)(376002)(136003)(46966006)(36840700001)(81166007)(47076005)(26005)(82740400003)(4326008)(70206006)(2906002)(70586007)(110136005)(186003)(316002)(478600001)(86362001)(54906003)(82310400003)(8936002)(2616005)(8676002)(1076003)(356005)(5660300002)(44832011)(426003)(36860700001)(336012)(7696005)(6666004)(36756003)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:37:07.5638 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 900ae299-cefb-44e5-c50f-08d94ad372f1 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: DM6NAM11FT065.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5066 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add Vangogh i2s dma driver pm ops Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 90 +++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index a2bd53dc86b9..260b6ae0fb2f 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -417,13 +418,102 @@ static int acp5x_audio_probe(struct platform_device *pdev) dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); return -ENODEV; } + pm_runtime_set_autosuspend_delay(&pdev->dev, 2000); + pm_runtime_use_autosuspend(&pdev->dev); + pm_runtime_enable(&pdev->dev); + pm_runtime_allow(&pdev->dev); return 0; } +static int acp5x_audio_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + return 0; +} + +static int acp5x_pcm_resume(struct device *dev) +{ + struct i2s_dev_data *adata; + u32 val, reg_val, frmt_val; + + reg_val = 0; + frmt_val = 0; + adata = dev_get_drvdata(dev); + + if (adata->play_stream && adata->play_stream->runtime) { + struct i2s_stream_instance *rtd = + adata->play_stream->runtime->private_data; + config_acp5x_dma(rtd, SNDRV_PCM_STREAM_PLAYBACK); + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_ITER; + frmt_val = ACP_HSTDM_TXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_ITER; + frmt_val = ACP_I2STDM_TXFRMT; + } + acp_writel((rtd->xfer_resolution << 3), + rtd->acp5x_base + reg_val); + } + + if (adata->capture_stream && adata->capture_stream->runtime) { + struct i2s_stream_instance *rtd = + adata->capture_stream->runtime->private_data; + config_acp5x_dma(rtd, SNDRV_PCM_STREAM_CAPTURE); + switch (rtd->i2s_instance) { + case I2S_HS_INSTANCE: + reg_val = ACP_HSTDM_IRER; + frmt_val = ACP_HSTDM_RXFRMT; + break; + case I2S_SP_INSTANCE: + default: + reg_val = ACP_I2STDM_IRER; + frmt_val = ACP_I2STDM_RXFRMT; + } + acp_writel((rtd->xfer_resolution << 3), + rtd->acp5x_base + reg_val); + } + if (adata->tdm_mode == TDM_ENABLE) { + acp_writel(adata->tdm_fmt, adata->acp5x_base + frmt_val); + val = acp_readl(adata->acp5x_base + reg_val); + acp_writel(val | 0x2, adata->acp5x_base + reg_val); + } + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static int acp5x_pcm_suspend(struct device *dev) +{ + struct i2s_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp_writel(0, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static int acp5x_pcm_runtime_resume(struct device *dev) +{ + struct i2s_dev_data *adata; + + adata = dev_get_drvdata(dev); + acp_writel(1, adata->acp5x_base + ACP_EXTERNAL_INTR_ENB); + return 0; +} + +static const struct dev_pm_ops acp5x_pm_ops = { + SET_RUNTIME_PM_OPS(acp5x_pcm_suspend, + acp5x_pcm_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(acp5x_pcm_suspend, acp5x_pcm_resume) +}; + static struct platform_driver acp5x_dma_driver = { .probe = acp5x_audio_probe, + .remove = acp5x_audio_remove, .driver = { .name = "acp5x_i2s_dma", + .pm = &acp5x_pm_ops, }, }; From patchwork Mon Jul 19 16:51:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 12386303 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37858C07E95 for ; Mon, 19 Jul 2021 16:40:06 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A81660249 for ; Mon, 19 Jul 2021 16:40:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A81660249 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 330311679; Mon, 19 Jul 2021 18:39:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 330311679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626712804; bh=iy4xRVXga84oImz9jVdHrtkFLcRK5j9sgu/e92x2gbA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=sAoXJMrcXusiRAdaPw9YAoS/piPLeTHGwR670PsZ4p6weQjGymUzMhgifV03gncIW NQbAnNbL0PMg15rKt1xwvx3qAqiByzeOPfY7KFqFJyZKd37O9/otOU0KPVS+YTIBZw 198cXJFo8WCQSpXPzEnkio9QUwPIi/tICW+1rxeY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 75C88F804EC; Mon, 19 Jul 2021 18:37:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F3140F804F1; Mon, 19 Jul 2021 18:37:36 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2063.outbound.protection.outlook.com [40.107.236.63]) (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 08991F80227 for ; Mon, 19 Jul 2021 18:37:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08991F80227 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="5OH0hhO3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mCEi9WBwo4YR+8QTUOgHFDHKKfl3FtWbzi+mJl34HdtUCbM84LhtoF3dOer61xN1B3MU38YjpFW7icjdsGHiiLayWPlbO7Z2xcwSkHXBy2gAJPOwkaDp/jpabi/iv0Fvv6qukEIITc6ZmUl5aWNrCve2PsRtRrlK7JaP/dagmJUbVoHA9Od7ZhrntX/zaU1Ju+02+//Ll0EXcZgeZPZjCOAQ3bl5vHB5cTVgCl1sn1H0DW2C+M/BSRPOsVocT94IErDTDKKtGrXxqa8oe9a61SE1qD1AncPLBMjtpkywLSNOU1FTL4DEwfGv+XDtWtDpe/39nWwf+jiaiFzjKkpOTw== 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-SenderADCheck; bh=itoC+dU7JqRwv4JQILTVtQf6KRWj2ygEKdHZk2k/eoY=; b=REEBaP6yd/vbVL/nkml5r0IkliCI1TO9SkeZJZnic6ebvhOmTtRj2K04QZPAc1GEYj2xmaIM0X5nk8nwGbES1b0wESMQfmRE3Rn9a/ga5eNPG7BSeEqUZvNNPhSserMrigsxy4zo8qu8a/HG/l2UJJmK1qRucMrd9m0bl4OANpO00bXHxMohmg2L6fSk23KWieozFIvwAfzbiTbEGB99pkFPGUF1K4B0TscEoUp+Esw3OkdIU/07wOdjLzjV9ww3be6qwGs7l8en0SDgSoHXD6Ql+vNfThm7C5TkRa2p5RGsv0wjS3dIzNB6ufWYsvgAXVbSjC0zInscH0N+fC4JmQ== 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=itoC+dU7JqRwv4JQILTVtQf6KRWj2ygEKdHZk2k/eoY=; b=5OH0hhO3NAftOjqJzYOV4Xcpm3HoC4CC/ylXjkWIFMUJNGnX6TOtyvRSsrHhXetFy68iilA3uV1t4ZBloQWEGwQx29yNINYnFoXUtJ0Jd4m7b+aSaKEXTChXwdeYwuGQHrDIP1gSy89UlcrwF8vZEsegdSEy3appiyiBvEqWMjM= Received: from DM5PR16CA0005.namprd16.prod.outlook.com (2603:10b6:3:c0::15) by DM6PR12MB3178.namprd12.prod.outlook.com (2603:10b6:5:18d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 16:37:25 +0000 Received: from DM6NAM11FT037.eop-nam11.prod.protection.outlook.com (2603:10b6:3:c0:cafe::1c) by DM5PR16CA0005.outlook.office365.com (2603:10b6:3:c0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:37:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; 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; Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT037.mail.protection.outlook.com (10.13.172.122) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Mon, 19 Jul 2021 16:37:25 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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.2242.4; Mon, 19 Jul 2021 11:37:24 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 19 Jul 2021 11:37:24 -0500 Received: from LinuxHost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2242.4 via Frontend Transport; Mon, 19 Jul 2021 11:37:15 -0500 From: Vijendar Mukunda To: , Subject: [PATCH V3 12/12] ASoC: amd: enable vangogh acp5x driver build Date: Mon, 19 Jul 2021 22:21:40 +0530 Message-ID: <20210719165140.16143-13-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210719165140.16143-1-vijendar.mukunda@amd.com> References: <20210719165140.16143-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc8681c0-2373-4ad9-2e33-08d94ad37d80 X-MS-TrafficTypeDiagnostic: DM6PR12MB3178: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j6vrcZ68Tv3xz24aNPCZnEYTiNuIej5sW9Z1pXeMX57gBOX3JG2k0sWI2X/qt+nSWWXBlGiUfJgUb+mSW3/LMMrFIsoIAiJyi+qpTiZkIDv/5dA1eCs8yBHFtos5HMygZxR5bYU9Db5oNU44dUcKAjFrgSN4krkBpMqLLN7yg2WpkgPBNWa9sL/HjjvP/8tbEuH+VVOiZlY9Dvolngbw/56l0f+GxzPy1BD/uc+wKeT71/AHzkDqP/Ln3w+8TwM2xiC7rVYoEqfPnGu/MLJzIfIJYD1Fkk/NUFbrt0PgLR+d4DXbUIcnP2UP3DSxqWUU3ytwJ4oCw0CVv36Ji/eTk5TEIW1H0yJyUDTaMOZRjIwIEKfP3Ovwk3MRLFzrNM9YfkTiROqY6luaWz9eBv4frK4XMCIbuzE1GWQCwsoi8rYoWWRx3YA1cbjyG6ar5bA2A0ObOusjg3g0efhiBGe2WxP3lKNa0dE81LxGmZVegr2KGsOnwZWD3gM67FIN0PRAqVUB+rTkX0C/qRp+Na0E7L7oquJqubnXLLeZ1dI/Aw4B2QXNNaqG9F5Pp5uNDVo5+4YcXx6jMmK+Y+09pTAm7/E6n8kVwt9vsLgiOt9UIbMJ0uGmwkGXKTB0GWAJ8miTu9eljihebJI3dCnBOHXdIXfq7JFMUN45yH5fgQaNqn4fLjNk6nJl+ik5JHz1mvZD7sx24peSNzyBq3wGu81RNcT9xatrlHLSbrJK+i5QX/wSmgfNQUyYE8Mp7LEV7TDCNPvXR3MIwhqszdB+F9wPjQtPUA9SMCSmNAxGHKq133Q= 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:(4636009)(136003)(346002)(39860400002)(396003)(376002)(36840700001)(46966006)(336012)(70206006)(186003)(70586007)(6666004)(86362001)(478600001)(7696005)(81166007)(356005)(54906003)(47076005)(26005)(110136005)(2616005)(36860700001)(5660300002)(36756003)(426003)(316002)(2906002)(1076003)(82740400003)(82310400003)(4326008)(8936002)(8676002)(44832011)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2021 16:37:25.2493 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fc8681c0-2373-4ad9-2e33-08d94ad37d80 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: DM6NAM11FT037.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3178 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , Ravulapati Vishnu vardhan rao , Vijendar Mukunda , Alexander.Deucher@amd.com, krisman@collabora.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Vangogh ACP5x drivers can be built by selecting necessary kernel config option. The patch enables build support of the same. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/Kconfig | 9 +++++++++ sound/soc/amd/Makefile | 1 + sound/soc/amd/vangogh/Makefile | 9 +++++++++ 3 files changed, 19 insertions(+) create mode 100644 sound/soc/amd/vangogh/Makefile diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig index ba5a85bf7412..cc48d4e5b080 100644 --- a/sound/soc/amd/Kconfig +++ b/sound/soc/amd/Kconfig @@ -52,3 +52,12 @@ config SND_SOC_AMD_RENOIR_MACH depends on SND_SOC_AMD_RENOIR help This option enables machine driver for DMIC + +config SND_SOC_AMD_ACP5x + tristate "AMD Audio Coprocessor-v5.x I2S support" + depends on X86 && PCI + help + This option enables ACP v5.x support on AMD platform + + By enabling this flag build will trigger for ACP PCI driver, + ACP DMA drvier, CPU DAI driver. diff --git a/sound/soc/amd/Makefile b/sound/soc/amd/Makefile index e6df2f72a2a1..07150d26f315 100644 --- a/sound/soc/amd/Makefile +++ b/sound/soc/amd/Makefile @@ -10,3 +10,4 @@ obj-$(CONFIG_SND_SOC_AMD_CZ_RT5645_MACH) += snd-soc-acp-rt5645-mach.o obj-$(CONFIG_SND_SOC_AMD_ACP3x) += raven/ obj-$(CONFIG_SND_SOC_AMD_RV_RT5682_MACH) += snd-soc-acp-rt5682-mach.o obj-$(CONFIG_SND_SOC_AMD_RENOIR) += renoir/ +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += vangogh/ diff --git a/sound/soc/amd/vangogh/Makefile b/sound/soc/amd/vangogh/Makefile new file mode 100644 index 000000000000..3353f93dc610 --- /dev/null +++ b/sound/soc/amd/vangogh/Makefile @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Vangogh platform Support +snd-pci-acp5x-objs := pci-acp5x.o +snd-acp5x-i2s-objs := acp5x-i2s.o +snd-acp5x-pcm-dma-objs := acp5x-pcm-dma.o + +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-pci-acp5x.o +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-acp5x-i2s.o +obj-$(CONFIG_SND_SOC_AMD_ACP5x) += snd-acp5x-pcm-dma.o