Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp11124pxv; Wed, 21 Jul 2021 14:04:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsX2KWcSGzSetxNTmBeWus5iaI4IB8EdG/y2/dJXkWHsgHm1aGRcC3fYsGmalc31XzKZAN X-Received: by 2002:a02:c013:: with SMTP id y19mr32466206jai.36.1626901450061; Wed, 21 Jul 2021 14:04:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626901450; cv=pass; d=google.com; s=arc-20160816; b=SRqsJ5utfSpgpqcZGyI0dBCmPxYgR53V1/6qVLn4831X2Bcibpv63sDDxqeoGFDAyH EL4zEf3RsZJj1nMYYvIjzHsgKYcf3WFwuP7u0+QFeYB2Q4xTylR2Nv47QTZOLcf2y0YF slpd1J0K/cDvPhNAcFfv0uGPW9HF+9nrXC/pDwUHGs3JfYYYO42Dt3BIyUXZkeR7k9Yq 9jI6Gy9NVl6MBNe0MSWG8b0b+gCJMrUOf4nl0/X6VBCCZ2He9AhOO0UDpYisbrkUPGzh HPkOSxboj192qHbk8OiuRCjTy7nomoVPdwDkbhQC1ambHp0rhqa97vzjgXnMUUrNpRoa gSTA== 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=+safQbXcU0Mnsj+HYozuxByaF2zXwOPApsfItM/zHqw=; b=ADtnEG1u6Vh6/tAsjHocWq2bSDtLwosWvyKypM1PVnsj5+sr3lW5y5fa4L+kdMBdLc FMJkvOysLXqPqO1oHmRwqfe1FuQbo/oUTUO8p1Iu41YPUvx1+jpB2rKTz9yTb/vjlb8G 11M0ib4XfnMPUNWUaxO8PP09EK5fvLq4sWfOuBhQ44Qas4mVrs/5wbX64zRRC7BBdYnh GeFrPdE+Kgm9XUqOd3tZPnPiMMCqqJfuDWcsN7PiNpmxDf48krUT7CT39mq+39XnK4lk R6KfX4Lc87w0afjK6ywa44xz6CuS4a04ZAUyywn9D/5GaDd0wPD0F4bVbQhM0LXs8jK1 SDNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=KheNcxVn; 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 j25si16384674jaj.93.2021.07.21.14.03.58; Wed, 21 Jul 2021 14:04:10 -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=KheNcxVn; 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 S236899AbhGURIc (ORCPT + 99 others); Wed, 21 Jul 2021 13:08:32 -0400 Received: from mail-co1nam11on2060.outbound.protection.outlook.com ([40.107.220.60]:29594 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237460AbhGURIX (ORCPT ); Wed, 21 Jul 2021 13:08:23 -0400 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: , CC: , , , , Vijendar Mukunda , Liam Girdwood , "Jaroslav Kysela" , Takashi Iwai , open list 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 Content-Type: text/plain 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.17.1