From patchwork Wed Jul 21 18:04:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483359 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=unavailable 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 3E59FC636C9 for ; Wed, 21 Jul 2021 17:48:36 +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 3A99661246 for ; Wed, 21 Jul 2021 17:48:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A99661246 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 C210A16F9; Wed, 21 Jul 2021 19:47:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C210A16F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889713; bh=SBzCfSjj3arVUro8NtiG90g+pi0dq0uUa++dXTjfA4M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OlHPD+6xxgZhQsUfy30CX09wGT2d54H0vPlDgFcJ0Y/P9q7npJdMpARDJhPkVO75b iLQhE9LtmgzMNWUjHemB3fidPOjIPqp+lfFaz2FgZCKD0tkwFdIuSMufTEWfrGZQRg JoRhQPpyULnimwP0sLa4+B5FbvAplW+QptsYtSqc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 60644F804AB; Wed, 21 Jul 2021 19:47:43 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EF977F804AF; Wed, 21 Jul 2021 19:47:41 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061b.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::61b]) (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 06F2DF80143 for ; Wed, 21 Jul 2021 19:47:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 06F2DF80143 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="jbg0uWvC" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lta4N5cOf5M08aN9d1MiAAsCI8QzknEi/DnYVwa1ZyhkFLPMPkgzhxKomJOpXrBNTTqMEu0tSbMkf/F2XPZeaD/4q3wYNfKzCMjSSW+Ue7I+Rxm9Rx3dcyMMB8nOeoEziqFVH+gtNgQKj7UhhzE/anvNrRnKY10l9zaD8+Xe9K0NX6NjGQMo4Or1ltFZnmN6QbvJQOsEzHgMh27hqHy8VTr4JX/yxaax7zgQ5u8UVrLlcoOqsJpvBVOCCSjuvLg6WD4d3STbHMGJlXzo8MkQ69oXw+BQP97PiLYTnKF0mx1ao/FYVnAGJ1LGGOXNMF8xM+Wmkydzkeo04jCU9GXzow== 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=wp27UtmPuRjLTxZY/PTE7UgNN1DeolOhhBK8XMIxSvc=; b=ZZYgu0IDcpd5c2m3iEPK5rq6oIWMnR4FBs8Q9PjvCOl3pcMxojSjeAfpLKnMkhe15y9b30px3GN12K/DNyy21cyHieNSKt60u3BzbERfhUHl3GyJ2mUNptrl/MfWJOHF5rl1CyCitrneBjaoLBXRcXUHXkK9HVdm9vV9kojP6uXizeObe/3QQKJazkGntWuO9JGRUTgVHHEqZ8PTMgYKTbxCOGpMe+7UjpV36+6wabHTfOmNywJvQRj38dB8Lb2p2XdX0OMnt2rleXQKLwBWSGceOocb/6nazeMbMXvlN8rGg0pdtvB0Nzcy955DD/BBQRE9UZB2LRvuya73eQtVqA== 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=wp27UtmPuRjLTxZY/PTE7UgNN1DeolOhhBK8XMIxSvc=; b=jbg0uWvCYxTOQiZAe5IU+uaj02wNc2DU8iQCSzkrtcPhfXFb1TWmsynBjbWtGnaKPa3jAv89FOQeXQ7j2oGBymNGQ3HO4NugrzxlLGjQ7TO90kesOylJI+BQPo//nxC+QP7d8BJVE5E7L6CGgRtrKWr2Tkz0jNIn0FRLD6JMvVs= Received: from BN9PR03CA0984.namprd03.prod.outlook.com (2603:10b6:408:109::29) by CH2PR12MB4280.namprd12.prod.outlook.com (2603:10b6:610:ac::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24; Wed, 21 Jul 2021 17:47:27 +0000 Received: from BN8NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:408:109:cafe::72) by BN9PR03CA0984.outlook.office365.com (2603:10b6:408:109::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:47: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=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT036.mail.protection.outlook.com (10.13.177.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:47:27 +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; Wed, 21 Jul 2021 12:47:26 -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; Wed, 21 Jul 2021 12:47:22 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 01/12] ASoC: amd: add Vangogh ACP5x IP register header Date: Wed, 21 Jul 2021 23:34:17 +0530 Message-ID: <20210721180430.11571-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b6e8cc9c-b1fc-4766-2ebd-08d94c6f9ade X-MS-TrafficTypeDiagnostic: CH2PR12MB4280: 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: bjMPbOHPt7jfqZxg4U+KFLu5EymWm9s0fFrdqDObhE/7/W7JLScGUKYxyr4I48hKxqKUHdeJ1Aqhstk+5ZlAqF382MNte6YsaKb6ZU9c65DaHZKuVV1FEOwnyCB6y9In+81BcG1Kc+7v2bFDNmAiwJbmDztbYeQOtX3HtG7jPUYmyR+7FzaLBb7XaYopbZAiBrpMepQNrD0ABdCX/avEZE1XFt5heZBa6NgClx3Eyz39gqV6dh/11oo+wN02ApYeDO/GK7ytxOOOAo2pNrwKnNMvuAUMisTZzulxXyjaSLUWi/yewOJ2HPYu/REO2nCHYzZdqVOCHp0Ozf5CJbsMMjXjv6nvCmxsNHxqHUcxqOMiArKTQxZJelHcB41MUhV7n+nNRXtwJiZXiJvl9mmJGjZuTOfHI8M7JVbzuOIVgNlMXfnrzfsM8MTzOYbg4nGxiA4NDDzgjJMsW36/b4uyvGSGJj44r82UXZg8+I9sgk+ZB3kA13PqGUMCLaiEl3MuIM/XmbP1rvikfd3YMBmFa5dzH4pUiMNpxm6YW8FYyR6SPpWDabJ5+yzXuMCMKxpGBqaFWabEYsQ3VLI2VlY5NI97rs9x1Q2a5IgQbQmAmA88sGfV4RKeQmO9h6Yx7KjHbadP1GgygleiF+AWuyBCtQJpb3Ltu5QSSh68ErMgnVZc+RlOUOlnDpPJdu+eausGwzHbDGIaLj330cjnCIa1TzQ+OO70hOUe1YGHRxDOXjspzs/8qs+rTKXxvAZ76KjR 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)(346002)(136003)(376002)(396003)(39860400002)(36840700001)(46966006)(86362001)(36756003)(7696005)(82740400003)(54906003)(47076005)(83380400001)(356005)(5660300002)(26005)(1076003)(30864003)(2906002)(336012)(8936002)(186003)(8676002)(316002)(81166007)(426003)(2616005)(36860700001)(70586007)(6666004)(82310400003)(110136005)(70206006)(478600001)(4326008)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:47:27.2439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b6e8cc9c-b1fc-4766-2ebd-08d94c6f9ade 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: BN8NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4280 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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 register header for ACP5x IP in Vangogh platform. Reviewed-by: Pierre-Louis Bossart 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 Wed Jul 21 18:04:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483948 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=unavailable 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 052A2C636CE for ; Wed, 21 Jul 2021 17:48:50 +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 7111061246 for ; Wed, 21 Jul 2021 17:48:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7111061246 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 0844D170B; Wed, 21 Jul 2021 19:47:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0844D170B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889728; bh=pe1wWHb6XmCk/phpn9E6yefyIg5wOLiEMru6koP/kuc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=R9/XvYwph+bh/Cq9NoER/vUusBaMARK53zvfFMjGoUmu1+AU/QDMZQm4260Zjwd9r TNoF6tsNpv4e4sTreSfbYo76AG8SwDzF5S95HOHqpN2T3Fa7Y+mQDPL7qYrrEM8GbV 9hQH2Jq/yiXA69867yIWB7UNPpaygqNbKWoOsxwo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id D852BF804E1; Wed, 21 Jul 2021 19:47:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 31F6CF804E2; Wed, 21 Jul 2021 19:47:48 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2059.outbound.protection.outlook.com [40.107.244.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 8AE6CF80143 for ; Wed, 21 Jul 2021 19:47:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8AE6CF80143 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="UYB7+uj3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NiX6liyUDtJRxreFRY/FX9lF2/b5gtVixTdBTLCj5mpN9Zv2HZtXSTrwOrdkPKs7WThCExxVNsl3Ucs/kI11XO7VytOULwoHe3h236omyDFcSyfIuHory4GPb5GoSF6u8aGV0j9OpSh0s+uJubfrPFOKja9YdtXvo090jzHTeTfy3veJrKByKeUqhPoWmiUoyZWuSF6S8SFs/+S3Qw6Wzawx7ro2A/Tq/Hh/6JNo2smIV5av9yz3KR909nQT9Hy/+Wc/yGA8k3ccyTBfi35dqCF+f5XnVbkwdWOscfbgHC6lj298ROuna+CsvMlgE+tDuoRD4jMafAvCON31yiO38A== 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=DN3+i/wY7Jl9O555SPM6wW41d20AWyAk8t4niZzvU/I=; b=SMCH8xli50xfzyPXaUGnjZX5zMkPNbUqo++HiI9EwRnH9WEBT7gSrYuS8YE5QPHCiUmB9noH7BACjPSu3D+7BfYV7uCq/iEgFBhRSAdwKm2mSiGD3Ii1iHDstXkhZP/MSG3ZqUDgCHQ4GVnbZOhkcZ98NUw4fzEix4ZjodxdSHi4+7WpzBbT9juW382UUn5loByEUMe+L82p5cKd76i9dcha9DtuoOrd4k7o17Pftkc2chXIGRibUJDIXHhS/5nBXgMFmA0NU+JZmQGfF2LNE2wAXF7RWtbnua4gfvxXVMoHM2WsxqNrbSEYQRf27B2v0Fo+5z1XNQr/RLMf3BFPyQ== 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=DN3+i/wY7Jl9O555SPM6wW41d20AWyAk8t4niZzvU/I=; b=UYB7+uj3wO3wPoAC9O6l/UK3m01VT6BdTFUBRGKg9le087PLCAUug4oqGvMiSJEA1kigLOP29y5+3os9Hw/jJ6eEZh/T2JeyfTs65TniNR6POqJPYd7Ryhy4L0oKSMkp1oNWPGQnqtJ+s1OMaLzBpb6hunialcidbhgggw1CXfg= Received: from DM5PR11CA0003.namprd11.prod.outlook.com (2603:10b6:3:115::13) by DM5PR12MB1881.namprd12.prod.outlook.com (2603:10b6:3:10f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Wed, 21 Jul 2021 17:47:42 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:3:115:cafe::91) by DM5PR11CA0003.outlook.office365.com (2603:10b6:3:115::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Wed, 21 Jul 2021 17:47:42 +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 DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:47:41 +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; Wed, 21 Jul 2021 12:47:41 -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; Wed, 21 Jul 2021 12:47:40 -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; Wed, 21 Jul 2021 12:47:36 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 02/12] ASoC: amd: add Vangogh ACP PCI driver Date: Wed, 21 Jul 2021 23:34:18 +0530 Message-ID: <20210721180430.11571-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8ba8a8a4-5ef9-4eed-f983-08d94c6fa395 X-MS-TrafficTypeDiagnostic: DM5PR12MB1881: 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: mwp8eHX969nBS5huhA5MDbY0iTLH5JvTR8NTqjsLEE0i2SJli+2pvskE+4NyDgvI/UoVZbEB+1VRBOvbqu6rKPFYAbbwITo9Jr+quMQ8zn05rca2tbTpXijjnOUXQeshvYWBuDCOZ1WdsVxwkxPheuyzt6p3Et5rak4GO0x59hoyhYFtyNdUIY25x3nPcpA1HGdRVaCqrYBgJabLfpFyO7EPn6Q3DYrevSijPZRJec82JpdfXm96qB+JBj2u5D2YWD1KRf8YKqHAQirwe8CmgLCxbO/mgqeZ9mEVSZj9xmieiEYITvm4VYDAkeT/DA9hrUFd7pvmfMoy88FuWh1wXGUTPcd7h7+NoaFhoOp1ZCjarieIKbXdWvBF+5M689iPZf9BLwoiXf3ooDqwyPd2bwqDvxn2jtzlLvZ1lJW/MHBsZsOweRdnLHJMT+odprOaeKHl6pqZpSVEBFwiM7oiMYMJsuvI5R/X4tomEjBWB4Gj1CA5hgW8cH9Fe1l56m0kAfjLoQQMrsb3uPL7wNH1gCF0fARmz4Pu2poGtR1nXiKHjqTXK7ziQfl35v1bpBZdXBfVjD//C16xmY3epGWepDdTeApwo5bos67JRLbXcjk+EQ4Zl7ka20NssJ2KPyarBdwqkh70uaM2ebf9kR+0X1SewhdyaOQpMEtROunkcCSKA+WYCScQh9wV8g3mcDEw+oVdfaQZ2vP02SJvev+jtKNNcf6E3yW7I1lrmuFhKwI= 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)(346002)(396003)(376002)(136003)(46966006)(36840700001)(336012)(36860700001)(5660300002)(316002)(6666004)(47076005)(426003)(110136005)(54906003)(70586007)(2616005)(82740400003)(356005)(81166007)(83380400001)(4326008)(8936002)(2906002)(26005)(36756003)(8676002)(7696005)(186003)(1076003)(82310400003)(70206006)(478600001)(86362001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:47:41.8112 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ba8a8a4-5ef9-4eed-f983-08d94c6fa395 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: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1881 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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" ACP is a PCI audio device. This patch adds PCI driver to bind to this device and get PCI resources. Reviewed-by: Pierre-Louis Bossart 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..251a7e0347a7 --- /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 subtraction 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 Wed Jul 21 18:04:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483358 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=unavailable 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 91994C12002 for ; Wed, 21 Jul 2021 17:49:17 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3B2656121F for ; Wed, 21 Jul 2021 17:49:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B2656121F 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 BAC6A16E3; Wed, 21 Jul 2021 19:48:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BAC6A16E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889754; bh=W9N8xhrg+f3AJsGRQwdFAgcwxVaSElLjJ+zlewZ2qEE=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=deOd8h3PjJWpV04T43byP9O3V9Pff31yBuX+Y0i9EZN5U5Z14CspcYJOwqaHHdwRl 2uL0qFQy1Sb+VVG9NibixTa8LfK0+b+EwICKRGUXp18v+oH1d8Govzi9nF0v5Ag2r4 ETG/r33d5MNMuYx1MGvTFSz30fZScjYrDS/6hZN8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BD509F804AF; Wed, 21 Jul 2021 19:48:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 83854F804CB; Wed, 21 Jul 2021 19:48:04 +0200 (CEST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2042.outbound.protection.outlook.com [40.107.96.42]) (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 6D21BF804AF for ; Wed, 21 Jul 2021 19:47:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6D21BF804AF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="g8Dj2OzN" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J7EBSl6alGjmryp/7NTo0N8Nm/45K8FS6N2Np0DXNsExRJSvbeqm4o1TPxJmls6bZwLlIRi8NUPDx4uXVlBpX+WIFnYpOqHXWLeBBeeIEIKBIivJz53DkDRkPddCk4RBXixEQGj3GqbxsPqgsXY3g2d5gmmJKdKZGyo4dndzvpxM+ULWaY7v6Pk3Y3eAN9mWJtoUBLlFmBfORN+8dhg3SzLBJ2LrySrYnmHuq/vTZqbYCGfANRnWXjXBwFezHAd0C9/DWfcWKbx2uDC+sOdiij7UHTFztr1u/fV8s5j5cBPtENsFcu1R2+5YxJduXJNpAjWE2lq/b2pdtTbGoFoIrw== 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=1c5XQfrGRwfTTFJvWE3jNs7CMNf/9fKjNwJ2qRkwFGo=; b=RydDUwVk0xp9XSKEh2bYq4csSrDZvG8vPNWQgEPmpdythTphF68QqSBN4vIhAEPdy37pZYeXU9yKBNSXMFB5qbTNs269oiivmhJMoEGdgQLJWs+pvZcvhIrZ+PQI7PDhJJrsYYZU0hkYPl/upvZepBThDBB9rzaT8s9f8I9iHjPCRhrK+eGKbHQLopviOA6EYKzoz4jWW0S532MKsNjHHt9lgfsNZrc7e1+M8rvBqY7GBRxOJOhZOUJowJFu5naqJHVNrS5GTfnTSuwQM/FKl87H2LZMTJAtEQdJTdOOxu8HzTw8RaSJIANaqdtqg5S3OyrUelJ9ATRUXWnyEjpoYw== 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=1c5XQfrGRwfTTFJvWE3jNs7CMNf/9fKjNwJ2qRkwFGo=; b=g8Dj2OzN/3LuQaUErD6KsoCrzSB/XHDupbXQHqG949PDcG8hnujqgobwFGYJV8v0Vr2/Mmps+uypVR8Wm7UI3LmPa+T3MFBhap1+XXwRGJoGQaLK8Z4dB8JVvaLh6qn59jJdyxL0QbdeGI10LW+qHgaFLXVjALKmPCOuevAVNXs= Received: from DM6PR17CA0032.namprd17.prod.outlook.com (2603:10b6:5:1b3::45) by MN2PR12MB3918.namprd12.prod.outlook.com (2603:10b6:208:162::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Wed, 21 Jul 2021 17:47:53 +0000 Received: from DM6NAM11FT066.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b3:cafe::c4) by DM6PR17CA0032.outlook.office365.com (2603:10b6:5:1b3::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 17:47:53 +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 DM6NAM11FT066.mail.protection.outlook.com (10.13.173.179) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:47:53 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Wed, 21 Jul 2021 12:47:52 -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; Wed, 21 Jul 2021 12:47:52 -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; Wed, 21 Jul 2021 12:47:48 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 03/12] ASoc: amd: add acp5x init/de-init functions Date: Wed, 21 Jul 2021 23:34:19 +0530 Message-ID: <20210721180430.11571-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 51e70463-ae66-44c8-29ed-08d94c6faa53 X-MS-TrafficTypeDiagnostic: MN2PR12MB3918: 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: XbCqUG1dEDQHNjwGIKMXas6x7mZ+7WGkySpMYSczb/Qp71nPhdvqBnimi0V5BHrIzJpL80o2Ugfe3TZ80S47MNzQ+HSu6PREjELaV1bWKPhVIBnEv9cWHeZL5o803cBkIyDHFPEGyOjCAv5ID3gStAU3lbzEeSBjhu66yv5oACDLanUqngR/1Bk0n1Qer/kXWnnOJ3GE3h7WOZ0VUhnoPTSgQ5GUi5jXc+ym1G/zkcEFByKQqyDv90t32U4ZyNLBuW2ajPpZdm1IhI4L/CdK3tLDhvlhighl4uy2T1wNRvSBUNYqOTPfF1C5joaRQIxO0gC3PfTz1qgzFK2PnXHCkgmTFNPNvn3hW+rWW8TmZy8qgh74k761yZ+nhVyA7jP3RTHVhsBlSdJIgKoZ95JsI98iJ6E8fk2r2F4kUMfiflhqHnuAYI5fIDqRvyCDjDyo+atcGP72LfPDZw62BEXWUmggnZFQF9vi0+mhnr7ywAPMy14ubgakk1hPevEvpt/D0OqsFzsrSYf2NZoE+/5ErytWK33dNzFq74y/UyA3ZhC4dat7izAHQsWKA7gs1BTWTsKm+COiVcXZUMCF3RasCmDBe0K+x4HMByxqg9hZkTNpP19tmKFa2pUbN4X+sjOvyVKZeN+XAsq+TFOxhIO+XjgZUaEoy/JBRhEp1viGNwydVB2OEdOX1x6fL+iFnlNCsKoZhJUAIKfvdnP4JYA33p6AAFEGhe3Ngy9WA9nYzg9DEl3ReKR8e4LgchujQ8hCvkYLS/UavVR9bKR1TeIQ+4xtXbMhJ2YJHZJiTK4S8jk= 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)(36840700001)(46966006)(2616005)(82310400003)(1076003)(8676002)(47076005)(81166007)(70586007)(356005)(316002)(54906003)(186003)(70206006)(426003)(508600001)(36860700001)(36756003)(336012)(4326008)(6666004)(26005)(7696005)(110136005)(2906002)(8936002)(5660300002)(86362001)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:47:53.1134 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 51e70463-ae66-44c8-29ed-08d94c6faa53 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: DM6NAM11FT066.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3918 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart 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 251a7e0347a7..db23fffce9a0 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 subtraction 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 Wed Jul 21 18:04:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483947 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=-16.0 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=unavailable 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 56E70C636CA for ; Wed, 21 Jul 2021 17:49:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58C7461019 for ; Wed, 21 Jul 2021 17:49:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 58C7461019 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 9346016FA; Wed, 21 Jul 2021 19:48:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 9346016FA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889767; bh=5Md67/IkDZn6bSwR1zdbL3NCAZgUp5rRgL/Z6x84b3g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hEn3ZBI6iaOXS+liqTpehqMxrp5P6WsnxHmA3V2TfGBiziytuPzrjTLw+YMqCP22e ANCunbrKnNtO8GVOCRhmZqASDmoZVPBHVG7nQfg/gEQrKFKQF1JShkAfj0KFXoSkow yjNed14zv0Gvw6jFQBWhHocF6nm2ghwu6xsm9Vvk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A4F05F804E0; Wed, 21 Jul 2021 19:48:13 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36DA2F804E3; Wed, 21 Jul 2021 19:48:12 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2049.outbound.protection.outlook.com [40.107.93.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 53754F804AC for ; Wed, 21 Jul 2021 19:48:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 53754F804AC Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="HH+tN9S7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiLQACn6/PyLSMFvBAmDls+Jlb30WHoyjhIoA7O6ZbXaJAY90ckHFj/KkBJvQjG5HmlhySjR0/F3l5LbxYOBCr+P3vx0OVqYj80/sk7uM5NUuxr21ZTde9DXf/9+kofiNsKA6Sqzd+bc6YKSluT8hf159thUYlH6kfXt5jlyw1klUT+hOOeYTfhDGzRDe+lSi9EGCER8K9yCXZaqFRbSAbRmjS6ydZfLtuy+ZZMj0MsMMQKhUH5Sw/Y/9uFcrEcP3wuuWwE32F+6V1QTYvoYCYyqOheCUDYPzVSdhNourOIeSw5iEPnx+MeJX3VnYuOCbjwBNADPNLRlW2F+RShQuQ== 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=UM8lvoM4hM1VScDYSPSay2K8WVC9qm+a5daEijat3MI=; b=gbVdYvfSaT4dbAYG1TJI1GiuRU2KWrmoXdrtyELvI2e0461NsKkzbdluOrfE7rfzmvgU84/f/DQZvG8+ohkcSm0STRB3OmFizuUd94J4K5zr2mT2+HBVKdQdJQeWMcqOxs8Z1baKgtE936LwT/p1qjAy7VwXscq9eEjNWEoKwbSx6vK3YP/RsxyYDFot/AkXMe5735kie52XbE7n0FAx3ucePHGBsbnU8koJkDvt9LdNaGzOjXPJ8fZxJjOJlR9RxP/KcZ9eOWLPb09DJNTU0lbpPYa6hkOim2p657QhfoGUBIe+kjqqWmWPCwN6+2wTshnP9zLCGdz28RtlSxJ6aA== 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=UM8lvoM4hM1VScDYSPSay2K8WVC9qm+a5daEijat3MI=; b=HH+tN9S72YyNMxfjLpF/9QAVGbOBbAqaYZtDKKopleNfsOrYGbIgIDQBhfyX8PkvZAgDXiV2pANSqBHNtllRdFrfwXWGHqMpbFnI5NJ8JQoCTf76dAk8sktYlItjtK2lpZLB2+dsICmMyJ4kZZNdiNyUUBduAR6H6it3ZFBi9pI= Received: from DM5PR08CA0044.namprd08.prod.outlook.com (2603:10b6:4:60::33) by CY4PR12MB1862.namprd12.prod.outlook.com (2603:10b6:903:121::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.34; Wed, 21 Jul 2021 17:48:05 +0000 Received: from DM6NAM11FT020.eop-nam11.prod.protection.outlook.com (2603:10b6:4:60:cafe::d6) by DM5PR08CA0044.outlook.office365.com (2603:10b6:4:60::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Wed, 21 Jul 2021 17:48:05 +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 DM6NAM11FT020.mail.protection.outlook.com (10.13.172.224) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:04 +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; Wed, 21 Jul 2021 12:48:04 -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; Wed, 21 Jul 2021 12:48:03 -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; Wed, 21 Jul 2021 12:47:59 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 04/12] ASoC: amd: create acp5x platform devices Date: Wed, 21 Jul 2021 23:34:20 +0530 Message-ID: <20210721180430.11571-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4f33ab5f-fb87-424e-2ecf-08d94c6fb13c X-MS-TrafficTypeDiagnostic: CY4PR12MB1862: 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: rTTpdIsciMlLUdDTQJZlFSJfa6EVyc/J9VTRIfqEqNcft14GUZbAgaAcfny6vJjrFW2WdRuuPydZS8UDdA9fyaM30v1aM7nykxD3xqYiWUd9u7HRfkKwgr2rFuR6TEgAlRLVzO31FQ56WdjmV6f2ehn93RYRxyn9TCFyUvYtVY1M6cypuzCti4vrvvKEnbuWhFlhK3RFGk9KQav2l7yjCZ014FCieoELSiZjPQXycTGAYug3O3DWqR8SVHvtGmpeLRFS7Zw+KGGgnWmAy0Li17i0T6XZSWJFD0Ps2TdJhmcP1zdiddFYQLQQ8t5bg4sPCVPiXqlDEi3y1yjn314+32SyrctQwV/9hGlaPOFeUdRXZyOLQWWOwNywzcaBxukdYP0gh3pBzKrHnslKQbs7FGPiKxSs38tpMHbaUDt3g0oBsab7WCJb3wAh2/yb+i208SkkB1OMeLblnT4ZpXcJ4szNMK7oiOYHg/1xCNtBt1oBHQYWFpQzTvuNddVsaiyf6FZP/72SZQDEeA4ZZLi2eziXQIFCeWgEuIi6HSXq5MRx2IbhOA44kgL3NnvQftcrKW8SqlCG2A1ciDy13b9P+g0DX9qUE8XCFMiJK46odfgXSdM8iZGQMqClicyr2mpZYjX9VdTI/A86/qMDFGRT3U7PgQVQhUaCN+x1h8VSluMS6IZJlw2aJDlXKjyup6a4viPPQ+tHdHl3dxu/DllFap+apYkTB9DzU0Qrw5AFCDCh9rLuomewybupziOQ6hJ+7D+EhjDCuYGPTnKFbL6HtTIJF6hLci+YY8xakyqudek= 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)(376002)(39860400002)(396003)(346002)(46966006)(36840700001)(2616005)(5660300002)(186003)(81166007)(4326008)(83380400001)(7696005)(2906002)(82310400003)(54906003)(426003)(36756003)(1076003)(316002)(47076005)(36860700001)(356005)(82740400003)(70586007)(336012)(110136005)(70206006)(86362001)(26005)(478600001)(8936002)(8676002)(6666004)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:04.7178 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f33ab5f-fb87-424e-2ecf-08d94c6fb13c 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: DM6NAM11FT020.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1862 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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 controller. Pass PCI resources like MMIO, irq to these platform devices. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x.h | 11 ++++ sound/soc/amd/vangogh/pci-acp5x.c | 94 ++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index db23fffce9a0..32e5db10c1c8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -22,6 +22,17 @@ #define ACP_ERR_INTR_MASK 0x20000000 #define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF +#define ACP5x_DEVS 3 +#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 0 +#define ACP5x_I2S_MODE 1 +#define ACP5x_RES 4 + /* common header file uses exact offset rather than relative * offset which requires subtraction 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..25b42a37ad3a 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[ACP5x_DEVS]; }; 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[ACP5x_DEVS]; + unsigned int irqflags; + int ret, i; + u32 addr, val; + irqflags = IRQF_SHARED; if (pci->revision != 0x50) return -ENODEV; @@ -150,6 +158,82 @@ 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) * ACP5x_RES, + 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: + for (--i; i >= 0; 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 +245,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 Wed Jul 21 18:04:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483357 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=unavailable 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 7F9C1C12002 for ; Wed, 21 Jul 2021 17:50:07 +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 E2D6B6100C for ; Wed, 21 Jul 2021 17:50:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2D6B6100C 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 72064170C; Wed, 21 Jul 2021 19:49:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 72064170C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889805; bh=WD3bmvfTqeQpQOw5zY9zEh2SaEj2la8tnx9xoZvqJAQ=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=JXtoR8DUAkREMmfUrSYJza0H0YETLXPUUwDEOWQixRl0bw6pCPPrJ8TP4ii0rFR7h 7NwrS+w3nvRiiDHtWyCWqKYVYKBAdKfnvvUt0WGpL6jphUvNAAE2roWQRll+SgT0TB R3SWSYwRqEm3XNrLi8uDhmBe3Jwn3T27dfZWTwvo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2BFEAF804F3; Wed, 21 Jul 2021 19:48:31 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7198EF804FA; Wed, 21 Jul 2021 19:48:29 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2063.outbound.protection.outlook.com [40.107.223.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 5CE32F804EC for ; Wed, 21 Jul 2021 19:48:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5CE32F804EC Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="BsMas/fk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuAbCu4onoA1f/+PB2RWAo/Dqz0fw0NuX3EsEx6ylwVNGtntBqr8Y4cSnjtBuFGqsfUouiJo6OOuGn2GnD1NRmmKAPSBzxBflDMPUIB8ZifINqzPwfftaP2dBrWHgMARPmB/TClDx/VOjxOf/N7WAjhFAyAYy6H6rxrNXVVeApLwmwLW2N+iSbXcbEDcZG2cQgngxTkObxCYcDU2ysfdSyy1sIMpKcPhneHazY+1nxC0uB+N1kW59yC1FHQb8btDOjB+XBgKjJ82UtiKWn/kZYykqiKar+XzxGUR7FMVxRyqUuBjIhLjw5uQddGFELwokb/M7CyaImhCkLEiu415vA== 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=+XISOAolU8i+aFK4hcHuxnITjp2m0ga7wCg0cmhI8+U=; b=Iz//SykkPfQSVHu3xJc6P8rzDEiUmael0Palfyu7orkOQ9ffalEeXIMihYyIPnaff7kTT8C2TBgzKWT/7NkYm0DDFXPOiEVJJUuCMuSypVPsmGzZW211eV9C8aHtOg8QzfGCH94Ihx68+YHCvvK1EtAeIOLOLB/F9oh7sbtq5SmOLbPEeiaFzzaZaHCfoeGGOmofa0oZTr73nVBwTC576LzrF4aCywson0W/9yrIP3A81RRmxIuofiUXTWZq9+Vzi0z3cPnWkApS3toB/SSi5Z8ZaUMJMbbKOKSkn87gNiDntmTM+D50jdi27TvALwrdFvkv2ahrLeu6Q8exa2lmyg== 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=+XISOAolU8i+aFK4hcHuxnITjp2m0ga7wCg0cmhI8+U=; b=BsMas/fkQADnMX9SrH+sWAUMtZcf90S9HCJpu5i79bFA2Z0SW8gKjiQS/UrFeIseMAEPunFkXykX3lKHAo66UHuPZAwOsSFwBTdTzT+E3TO2eaVQoUTw7gXv7SkST6yvg99Lf7pl7iN3ldO66qQKpciaT+rh+csoj4f/qHin/8c= Received: from BN9PR03CA0245.namprd03.prod.outlook.com (2603:10b6:408:ff::10) by SN6PR12MB4669.namprd12.prod.outlook.com (2603:10b6:805:7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.31; Wed, 21 Jul 2021 17:48:18 +0000 Received: from BN8NAM11FT042.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ff:cafe::73) by BN9PR03CA0245.outlook.office365.com (2603:10b6:408:ff::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Wed, 21 Jul 2021 17:48:18 +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 BN8NAM11FT042.mail.protection.outlook.com (10.13.177.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:18 +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; Wed, 21 Jul 2021 12:48: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; Wed, 21 Jul 2021 12:48: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; Wed, 21 Jul 2021 12:48:12 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 05/12] ASoC: amd: add ACP5x PCM platform driver Date: Wed, 21 Jul 2021 23:34:21 +0530 Message-ID: <20210721180430.11571-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 65af3378-21b5-43cb-1e2d-08d94c6fb97f X-MS-TrafficTypeDiagnostic: SN6PR12MB4669: 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: Xei1twDXkEoZSQ9Ri6g9Bzu+TGTSKRJqAC0YCdsicwVRrKSJXCo4l+hTiuDMW3yhVenlensCYPx/sFMwbsz3zMQhPHOjKfq4OptzCOC8djKZB+UYtdcPNCVfAJ9iiofblbWRf0Z92v7ccDD/a3oWBq2OGLfoGwJlUZae0Z8SmAru7YzLMWrtxd+EYuBohLOJrZ4QtxTZw0xfCXSW0GtMhYSDnQCwDQV+IMKgmDW/8IH1i4b7BGoTAnlo1CwJeHYpn/wgvws9t1hWObiyZhIXo1zJE6mxAqXcoZxAG+2xu5E7Lwei4ti6cnYiiPWUwBuMLNKTLjoaYtpEoyvMd1pHIKBSVeXiKwGGts89y/4VYozFnl7hTxlf0SqK0qE7arrneUaTLJJWpkcqmOjGKJZGiVwld6HBsNlyIBJw/Hydye64txaskBGkT7Btu+DnW2gOVKzX8SWHaPV0EvvUxl/7GoztvsKHqV+DbDEb4tU7wbT3/OPP8refCpFdJ7FfEpU5EiJxEbnGOb+oojDOm+9FMWi/W8TSFms2SiRPCRtPbnKmsuImNng/IZFoygU7V78//fxP7ZsES+sXg+9oeTHQqd1Tv01I3BaYX7iL6KMh1NzAvM7ed/uwjWuwxdz5hT0pdkzuyE8TtH1jd9r2oh2bzlOEG8SygwIpkf2gSk9ozU4+Fh+Cx6gNS2z9MKeZFIUQRoeiVn5E79liBBX/bSdj9bYJeGQhuZEcD7u8X71wm5DXWznz4pHs54GdEza3DiaD 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)(346002)(396003)(376002)(39860400002)(136003)(46966006)(36840700001)(110136005)(478600001)(81166007)(54906003)(70586007)(70206006)(83380400001)(1076003)(82310400003)(4326008)(7696005)(316002)(186003)(5660300002)(36860700001)(26005)(82740400003)(2616005)(2906002)(426003)(356005)(86362001)(8936002)(6666004)(8676002)(47076005)(36756003)(336012)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:18.6302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 65af3378-21b5-43cb-1e2d-08d94c6fb97f 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: BN8NAM11FT042.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB4669 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 72 +++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 76 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..60d752adfb81 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -0,0 +1,72 @@ +// 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 status; +} + +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 32e5db10c1c8..e450fb32d680 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -33,6 +33,10 @@ #define ACP5x_I2S_MODE 1 #define ACP5x_RES 4 +struct i2s_dev_data { + void __iomem *acp5x_base; +}; + /* common header file uses exact offset rather than relative * offset which requires subtraction logic from base_addr * for accessing ACP5x MMIO space registers From patchwork Wed Jul 21 18:04:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483946 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=-16.0 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=unavailable 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 80105C12002 for ; Wed, 21 Jul 2021 17:50:21 +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 E511F60FED for ; Wed, 21 Jul 2021 17:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E511F60FED 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 68130170B; Wed, 21 Jul 2021 19:49:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 68130170B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889819; bh=DHgwXuHHSGhIYcbZ4uPZJ/oTJ32XDDtKFDsOEW60ibs=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mRx/iGfpF5ULM8Bd0oJjMNyOe6zsA1Op+GcDYw3xxvN6tyqXYOcV5aFDRknIBUa+g JVb5rOSKbs8+iRfhkJdD3DGDyHBxlqNDWYl0Oc8BJDuNO7zWA0QxAaTPGX5sErOjER 9GD5LVMksqe6img0qe/gIwYWqj1cGK3vv6KrMuac= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7FCF9F804AB; Wed, 21 Jul 2021 19:48:42 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B2EFAF804BD; Wed, 21 Jul 2021 19:48:41 +0200 (CEST) Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam07on2087.outbound.protection.outlook.com [40.107.95.87]) (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 DDA11F800FD for ; Wed, 21 Jul 2021 19:48:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DDA11F800FD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ZDXdfm52" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XW7jq6AJj/WHsxixoabkzO9nR1S1cbz7uSnGzp1qaMALa74vaWjCP6+FR4SKRL7IK2X1uCxNeKTqMMMIhKyBW67jHymh6BpfWYmvUjUKR8m+kE/JWuOzxg8t1QY9Y7uSJGQ5pOp+aeTf7o3t6lxLvSolKX1iMBKc9umMqLsJFPH1dbdoyGlDDzsDkIkw//5rF+UwESUS9NC8G+4EIDn6CVbefF69IWV32Sre0rbW4qxfy9GXF8SsQirovY+noDMknMTNXR3vWYKsfChcIi+gGKXVUglDLCqaEqQlouAehzHqxVmdcyfYFSEuJo11KfU58SmA1EjCZTSt1hdmttJScQ== 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=qu+BWUFM7tj4+sUruvt0nSTe0JUeZx9Izxk2XymwQzk=; b=ZDqNaza7tbHB+0osDTXIznreFefs/0pZ1szSLfOyb2QGtUOZZn7iXOO7DCPWr2bKvn0REy8PvBLKC9q0ko3Zt/IOQlhckNqrnIpJHROSMxrRh0u2sZVJvH1Skg6CU2B1PgtF5af4d2/k7X+rTsipcm8wMQgA954apSeF129UiOIefLBmqzn3vDn2wjuRCwS3FouzVuBRYsIxKCml2jmR7b4sBsbTkl1/zId1kl9C+QwmGw/qecnB3Dqw5vRkVM4LFmtZ6ROga8ddE/ZgSgrW/DiXhSFqVWRCzIL0tLhCdll3D2aBSn6ODyvhMwpUwEQ+3iKpDW/7/jnfsxN1kVYMoA== 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=qu+BWUFM7tj4+sUruvt0nSTe0JUeZx9Izxk2XymwQzk=; b=ZDXdfm52o6E1Pl+Dj/Zas5swL1wB8iXMbpbCcefRoJFM21zuOcj04XWYWmug1C+gJnHJ6DjDEzqPj9G9fHuN+OczQrEOrSrE1+FyrCLBMVAyYMAndhnOfSQp3b+bsH2/a7CvgIf03LmJxBXe4VPzJ+AgnKCqhwEvpHXTqqkMKws= Received: from DM5PR07CA0037.namprd07.prod.outlook.com (2603:10b6:3:16::23) by BY5PR12MB5527.namprd12.prod.outlook.com (2603:10b6:a03:1d5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24; Wed, 21 Jul 2021 17:48:29 +0000 Received: from DM6NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:3:16:cafe::f8) by DM5PR07CA0037.outlook.office365.com (2603:10b6:3:16::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 17:48:29 +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 DM6NAM11FT036.mail.protection.outlook.com (10.13.172.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:29 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Wed, 21 Jul 2021 12:48:28 -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; Wed, 21 Jul 2021 12:48:28 -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; Wed, 21 Jul 2021 12:48:24 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 06/12] ASoC: amd: irq handler changes for ACP5x PCM dma driver Date: Wed, 21 Jul 2021 23:34:22 +0530 Message-ID: <20210721180430.11571-7-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5cefab1d-a87e-459c-c41a-08d94c6fbfba X-MS-TrafficTypeDiagnostic: BY5PR12MB5527: 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: r3vtnZ5Cbd6dO2Y3h97Xs7vnBpRfXpM4MyeSp+ZSBoAwk55fJgGE2nyFZqsGnl5RMCvkxQyhVim29OdCqOYujIgJwtuvMVgM23OidU3nv2X0vsfmlBsZ3YLqxe9JfO1f2hlCI26Z92IBxtRCXqycyPze9S4GQqoZxsjcjZJwn3Jrs7kdB6lcoG2Px4e/REPT254dqg+unlYBC8ZklmHYuDw9f2YtA28B6gUFJiyoD/X+nGolYMpQth5whFmj61j4Nf8ekua1BUuq6/g7sG6Cj/D1oVw6VpRouA8SJYqDqSYGiIFVwS0RFThRZgk8i2XLuQc/AV9HzkUKNHtdezlhQkO8TMEfYVZ3iMSTZG9Ui9KprDep8pzLTq3UYxeMc9NOhccwGwUE3E3uvr7flgI6386VheEtq69QoTd+/bxSMCA0Aq8q5noYwjDO3ZmbJOKaurBwnRNVqnF1ad506w8Tgr7PCDn1T+brwK3/foh6pUL3Ad3j5KykG4ENrlpkz5FRrhY/OiFGhsaSZscb1O2sE23EEmiG9awrRXlAIRk8TagsvCPQwBPxxEJE1XietCKr9ou1nbCWljnuU/zmebic3XRRhloOK+nak0lWcjoyAPG0nx8ljOCOxrNUBzHCx8ruhtqMOLRrSwa8l5SYDBWg1wF/UDQn/zLlU9CrijJ/EkPNg8LY1pWbijw+ne4jZdM5QbuCRVsJdd2a5LEtsy9ZwFvZVR/zz3+QGPaB39lqMqv5CXxyiIHFKUvrxLB+twpo 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)(136003)(376002)(346002)(39860400002)(36840700001)(46966006)(2616005)(478600001)(81166007)(8936002)(4326008)(47076005)(26005)(8676002)(336012)(36860700001)(110136005)(356005)(54906003)(2906002)(426003)(7696005)(70206006)(36756003)(316002)(82740400003)(5660300002)(186003)(70586007)(1076003)(86362001)(82310400003)(83380400001)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:29.0305 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cefab1d-a87e-459c-c41a-08d94c6fbfba 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: DM6NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB5527 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 61 ++++++++++++++++++++++++++- sound/soc/amd/vangogh/acp5x.h | 9 ++++ 2 files changed, 69 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 60d752adfb81..952d5fd83653 100644 --- a/sound/soc/amd/vangogh/acp5x-pcm-dma.c +++ b/sound/soc/amd/vangogh/acp5x-pcm-dma.c @@ -21,10 +21,55 @@ 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,12 +92,26 @@ 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, NULL, 0); - if (status) + if (status) { dev_err(&pdev->dev, "Fail to register acp i2s component\n"); + return status; + } + 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 status; } diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index e450fb32d680..a0d898e47bb8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -32,9 +32,18 @@ #define I2S_MODE 0 #define ACP5x_I2S_MODE 1 #define ACP5x_RES 4 +#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 Wed Jul 21 18:04:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483356 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=-16.0 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=unavailable 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 9DA82C12002 for ; Wed, 21 Jul 2021 17:50:49 +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 B81666100C for ; Wed, 21 Jul 2021 17:50:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B81666100C 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 543951714; Wed, 21 Jul 2021 19:49:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 543951714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889845; bh=ZSO/VnGYs9g7XoYhOhQ8wI53BJgO7sWSAhYoy9XVj2Q=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KTfdLsgV8rRJKgTDWm3U6KJx/+PtyY6ndeXomYz0QoVEE/8VVAHmZQyDebwEffLc5 lL2eYM3+uf1gdFCDGbWojo9iRQiA7TN5l0Kf0ttWDwefsN3mcfY/+g1nWOiAGPC8Ds J9jsyE3krAvvcYMKdKkpjWKhp2UlXAvSBRJOSA4w= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3A472F804DF; Wed, 21 Jul 2021 19:48:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 47B35F804FA; Wed, 21 Jul 2021 19:48:53 +0200 (CEST) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2041.outbound.protection.outlook.com [40.107.93.41]) (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 48338F804E1 for ; Wed, 21 Jul 2021 19:48:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 48338F804E1 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="hlw0A5Wh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ERvQtgWVHwRZ+LRMmIXAm6I1/Suypcym/atFqIoGYtwq7HENrEnFVkQmGf8hZAyhP0I654bQJf+S6hyyp07SFyWF8V7d96uGaRtrroUzSrPa6kBVyYDBhx0eOAM5X8xp5qBsuPEDQna63KoUwMxu3FOL7v2GKwrd6e5ycMH8j6oETj3lqJ+DDEW8SiZGqvw4sTUWv0ZxNaLxQd0Gz6kd3BzioshgjGV3swcPLMrEcm4iiR8F8duIqeFhFCD++m/CfmbaM0j6UkNDH1F1dDl5uTEpLY0hu5ntVF9mcseOCG+iUWW+CfmBnQYqDSiYZsBD1Zvp+jZDcgLFm+f4iH7Wew== 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=QYPuy+g93xQxSLXQMd/+gg9EG1KZdwXb1I3wmzqCP7U=; b=iQO1TG1FuSGJKYse/VFOUcgccWzRit8NGYNw6t+ntLHyDVIoxTQkMwdjKVusekyXdQVh83EMYlEzMNjDkevKw+1JbQ7uI/Kf0ivSsjWXOkL4UNV8UI08vAAzLehVWDwDgk2cMxy49ePeCJnjoogmnprU79Xx+l2Cu8KsmCpHrOvCsyLoZednKbsBGbl72vYu6cxYoL7RetsqOX9bEfbV1+tm5rliKHwMWq8mvUlfrorbgRmQoJbj6+RlyQcy3FseAIICU/PXdJCP4S6QICBHWY1zMj6c7ZFkWO5ACM/aqJOOhKgI9tkANABRAfHCG+QwsCr5NAOCam7/LnRI6ojWFA== 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=QYPuy+g93xQxSLXQMd/+gg9EG1KZdwXb1I3wmzqCP7U=; b=hlw0A5Whxd98ynrTHkPUl9FMtcpkPeOvjbG+lKN9oqggTbXH0LYodKpAs98JyZrtONMsGKAoHqXVy07L7UroczNQPB3zHuT+0BYwPbm3Xx9DMLFyUnkDBhwSHw4Hba2IYrz3t9CDPfWLGREkCIK2J52Nbpugow8TFf1a1I6LnmI= Received: from BN9PR03CA0180.namprd03.prod.outlook.com (2603:10b6:408:f4::35) by CH2PR12MB4216.namprd12.prod.outlook.com (2603:10b6:610:a8::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.23; Wed, 21 Jul 2021 17:48:41 +0000 Received: from BN8NAM11FT063.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f4:cafe::bd) by BN9PR03CA0180.outlook.office365.com (2603:10b6:408:f4::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 17:48: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=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT063.mail.protection.outlook.com (10.13.177.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:41 +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; Wed, 21 Jul 2021 12:48:40 -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; Wed, 21 Jul 2021 12:48:36 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 07/12] ASoC: amd: add ACP5x pcm dma driver ops Date: Wed, 21 Jul 2021 23:34:23 +0530 Message-ID: <20210721180430.11571-8-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eccca478-aa25-46d5-e631-08d94c6fc6e0 X-MS-TrafficTypeDiagnostic: CH2PR12MB4216: 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: GqqtwdI4eQ/9zm8afCYyCVZ4HsF2a6/nU9OBdvJIB/5fLfzgeVXujjsOE1+NbHmfouwX30pP2UdDqeZ3mBfg5Tygn9nzJoazuGOIe+QWZLxgIS7RGlWn0X5mxWx3CGKPZDycRvIuOzuJidy9Bi+qK1BMMSbxMiPJDaBQpaDQOmMVLt1SietIUnwFJ+amikUcSCMph5NwPpA/OE/UcA0ClrBT+ZuuuUtCB7kodai4h0UMgiwdMsW/5bpfAyNOs2aSBKizaHWKglEpykADDpJtMdP4S4BFruU+oizYNFzQS/7MNHaR3eo1z9Oqt0dXkUbAuN1oTCjqdR+5e418h7GItTmw8tFZgd9tpL6qSDmZdQ2817YJsmEvUlOwPwG9JLnjtHLyhEtNUR841WnI26+eys9wy0kIU2FUduRT3Y5BwGvy/Gyg2bTLAf2UKnhW4nCl3hMw/NpQVTFX8/wcR5kOYu2/iHd7RXhhMKPbpJZnMTfEpUB7OOlnAXcifv+zgIAiD/l715RYti7YHxjKI7RfBNHpu2+72GgGn9/iTr0KVJDSNL+FnyLHO4Z278xZrCurHCae8A0sBlRMgTuZ00NEIajnNT10ztOe7sucMGMvUhfPIkFsVbv9prXvIyuqf749thygYFUOe5JC8nqeji9TKdtXZlsK0nqpPfgh9G4Zepbu5yXYqcw847INMqH1hE7QqBM4T6idTsDMnpo08barJ7a2oM+QySnKEoiF6wyeM2vTt2IIIZW9VNo9TxB1wHQhhK5MyIyiFaBXKSE/NZQlyA== 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)(346002)(39860400002)(396003)(376002)(136003)(46966006)(36840700001)(82310400003)(81166007)(47076005)(83380400001)(316002)(82740400003)(6666004)(86362001)(478600001)(36860700001)(5660300002)(356005)(2616005)(36756003)(336012)(110136005)(70206006)(8676002)(8936002)(2906002)(426003)(7696005)(70586007)(4326008)(26005)(1076003)(30864003)(186003)(54906003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:41.0814 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eccca478-aa25-46d5-e631-08d94c6fc6e0 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: BN8NAM11FT063.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4216 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 306 +++++++++++++++++++++++++- sound/soc/amd/vangogh/acp5x.h | 106 +++++++++ 2 files changed, 410 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 952d5fd83653..6296b353c7f1 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) @@ -65,6 +99,274 @@ 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 -ENOMEM; + + 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"); + return -EINVAL; + } + 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 a0d898e47bb8..929be9905e8e 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 @@ -37,6 +38,39 @@ #define HS_TX_THRESHOLD 24 #define HS_RX_THRESHOLD 23 +#define I2S_SP_INSTANCE 1 +#define I2S_HS_INSTANCE 2 + +#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; @@ -46,6 +80,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 subtraction logic from base_addr * for accessing ACP5x MMIO space registers @@ -59,3 +118,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 Wed Jul 21 18:04:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483945 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=-16.0 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=unavailable 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 9587DC636C9 for ; Wed, 21 Jul 2021 17:51:16 +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 10CA46100C for ; Wed, 21 Jul 2021 17:51:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10CA46100C 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 A81741726; Wed, 21 Jul 2021 19:50:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A81741726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889874; bh=sLn13C8xRvCZ9qyT8Mn1JAk5/WcwI5L8hb2FHhTjkAk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZDRluFZI7rRo4646WqjhQy8A2w6lpqZhC10FaVJEQfInM1W576T+edJRk3ECehXK5 TwdxNQgeRFmxF8A55+u+vHcSHW74oKCYLRML5qp6GvyJ6LMJHkEqCfV9W1j9aGc4UR 3VzOtfPIN/U8Znu68pwqlOtavBHCVOa+CVpogvAQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9C520F804E4; Wed, 21 Jul 2021 19:49:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 46F6CF80507; Wed, 21 Jul 2021 19:49:04 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2054.outbound.protection.outlook.com [40.107.237.54]) (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 AC7D5F804E2 for ; Wed, 21 Jul 2021 19:49:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AC7D5F804E2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="KheNcxVn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CW4YBgc5LjgRh/ZhbEfbzh3t5PgNe+kGXBUVVqkNBRN8nrCSCgAmbotliJXzseRQUryHFx0BWRT07T0C6vi1XQiiRCVKFXmVdymsm8ONzYUKv0q2x+oyLN8yXL29jmJqI/SxROPf7ujjwOwCrostJ/NmIp+uSISpi5Ccz7lCCWkhmNHEUQstIqU0leYhIhyrcZivKgHT8qPDtCtOHVcg0nd+rxkU4RgsDydAWUEYYBVIpVD1o+VPGHGx5iyEsJ3SnP0iQq1mzUq0Ph/LHyXwmHJzOiOZyX9qECuoz2w+w8PMfHDhm+czDIicgDiYFIJ5YZU7WunyFmbtwxSrDXhQSA== 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=+safQbXcU0Mnsj+HYozuxByaF2zXwOPApsfItM/zHqw=; b=V2M1yVxbVrrm6r/kBm1rmcir9Jrf/6M7YV14KdAhrni3+qB6tOWO0L5aXABn3ICoiuOn6bPIgnzkWwjQVJrqTsSstzLolHjOkj1JB8KOsCmGoLhRqdCM74spaysKk31pPAZII5yplvo7Pz9cakmZOyJXx5Rdh6uJbvjm/Ct8q3MDKPls2fe6NR8eBibo4tyBAua5LpJ2xY49Guy+5oz0SKhv+fX1hk1TUrml7Krr/D+P52cmj9q2WZfP7eoj+KLmudpMu6sjdRqLNnmd4F6NqVZrdkCU6E5/dUHejTabDH1bE5B2JybOuRbeOAnTOK5F+j0b0z2FgHV0DQ+agwbQtA== 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=+safQbXcU0Mnsj+HYozuxByaF2zXwOPApsfItM/zHqw=; b=KheNcxVnJT2atWfwq//rfWnNyv3BeMnp4ZP/93NXrxl3UIw4hrs408Va25oCWp0RU2NRyCs14FXCRQxBgXqZtEJPwPgWgrOg/20QR+kC/eHrkQPZv1q319v+k0W4/90YV/aFIX1YOQkdH+DxliNMSUQ1aNahRSIiEVTKBEPqs24= Received: from DM6PR10CA0036.namprd10.prod.outlook.com (2603:10b6:5:60::49) by DM6PR12MB3227.namprd12.prod.outlook.com (2603:10b6:5:18d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Wed, 21 Jul 2021 17:48:55 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:5:60:cafe::5d) by DM6PR10CA0036.outlook.office365.com (2603:10b6:5:60::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Wed, 21 Jul 2021 17:48:55 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:48:55 +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; Wed, 21 Jul 2021 12:48:55 -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; Wed, 21 Jul 2021 10:48:54 -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; Wed, 21 Jul 2021 12:48:50 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 08/12] ASoC: amd: add vangogh i2s controller driver Date: Wed, 21 Jul 2021 23:34:24 +0530 Message-ID: <20210721180430.11571-9-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e03ee39e-0e0f-44bf-f8ea-08d94c6fcf97 X-MS-TrafficTypeDiagnostic: DM6PR12MB3227: 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: Qk5LkzE7bWPgXryBOE31XGC4nwefhgTmIVHQXZ6JKWFUm+QR9g2Vw6tAzjR3ixpWErBdU8yCgLkGd6UfJ9ArGpcDuT9Pz1TcyKsyJkKermRtBMu2oObKKWC/y1gDOQhBO3MW37Ku92xDz12S4scWZtRyME4c8+DtrC2NFF5AJig2xeapRNVHQueM+8Dbt9eAN3yVMlT642gbXRkdf0ciSyQiJezgXytCM99kPIqxI9Ie16igKYU0MDDg5Wpwnpq0aGy7wIjStEm0+VYkrzHLsGU6OzpB5eXjbj5clpgbm15LBZ6I9nxFE8pUuHfpTEWMntmhpQ7HFjEmmd8k9C/tIpQE9GSb/BAYQH6DXy5ZrOEPynb7jFVWty8tm682EqntkgqsRH0u7Yw6FWNu5EMQWrR2W9bcOcFr6OTeMTF0pIaV52nIyDmTljgPbOTs6RcrrMX0aHz6Hxm8T6eV5rMZ2+3oZ7PiyXbqsGLbatwALufG48MXhKWeaJYnsxcWXJuO54OPCFT6BZIpagIPaB7gcxM3CIl2mttVyKqO7w9hvO3b4cDFcswMtuJ50wsC0zQof33pIJekeGqFLO5eAapMav8MNuJNvHLpMkTz1Oix7RxhNCK1ihAkYb2iwfkRE8wPv4j12rI2uEEhp1ZUoDfBdncRxaAoH/fMUqUhNABWNQ7zsPWtzb22xmazTzC4FkHUqSzi7ixQkudG1e2pX495IpTfcmE51ylcfvqmApdtmOg= 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)(346002)(39860400002)(396003)(136003)(376002)(36840700001)(46966006)(478600001)(316002)(7696005)(47076005)(2616005)(54906003)(5660300002)(110136005)(8936002)(4326008)(36860700001)(86362001)(36756003)(1076003)(186003)(82310400003)(26005)(2906002)(356005)(336012)(6666004)(426003)(81166007)(70586007)(70206006)(8676002)(82740400003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:48:55.6580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e03ee39e-0e0f-44bf-f8ea-08d94c6fcf97 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3227 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-i2s.c | 88 +++++++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 92 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..30b651035042 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -0,0 +1,88 @@ +// 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 ret; +} + +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 929be9905e8e..3238c1154053 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -71,7 +71,11 @@ #define DMA_SIZE 0x40 #define FRM_LEN 0x100 +#define I2S_MASTER_MODE_ENABLE 1 +#define I2S_MASTER_MODE_DISABLE 0 + struct i2s_dev_data { + bool master_mode; unsigned int i2s_irq; void __iomem *acp5x_base; struct snd_pcm_substream *play_stream; From patchwork Wed Jul 21 18:04:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483355 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=unavailable 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 F096CC636C9 for ; Wed, 21 Jul 2021 17:51:36 +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 7BA9A6121F for ; Wed, 21 Jul 2021 17:51:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7BA9A6121F 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 1906A170D; Wed, 21 Jul 2021 19:50:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1906A170D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889895; bh=bapSHXwBtxPdpRcQwF3KFRshz6vJC+j3Sp6vCQr2k6c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XqJ40fW/kmJU4EExxsL9eWmQDUH5JRm3cqIO1mkp7ZhmCmlh7x3IuYUwSss76dbmc 79Y5R52z0vr5lo6B195ZI9jij+VkNKycA+ILchswDrpPU78o7xz0f6V/adoMwYKC8R 9i66jvFYH4MnWUdZNm9H9KZ6w3lGcfLwrHPiCVZc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 49AF3F804E6; Wed, 21 Jul 2021 19:49:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6C3C4F804F2; Wed, 21 Jul 2021 19:49:21 +0200 (CEST) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2084.outbound.protection.outlook.com [40.107.92.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 68CABF804AF for ; Wed, 21 Jul 2021 19:49:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 68CABF804AF Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="DFBm2lEY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=afdCemVURmEnDWuERCi2DNE1vCmE5taezDQuPArdftxq5+mTHCmfCvIH5Xy6TAvoVlzwNbfRnYKAIh/n5EG39F5Wn0A2Ejs/F8VkmBwH02jkKpsgsV4UpSmroAFEw50qOTi8ZhXH7mUkS/A4XllfDHyzdRxy+7r8YYtj2lvHZKC8NfWGHZ98zylAKsbsmXpbJjCbMvZcAf1tcfLLEiqcAgPCvjCZo3ay6L/Kp+hy4nzz1RJAHy2rF+7Ur6C7waIEZMeFaGztsTSoqWCbV5IUgIQ+6LywVyABsJTc26gmiSSyG8vrmFoopBtdjlTR2BEp8mPp6GX9PEAM6wH5lR5gVA== 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=vOtAeZcPPhONwe+IUQlIj4ESC4u4yi1WP5x+q3CjCUQ=; b=nj/KPAK5t0RaZMkRQCUeDl7Stgff86iguHzn7gCJpDb0NjC/JHZ1bhV+Qoybyq5q1dHT0JHOiWbp6d2G8JM3sjbOmVQxZSM7Pw58EFPGRfRRUUrrRqtCRO/wg30w2sD2EOS6cERk+I28EqxIr3iTGTsq//FPTNIKUK+QCYXU1+OdpPyHBcWoX/gpOjnoXfMK3jauDukfWQgqq/ER8WvGeiy+kcHR+MPI7gtP8By76YoVNjLNW/LCwAS0+qUu1pxt9X3pOJiTbMpO50oY9jBBDWMqS4Jav3n3blM8GA4/vC8ne+MuIIWYXD09MxZ5a2Fi0vS7o0rsc9Q5zeYZJbfVcA== 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=vOtAeZcPPhONwe+IUQlIj4ESC4u4yi1WP5x+q3CjCUQ=; b=DFBm2lEYrtVXfVWHYABXCaksUiIP4VL/A8VK1Y5mqTYbbOSGXQsC8ntBPR/QBAaV0BRzmEsHvnou9XV9MMWUP8GiWrwvNYMQujgM/QRjT5Om3fatj8feWaE27t6FMiCXb8FLj/O5VuNkT3tWopdfOCFv8cAh3FSHhCFNsEhC7SE= Received: from BN8PR12CA0014.namprd12.prod.outlook.com (2603:10b6:408:60::27) by BN6PR1201MB0209.namprd12.prod.outlook.com (2603:10b6:405:4d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.24; Wed, 21 Jul 2021 17:49:07 +0000 Received: from BN8NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:408:60:cafe::58) by BN8PR12CA0014.outlook.office365.com (2603:10b6:408:60::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Wed, 21 Jul 2021 17:49: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 BN8NAM11FT046.mail.protection.outlook.com (10.13.177.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:49:07 +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; Wed, 21 Jul 2021 12:49:07 -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; Wed, 21 Jul 2021 12:49: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; Wed, 21 Jul 2021 12:49:02 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 09/12] ASoC: amd: add vangogh i2s dai driver ops Date: Wed, 21 Jul 2021 23:34:25 +0530 Message-ID: <20210721180430.11571-10-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d2b5233d-c9b5-4c9b-c5c0-08d94c6fd68a X-MS-TrafficTypeDiagnostic: BN6PR1201MB0209: 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: dK1/RolPPIfwohGxVO8TSkXC/Fda4mbxaOEMgHb+DbNZ79axRifjB8RE/cbrd8lR7SGWSoOBzmhhfVjO0XUnstJs6aVW80q2YsHnUwQJrLHUwk3Ow435k2kMvASRVIKo7lBqUnVhhf+iiX4JPbtyTCOU4UkU1c6SjRo/bKK3snRI4PYOpzOtDvTSaaKvwmhImxYrY6zFGESo6KqqPwnRt2VsqsrNnEgRMCkeaxbzVt067GkLfqfMngJVmc9nItYHAET3rym9gbXWf1VbC9tqwgy8nyIwWl6pBjMpbxIWdcB6ZZRM3ia6WrzrObnsiIBkGssatmdNCpi0KI8XOxvv439TaTZ0CcCwRnFRDSMXbt678GKAe4oR4khdRpvwaUPejYLJdE4UDFFhakBe3+wAgGgyocoMo5rmNSVfD3S535lJwCA48QDx3026bVJnuCMx1dbjz3SbcgT7Pvxgnvpou0Nb8qkzweFIoh+JeIqoaxEW70x3H3RG4pNjRiBdUhUWpElZW8LKBFo99XKIBwCO7xUDc0LtlYm3pHrR0Xney5rd8vfnZcJh1PguVNmXI13YjL/OZd6kdyXJ/xCKdbMxsC6R1Cl5fsIHEbhYtf43FJv09sEVFKv1mkvAXn2s3+dUvt0pMjAtdONLlyYBoBW0ody/4prNyZDj2Mr9HRTXdiGJqT47eAWy6dvVZ+Tog6wp0OghrUYo92W/mKsQMlkg6cPD9R5iMyvGcfsk1nr8r98= 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)(396003)(136003)(39860400002)(346002)(46966006)(36840700001)(356005)(8936002)(81166007)(82310400003)(2906002)(26005)(6666004)(186003)(83380400001)(82740400003)(8676002)(478600001)(86362001)(36756003)(36860700001)(1076003)(5660300002)(336012)(30864003)(316002)(426003)(7696005)(4326008)(2616005)(110136005)(54906003)(47076005)(70206006)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:49:07.3605 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d2b5233d-c9b5-4c9b-c5c0-08d94c6fd68a 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: BN8NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1201MB0209 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart 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 30b651035042..86b37c93c3d2 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 3238c1154053..a808635f9740 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -74,9 +74,20 @@ #define I2S_MASTER_MODE_ENABLE 1 #define I2S_MASTER_MODE_DISABLE 0 +#define SLOT_WIDTH_8 8 +#define SLOT_WIDTH_16 16 +#define SLOT_WIDTH_24 24 +#define SLOT_WIDTH_32 32 +#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; @@ -109,6 +120,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 subtraction logic from base_addr * for accessing ACP5x MMIO space registers From patchwork Wed Jul 21 18:04:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483944 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=-16.0 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=unavailable 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 43B88C12002 for ; Wed, 21 Jul 2021 17:52:08 +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 6AA716121F for ; Wed, 21 Jul 2021 17:52:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6AA716121F 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 AD692172B; Wed, 21 Jul 2021 19:51:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AD692172B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889925; bh=2/jYP/VwaGQur/IsZf0GNSzhD7rbO0Xz2ph2fMu6ufI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=bO7RsBGp8DKSb0ncSSwMNOMOWyHuCE9vaOevWLORMS2PITPpPwpHzRPLc/cEz00/Q Z/bABH/wg+DACgbq62J85PqOLTtKDpN6GVxCJo3yJMju6Sh3xwb8tY3X2StPG8sMm1 SYP2kOD+KCdcIPGvasas9LR7ntJwhI8FKDefARrM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id B98B6F80511; Wed, 21 Jul 2021 19:49:26 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DF3E1F804CF; Wed, 21 Jul 2021 19:49:25 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) (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 364E8F804F2 for ; Wed, 21 Jul 2021 19:49:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 364E8F804F2 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="LWcXveUY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zmo2DuWYiyc8GfHPT77PfubEAtCwUZtFkAirQ5K/1O3bnFjkpYA6slnh+mf+mNsNFNsPGRuNhKgFnSrSXXj9GmruwiPdsH28zJNqHEmdbcxu0iVJZtDhcUOtul0p2OjSBYA6ZseSW5wykToD0+FA31Di3RYhjmrnFzvlwa++fbeC3yLKJ+aZUDQJjq72eL33i4/ryBzNx05ft+GhUa+v+TzHhzYBaf9XoXB2Y8FYGnNmmvvz0Wg6mtF2FIRenBXeGSYPjToRpDKEacMbW6a4l/NI9j7t4dP7xvHNDpkc9IYF+AAKjgz6kKtMYUPV73/J2oZj1KvO+0+dAZVlA4J2Lw== 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=NNJCR6HTaZ0bU3oTKBP+eXA3vps0kfto7iXPjo55Qb4=; b=VDq+E7w+OOvJf/NcRgFX8nm61dZVwDA0N15TY4uFS3VPRUj/sFVZ0h9prj4JMGk4rs9VGppHtfUcYQnPm+aTIvaxqViceY9dTG2TR1j+5aeWQ2MQyX/QTiqSy4mWUcjBpACAlD1HNNACAeFanPEerpE3HScoNG+2/k1IUU3axP0ngZ1+eyyfN1N3+3Y34nocWKdPqmoREsbwB/apQFNZmcTcFvT1QvBr0dBuv00V8bEc6ykthKL/8AzOCrFVZ0tfo+hNHivPSGj2JrD55y4Cm8dQ8xxqBLlKJCp69vEpIa94dQ1wYWhoKva8LYZQx4tA+itAA+Ol01akx37tmLFC8g== 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=NNJCR6HTaZ0bU3oTKBP+eXA3vps0kfto7iXPjo55Qb4=; b=LWcXveUYgO163PEgQJfd+dFu6VMH9zaJOWe6/cSnYkXRWTVxBdSGtE7TNy/DlGMG29GX+oU5T943O6EQrYeB6DUVbv02alpqBa3o1Dmi5JVyEkO5GWYQ8VBJa8uxpNByaZVo0YgKqmMWpu52yyZerv1VUmR+FnMmtY3Ddyxem0c= Received: from BN6PR20CA0058.namprd20.prod.outlook.com (2603:10b6:404:151::20) by CO6PR12MB5457.namprd12.prod.outlook.com (2603:10b6:5:355::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22; Wed, 21 Jul 2021 17:49:16 +0000 Received: from BN8NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:404:151:cafe::7f) by BN6PR20CA0058.outlook.office365.com (2603:10b6:404:151::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25 via Frontend Transport; Wed, 21 Jul 2021 17:49:16 +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 BN8NAM11FT016.mail.protection.outlook.com (10.13.176.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:49:16 +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; Wed, 21 Jul 2021 12:49:15 -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; Wed, 21 Jul 2021 12:49:15 -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; Wed, 21 Jul 2021 12:49:11 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 10/12] ASoC: amd: add vangogh pci driver pm ops Date: Wed, 21 Jul 2021 23:34:26 +0530 Message-ID: <20210721180430.11571-11-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ff8d7d91-2575-4c36-9d41-08d94c6fdbd6 X-MS-TrafficTypeDiagnostic: CO6PR12MB5457: 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: z5UXqAovm+TIEtJb25L6uJlWKfHAIx3U8AZyi3xh4nV0umaUZShJdlSTvJOZn8A1yakp3bzkSoWsbssI0lPRtUTngWAmEISbtqrL/0zhPr2faNkTfjivs8bkz1YLK5ERIRln/kGQGVZoqYEahPCvY8L4NDkjhIF4HU3B23MyGTWJwZ1RZnquQBjs5H0G/RxIEr3Y3aApYs4s3qzB2IqQqMsSQb6CbFX6FDhtkf0GafI5dBzUpXZU3/HfJwP5UVa47U7spcnVEqtccMrQzvPXjwsnbSlsDtmplMz1lRp0OPINHwPiIFnIrNxON79kirw4HE6ug1O+12I9B4cEUNQIvSgkPyTPJh87szcx4FNLuM51mh75Da2EqsB3WyDhYjFE5r/fJ/y5prKy9CiKespZZfX5BdrFfJJ4tcpMdTb9AlF6Aj+5fSPvFamrTjbZev37W8h1w6R/fop86AvOxtlZspmGQ46XwXfaJSi+MnGox+EozUa6gW/Wy5Ot3yevoQYWp0VUkVKbkY4gs/fsOD7FmUNz73U27yQlackZDVvZANTywo0w2PxTE2ovbJrl/OFRfmp99XD2cSwFj6Hud7Py6h1BVHcmzGzeB5BL5ZDR91wbLtwbkhzmM2gGx7bD7BVkUmqPGqoIyt7CY0LpFcuFSZ8urFhnOB2R/opG2KweL1FIIh0WxjSVwWRleOrlirnTpH6L2mVcmc5aGbuhqN8x8dYJmUQqjADu0ZHhWtPzVFg= 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)(346002)(376002)(39860400002)(396003)(136003)(46966006)(36840700001)(356005)(83380400001)(86362001)(8936002)(70586007)(70206006)(82310400003)(82740400003)(81166007)(8676002)(2906002)(4326008)(36860700001)(6666004)(110136005)(36756003)(1076003)(2616005)(54906003)(47076005)(478600001)(426003)(336012)(7696005)(26005)(5660300002)(186003)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:49:16.2462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff8d7d91-2575-4c36-9d41-08d94c6fdbd6 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: BN8NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR12MB5457 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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. Reviewed-by: Pierre-Louis Bossart 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 25b42a37ad3a..a57b762d9f2e 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: @@ -242,6 +247,41 @@ static int snd_acp5x_probe(struct pci_dev *pci, return ret; } +static int __maybe_unused 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 __maybe_unused 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; @@ -255,6 +295,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); } @@ -272,6 +314,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 Wed Jul 21 18:04:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483354 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=-16.0 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=unavailable 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 A2485C12002 for ; Wed, 21 Jul 2021 17:52:26 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1D92D6121E for ; Wed, 21 Jul 2021 17:52:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1D92D6121E 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 AB66516EA; Wed, 21 Jul 2021 19:51:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AB66516EA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889944; bh=rpvh8qP+pgNi2jbQtsd9Tplq77rYPg07rXgP25koZZ4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=eVwPXda2AmeGYJgbhS2KeLoUxAFeB0daKBZU3ygMhoS5wia9knLadFdKi8apWx4aQ 2G0P79kgPIdaeaKsJggS3dy9SMKTmyZrZT3yQxSReycN4Io7ePXv4yyaC6wTezduhN 2HjBUJz0qFon8pQMD8VQB2bhuE15/B87JR3B82Bs= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6D2B5F804CB; Wed, 21 Jul 2021 19:49:32 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EF613F80517; Wed, 21 Jul 2021 19:49:30 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2067.outbound.protection.outlook.com [40.107.244.67]) (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 6AD31F804CB for ; Wed, 21 Jul 2021 19:49:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6AD31F804CB Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="nOaxqfO8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E+ns743ZeKRvwgJN+0YTShossQM6hdJqBfU+6QKvEomkuIxtYrdnrFEbdjevQfbILFcM1pmrzavunBU94GYLi2eXCip1UVvukeyIA5ZzG3fs7mO12jQoDzkujxNvfZs+Sr/IeeJnhKWPQzgpb0aAnCRK6/sCYDV3jxFW3WjUseCJTHExw6onHePtFE+mAfFAznEEw97yotyt9NXPRxAQ8BZzgMgGAxEh6UXmhLYEZvhuJNUCJT9WvJgD6KNFlG/6qAK1jKO36rwBDALrHcfLIhrS1E65zVHjTPH9W7lOqKEVncukzSl6gj1dpmSVNpVQWtZtJnOzv9u5kyp8BxAxAw== 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=Q5v7tYWv6F310EGGkyiS6cKsnggg3ufhP05f6wGnJSw=; b=Jtm2NJV1vKn28nODTcdUQiyC+O3VFxNdMHCptmMRyeRFA4ZE9ZcKgbp0un0BNxXDFR33tJB1cbLx6+rA/WxQAx4ypLTQ3yuFyeTGLA9AXLmcVQcuNOYLnSG6+0lIrL5Na567vs1WWpT3QEpKLUDZtpn7gU+kkUOs9EQl+MKD06zNIz8QQ/88xYtWOU7yfQ1msXM9rp9dhcIIsPKoITPEGLNWQ0k2/PUuBDfPAxO1quER5lBYxzB9WZUBml2SXB1qHEtckB023hrMvpIpId50S7D9Iz2R0PqecRNsZAK3QQx5DGUJ/Zp7mm4wLPC5oydylFQGErvwrrDke6q0KWwvMg== 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=Q5v7tYWv6F310EGGkyiS6cKsnggg3ufhP05f6wGnJSw=; b=nOaxqfO8zNJsDNmZU4q1feZhWGUdAry2kqnCijRP3HTpta7h/NICuaFEw8cT9+PVt+XKklP5Oc7Rn9lILkY9V+WKQb23q+XXlELponrfTQE0Vff6pwZtVKDtTnZG9k+aleIR3gQJFyNKWcL9LVnOyqV/+N3HQyfjXAiT6hsb2hA= Received: from BN6PR14CA0015.namprd14.prod.outlook.com (2603:10b6:404:79::25) by DM5PR12MB1418.namprd12.prod.outlook.com (2603:10b6:3:7a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Wed, 21 Jul 2021 17:49:24 +0000 Received: from BN8NAM11FT043.eop-nam11.prod.protection.outlook.com (2603:10b6:404:79:cafe::d5) by BN6PR14CA0015.outlook.office365.com (2603:10b6:404:79::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Wed, 21 Jul 2021 17:49:24 +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 BN8NAM11FT043.mail.protection.outlook.com (10.13.177.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:49:24 +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; Wed, 21 Jul 2021 12:49: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; Wed, 21 Jul 2021 12:49:23 -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; Wed, 21 Jul 2021 12:49:19 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 11/12] ASoC: amd: add vangogh i2s dma driver pm ops Date: Wed, 21 Jul 2021 23:34:27 +0530 Message-ID: <20210721180430.11571-12-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 25c1a54f-2470-44f6-dce3-08d94c6fe0ab X-MS-TrafficTypeDiagnostic: DM5PR12MB1418: 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: SuML+UhssTLDHj45jLxWOtqgpNYqepyi6NdrWc435y/q9TZXhHGuzR9+J+/HfeOG7c3Tp9xYxAjUySXw3NxQ3+D0d8ky/FCjEkw+qKmXB/ReDqIiQXetzK0kKWZzkl0c0quIp3iCz5ieO2RGkIkqv3gi9SkBzR4d/Au5ahTHCGTdQQIGmp9+x8WbUG6W2r4TrPep+dH68LW3KFG/VJsCwgP48vTq8IHR5a2bDx1Jvodn7+2PvhaVODDbgtGbyMJsKwysj/P4iZ5VnW5uWTUU19CZxK31Efn5OtIGtS1/tXT3R5K82HV1mjbydN7oeCWKIQ2wnifXbcWjcsn3sA4wpq7iy8s9NE5Fd52yVBL0YnfFYaOAZrMkWYwpoZZhhY9C0O5pHmiRXLJ5N1sClTbKMeGC5W+AGY8c7iOo8iGlZNZtaiox5TPow3/mu6RhufNKuiWpu+U3IFmrrXsSri2+nAwA9ooGu4ucaqaxoTZy2r3j+Yvx4uoxTJfwqTYy185g2yMmLA6S5xFwR3St5FV3F61/VL4D3xRkw//rvoo1KqVMfP3hKfDjNmqlIZ+AqPFUgd01czHZVnahxrj4orkh/00F7cP1Zm/eCYzCFaH18lTycd9OnaydRnkI4mFDAWzR3Ps5EGo92UhF6+F8JrFQpEYoRZb64WpBwcHD86ULjMdXVJHdZEs935d6FMTrL7Ee+KDhbbaAwwuBkuX2X6i5KHfQKcqNrdxRNzl3x1ESRTw= 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)(36840700001)(46966006)(83380400001)(110136005)(47076005)(70206006)(2906002)(86362001)(26005)(70586007)(7696005)(54906003)(36756003)(186003)(36860700001)(1076003)(508600001)(8676002)(426003)(6666004)(316002)(5660300002)(8936002)(81166007)(82310400003)(336012)(2616005)(4326008)(356005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:49:24.3546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 25c1a54f-2470-44f6-dce3-08d94c6fe0ab 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: BN8NAM11FT043.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1418 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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 Reviewed-by: Pierre-Louis Bossart Signed-off-by: Vijendar Mukunda --- sound/soc/amd/vangogh/acp5x-pcm-dma.c | 96 ++++++++++++++++++++++++++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/vangogh/acp5x-pcm-dma.c b/sound/soc/amd/vangogh/acp5x-pcm-dma.c index 6296b353c7f1..9f8eb72ac834 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 @@ -412,16 +413,107 @@ static int acp5x_audio_probe(struct platform_device *pdev) } status = devm_request_irq(&pdev->dev, adata->i2s_irq, i2s_irq_handler, irqflags, "ACP5x_I2S_IRQ", adata); - if (status) + if (status) { dev_err(&pdev->dev, "ACP5x I2S IRQ request failed\n"); + return status; + } + 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; +} - return status; +static int acp5x_audio_remove(struct platform_device *pdev) +{ + pm_runtime_disable(&pdev->dev); + return 0; } +static int __maybe_unused 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 __maybe_unused 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 __maybe_unused 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 Wed Jul 21 18:04:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 483943 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=unavailable 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 78637C12002 for ; Wed, 21 Jul 2021 17:52:48 +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 F11696121F for ; Wed, 21 Jul 2021 17:52:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F11696121F 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 8DD9F1726; Wed, 21 Jul 2021 19:51:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8DD9F1726 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1626889966; bh=LbROePcpRgE2pneRfGUc83VIzy87yLoqt0oR/FouC/0=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Uo75Qk8d6dmVzi77E8QF794nCSpkPFkzPjuhzzwFYhvTvTS4ASyXiAthdj2ktib0e /f4/n0ddF//4YC1qKfSL59DnCCY79sC+rhwpLPcOhS3AiDs1ea31km/l+cM8J5RsUL vXfaql2Uq+QfUZWgIoExwUGM+fkTLGabiDx8Zdek= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 359DEF804E3; Wed, 21 Jul 2021 19:49:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 558E7F80519; Wed, 21 Jul 2021 19:49:50 +0200 (CEST) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2041.outbound.protection.outlook.com [40.107.220.41]) (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 AC3E1F804E3 for ; Wed, 21 Jul 2021 19:49:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AC3E1F804E3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="KFpz4qNd" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=O0XreG9fBDYtfH7tydyn4NC8YlMJczfVdMBz5TtPh3MNo7qnxkF8sKKjL3JGG/jwHMKZixpxSm6wGZwjt4ImDRoCwiCuRK6opjhET6JAHBhi4aOJa+3h3ekjbUMhpuOPI+W03pDiJMHrF5p/Xez1xGBr+Dsc8/lyvN2JqnB52wLOWio0lL/u+OfuqvXhNPTLV+AMcCN2Dr808n14H0OMkcITRsrqwR3glG5i5pnDxTcLDjkUxwudRk7Q3kdVegRWT6iKjJgxih10AD3As8a6sdL3Co880TGmoYUPuWX6feBf5n7QZC5yUZKv0b62Y4UEjEBuOXotbBfoHeubYDCUwg== 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=2Z/QKZ6yCdg3W0Ocf+80OCy/X6g3dOAUC30XNg6w35A=; b=mSrHj8+D+ukhgGL4ZmGzKfpF8Z1Igu1GKCvxB5jTIblPUs33eVM5EvliQKD+UYZGSLIadxBR4gtSK177FMIw94/n8teuhBQT08LsuQNuTT+EdOIDfNPHLtxwfG5uCBQZNxui7cZ6Oo6m3TiRkQcGvZ6kOgTkMGZ0pcD3kLdGqa+PWVR3hXviYaWodtQbRmOrnjOLphApF/lGijYfpPt9OsHUYArGY2pyd4nG6NE8/0iOn9iIGKPj3elaBLEi6IkjiwB0Z1I0OOhi6Du6RAefiOte5BtgKGl5qS4i5UGjP0zca6oYXzMDgC11zILhCRDu4GfC7oJZ8O5Xu5T9BlNOQA== 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=2Z/QKZ6yCdg3W0Ocf+80OCy/X6g3dOAUC30XNg6w35A=; b=KFpz4qNdTnSosO2pEtVOnpkJ3WDa+CyKm54VSPd6A6SegOcDUgK5hYZ0sV6hksPpdDABrNk52UFJ4v8rU3iLlvFbT2RUnEB7zJ7jVzRaywWufFiBI1AnHWHRAP2fDP0zYstGR8nWpeayv0vzVbpOdwR86/PDbMtR/d557t8gbBY= Received: from DM5PR17CA0060.namprd17.prod.outlook.com (2603:10b6:3:13f::22) by MN2PR12MB3117.namprd12.prod.outlook.com (2603:10b6:208:d1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4352.25; Wed, 21 Jul 2021 17:49:43 +0000 Received: from DM6NAM11FT035.eop-nam11.prod.protection.outlook.com (2603:10b6:3:13f:cafe::90) by DM5PR17CA0060.outlook.office365.com (2603:10b6:3:13f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Wed, 21 Jul 2021 17:49:42 +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 DM6NAM11FT035.mail.protection.outlook.com (10.13.172.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4352.24 via Frontend Transport; Wed, 21 Jul 2021 17:49:42 +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; Wed, 21 Jul 2021 12:49:42 -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; Wed, 21 Jul 2021 12:49:32 -0500 From: Vijendar Mukunda To: , Subject: [PATCH v5 12/12] ASoC: amd: enable vangogh acp5x driver build Date: Wed, 21 Jul 2021 23:34:28 +0530 Message-ID: <20210721180430.11571-13-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> References: <20210721180430.11571-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2f5905f9-d742-4f1e-bd51-08d94c6feba6 X-MS-TrafficTypeDiagnostic: MN2PR12MB3117: 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: OA+otcw923BxgRKpH/0tuG68ZDo52lmSRiFoYdXTXrf4ubnGBNTHEBBUdsMPCvFzdjiP/QFRXCH0WVHJl0LBV2Dhzg4pwSjW6lj7FP0T/e/GBSeoSsZMQSay6Bj74o3XNCLVnqS9Wdy7djQmYb9lD8ZaTem6ACOwgau9PCMRFfOApOw24ktasdrroMRzmyM4b7QxpBVg27qhUK7KdsCuZQs4HjiasA6/lP2oCJX0Rn6jXQisT5PmXVerW5EU8PWLSMSd6BqT3/a0SbxPT1F6i+syQ6k8sW2N4r3bqTvj5Pyjrv3GLMlpBqGW12/V5mzvwvJ7uK7G0iI8aNmQMpXCdmm/ZzPntRPdFXU2TYZqLJu39VYIHnmzClPtajPRLloX2q0CwTWIWHXD4xtJhKvjN/IymfYG7HpJtk1/7QyrJ54rYXv/5DOCnBuIMxg5uItajR0rnrG6jR70dvuZQ9yNgX8uiv7+lJtjlRAr5BJo5wYSZjdeje2cnxDfFR2mOdpCaxF+P8prXgqzPZeNm5dwPSj8ofPXsb9sYHBbB+onw/c/Z87DMga/jhGppJOrj2ZED44Z0NneoYmrmT8mwNxrw4mATSnsIVqF0lFftcZdlE7mZoNQ0399RbTIWGucqvSEgDGcmQl9JRX4t7CU3XlYWiu96ND8MPqxnuVyNwm2lFINhjbtSmNlqvqrSLfA8u9VaGUeadt87Q4YLKPunlZtJF7Wzu9468QgKkydy0dCDTNkzivNLLkp2Osz1NQ31jlDIiUCygUbIyJ2T6lNlztWuZkhUULiuz03dhhtYYNn+L8= 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)(36840700001)(46966006)(26005)(5660300002)(70206006)(70586007)(426003)(36860700001)(7696005)(186003)(508600001)(110136005)(316002)(54906003)(8676002)(81166007)(2616005)(2906002)(356005)(36756003)(1076003)(6666004)(336012)(47076005)(4326008)(82310400003)(8936002)(86362001)(42413003)(32563001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2021 17:49:42.7260 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2f5905f9-d742-4f1e-bd51-08d94c6feba6 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: DM6NAM11FT035.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3117 Cc: Sunil-kumar.Dommati@amd.com, open list , Takashi Iwai , Liam Girdwood , pierre-louis.bossart@linux.intel.com, 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" From: Vijendar Mukunda Vangogh ACP5x drivers can be built by selecting necessary kernel config option. The patch enables build support of the same. Reviewed-by: Pierre-Louis Bossart 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..49ff5e73e9ba 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 driver, 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