Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1371881pxv; Fri, 16 Jul 2021 07:56:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4JZX/P/4KKwPU5h+qbJ3DctueQRLE2pGOq0R97Y6at0aTQRi97+LsbGDZiRW9cEoahqqK X-Received: by 2002:a17:906:3ed4:: with SMTP id d20mr12429890ejj.515.1626447417499; Fri, 16 Jul 2021 07:56:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626447417; cv=pass; d=google.com; s=arc-20160816; b=GYkp3thlM1pU55Nvr/+jaGblgSXNNuxAXxGen2YjsnJCV0mseuZESk6EwnB3WAJWMU KcZh/ezDCTdh2SQbwMYpwlxBrKio+6o0Usdu0UW4X5+y4jZxgRiXsFuK6ZtuHMaS1xKG 0YkQ1/ipZtDtaP/MIzrejQf/vqnrT6ZOd5Q1wpLkC8h1jFC6JitESvnM2wLTwm7wWJlW 70OY63ROgRYDnLxDUtGl4PJD07yRH4GIftavG0cUQ24uNjbnoj3KU+5SVBXCN/bUcqSW bMrCepA+x3h3aYSiSH4oqbRCFgQJQIi574b++/M4qxxdEeDmQLIh+w/sr7lihjV0n7KT 1DIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9v0EeIcOvaIqeBbbic98N8zpspZ6Wv8lCbTW9ohSKHQ=; b=hCIcqDSWl4/aRtJ5ch3KH1Q44+FnffcihxVrQ7YYNsOSh0sjKzK2ZLp7eFx+y6pIDy wBPHMICt6/mtWkYB5yNDiI3Yq4RPPpRStZ8EwywtO04h2WcvyZ+AuScYHl1qkKCu3ILj yrtXE1AHLeois7TsN/hrEKWy2GNwgNbO28gQ+0NWbw99C3p1Qd4NBbWzNP/uG8DmzU7O FE0P7pC1MvIN1VlLlqSJkzKdK0bZOS5WGS6gNDCAYSfz6QpR02uKFk9f+coIdzcAf/6f 3domtzHJfPCBW0fPV+2A8EqAZSeZdI/W5ElRXMzLhijwDjWw/DEnKjgZdedlr5slgkf6 4Rog== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=T+8BKND5; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11605744edc.137.2021.07.16.07.56.34; Fri, 16 Jul 2021 07:56:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=T+8BKND5; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240600AbhGPO4C (ORCPT + 99 others); Fri, 16 Jul 2021 10:56:02 -0400 Received: from mail-co1nam11on2076.outbound.protection.outlook.com ([40.107.220.76]:47101 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232988AbhGPO4A (ORCPT ); Fri, 16 Jul 2021 10:56:00 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSzQtqKWSjk1GqVCuTqfIwO/mClMEAvaiCFsNWKbDD8raNVVay+kVvsxUQMlrt8eRFitXv8lwSoNULFletTiZC5d32FHV793heKfBvd2EE8zJpgqyFkmfjE/mAMXrMHl3bIMnG1mJLzFd5LjHkza59ml+EeM0V4xv1RvkJ8DiKO4d8hnpgRfXz7uwiTp4FuNpM1eGaUMZScb9xmbBQhl1XVt/OFFhccAuh4lndsPFNxSD/QNwPeTWLoyNUAjt8pEqfEWSCHVqPccG2c82jyqg8Esy1+wEFH7AarPvX9TzMg/qufQoZVhBFAkgc4xaNwgUiL6xN0fdD8iWWl5y09Hpw== 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=9v0EeIcOvaIqeBbbic98N8zpspZ6Wv8lCbTW9ohSKHQ=; b=QRbq3iSLHP0kJKzi6NSEQOmOniLYv0XLPjduy/0RKa4kK55p3+9Y+mKBP59XRJnpp4okwARZRCou0hwv+F8Sk727yh8wV1QAeOkIY2FfVsD2vwsm5el4DDzFGur92lwIQ2CGcijhUh/pAXGdaZr8LErL737hToJABpvPCSG7Ys15bclcaHBbYutYWN4lcd3vIS55SbyOUNIj5CYow6revVlhZNIG3hFQBMV0zHrwaOhGXSTvcele9tsXpE4a+CTlAvJoQB4r30fTwolbXxrH5grcPW217PoVqd2QsUnj2ejjIJC2/6Sv6r7JVdfSDWSZgjREuihw6W6pF7FArnyonw== 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=9v0EeIcOvaIqeBbbic98N8zpspZ6Wv8lCbTW9ohSKHQ=; b=T+8BKND5VRBr+fDPD+n4Z9m96rNJbRfNKdbaFoRUnj5mimrxTI8DrNhnJ4eMOJpjL5FCQF8bb6fRW3QGqzszMAE4MFcfpS5DM57ry5NuMUkeSYlf4DMiuXA1V34uuR7l+b1Xn/LfLB2AspSbaOXyq6QGMdOotYWVfFUxYI/nBIA= Received: from DS7PR03CA0298.namprd03.prod.outlook.com (2603:10b6:5:3ad::33) by DM4PR12MB5120.namprd12.prod.outlook.com (2603:10b6:5:393::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Fri, 16 Jul 2021 14:53:04 +0000 Received: from DM6NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::58) by DS7PR03CA0298.outlook.office365.com (2603:10b6:5:3ad::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.24 via Frontend Transport; Fri, 16 Jul 2021 14:53:04 +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 DM6NAM11FT029.mail.protection.outlook.com (10.13.173.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4331.21 via Frontend Transport; Fri, 16 Jul 2021 14:53:04 +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; Fri, 16 Jul 2021 09:53:03 -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; Fri, 16 Jul 2021 09:53: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; Fri, 16 Jul 2021 09:52:55 -0500 From: Vijendar Mukunda To: , CC: , , "Vijendar Mukunda" , Vijendar Mukunda , Liam Girdwood , "Jaroslav Kysela" , Takashi Iwai , open list Subject: [PATCH v2 08/12] ASoC: amd: add vangogh i2s controller driver Date: Fri, 16 Jul 2021 20:38:05 +0530 Message-ID: <20210716150809.21450-9-vijendar.mukunda@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210716150809.21450-1-vijendar.mukunda@amd.com> References: <20210716150809.21450-1-vijendar.mukunda@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 881335a4-0cf1-4308-ad63-08d948696a6d X-MS-TrafficTypeDiagnostic: DM4PR12MB5120: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:14; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LHYUKf1vP8yxbfZ3Fp56cDr3k0Q+X3B9qxc0FggPpEtCOefsSah+MKFu2goEO17kh7P1efEcYYen+EIbE2F1kna+1I38aSQ6wFaftzmroE/JKMOWUh+PCa6jVN8mk5+x13FXLOz22wVPYQ0Yf5IhY94yUI+TZk1PUaSesKPduw8Q9nol2hyK8aueZjePbqQ6F6x3jnAZ8/a4ls/psdg23jLL/weFXMpH05IXlE+U7geXNwDZBf2LhU/Xj12CRE1SUYHc2OwbKGLf9XsGXyjbe1TRJp+rU3BZu0SSOozLBxMG93QeyECa4VgYlrXxnCKT+a250Fz3B7Bd5CRXawKo+y64bNWGUmlbzQMxrYVF4uA9E3Nh7HIlgGV/hdesh7mTK6STllWkePET/h6AlYp4pysuZb+fmxgwxhdHzKcDDobFe2qxYJv04IN4kW3Y/qtn79Fsa7CWu6ASck16u+Fc5Qumkt+xpqFzBxoS/8bGhq2Pte4FBipFFVcmvQaCQTweRfK2goIqcTpqPZv+egI3vaYmbOHtExy5k/vgJRxFCgyqS+IO9c0q+kdOjl23CSff9cmTE8+NDkXsx1AlJWYeLTpnoIlEZuNRgrDrV0lXbGYQYv63W7Yp19rLNMGkWbmuemDYN76iQC7UyMPHkRBsxw6TUK+cAL8XCfcT/T159XTognmpPLWLup59rZ/BLFSdlFhBAUgbq/NNN822ucqKFal0V481x5cWcNgP1A8upjA= 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)(39860400002)(136003)(396003)(346002)(36840700001)(46966006)(1076003)(426003)(356005)(70586007)(86362001)(36860700001)(336012)(70206006)(81166007)(44832011)(47076005)(110136005)(478600001)(54906003)(316002)(4326008)(7696005)(2906002)(8936002)(8676002)(82740400003)(82310400003)(6666004)(26005)(186003)(2616005)(36756003)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2021 14:53:04.3015 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 881335a4-0cf1-4308-ad63-08d948696a6d 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: DM6NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5120 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add Vangogh I2S controller driver to support two I2S controller instances. Signed-off-by: Vijendar Mukunda --- v1 ->v2: drop acp5x_dai_remove() API --- sound/soc/amd/vangogh/acp5x-i2s.c | 90 +++++++++++++++++++++++++++++++ sound/soc/amd/vangogh/acp5x.h | 4 ++ 2 files changed, 94 insertions(+) create mode 100644 sound/soc/amd/vangogh/acp5x-i2s.c diff --git a/sound/soc/amd/vangogh/acp5x-i2s.c b/sound/soc/amd/vangogh/acp5x-i2s.c new file mode 100644 index 000000000000..93fd0372df29 --- /dev/null +++ b/sound/soc/amd/vangogh/acp5x-i2s.c @@ -0,0 +1,90 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// AMD ALSA SoC PCM Driver +// +// Copyright (C) 2021 Advanced Micro Devices, Inc. All rights reserved. + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "acp5x.h" + +#define DRV_NAME "acp5x_i2s_playcap" + +static const struct snd_soc_component_driver acp5x_dai_component = { + .name = "acp5x-i2s", +}; + +static struct snd_soc_dai_driver acp5x_i2s_dai = { + .playback = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, + .capture = { + .rates = SNDRV_PCM_RATE_8000_96000, + .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S8 | + SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_LE, + .channels_min = 2, + .channels_max = 2, + .rate_min = 8000, + .rate_max = 96000, + }, +}; + +static int acp5x_dai_probe(struct platform_device *pdev) +{ + struct resource *res; + struct i2s_dev_data *adata; + int ret; + + adata = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dev_data), + GFP_KERNEL); + if (!adata) + return -ENOMEM; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(&pdev->dev, "IORESOURCE_MEM FAILED\n"); + return -ENOMEM; + } + adata->acp5x_base = devm_ioremap(&pdev->dev, res->start, + resource_size(res)); + if (IS_ERR(adata->acp5x_base)) + return PTR_ERR(adata->acp5x_base); + + adata->master_mode = I2S_MASTER_MODE_ENABLE; + dev_set_drvdata(&pdev->dev, adata); + ret = devm_snd_soc_register_component(&pdev->dev, + &acp5x_dai_component, + &acp5x_i2s_dai, 1); + if (ret) { + dev_err(&pdev->dev, "Fail to register acp i2s dai\n"); + return -ENODEV; + } + return 0; +} + +static struct platform_driver acp5x_dai_driver = { + .probe = acp5x_dai_probe, + .driver = { + .name = "acp5x_i2s_playcap", + }, +}; + +module_platform_driver(acp5x_dai_driver); + +MODULE_AUTHOR("Vijendar.Mukunda@amd.com"); +MODULE_DESCRIPTION("AMD ACP5.x CPU DAI Driver"); +MODULE_ALIAS("platform:" DRV_NAME); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/amd/vangogh/acp5x.h b/sound/soc/amd/vangogh/acp5x.h index b7bd5cb1906d..fbd5cdf44cb8 100644 --- a/sound/soc/amd/vangogh/acp5x.h +++ b/sound/soc/amd/vangogh/acp5x.h @@ -70,7 +70,11 @@ #define DMA_SIZE 0x40 #define FRM_LEN 0x100 +#define I2S_MASTER_MODE_ENABLE 0x01 +#define I2S_MASTER_MODE_DISABLE 0x00 + struct i2s_dev_data { + bool master_mode; unsigned int i2s_irq; void __iomem *acp5x_base; struct snd_pcm_substream *play_stream; -- 2.17.1