Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1590155pxv; Fri, 16 Jul 2021 12:47:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbrAIE5Kc5FJw51CosXhP4dePDoDrFT9uRGAJF5Z+v4WAAnjjzRQn3+uHA7bhy1UhRMAl+ X-Received: by 2002:a50:cf83:: with SMTP id h3mr16455161edk.338.1626464872321; Fri, 16 Jul 2021 12:47:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1626464872; cv=pass; d=google.com; s=arc-20160816; b=CnvqgIyyq4kTE9fUOnONklqrNNb8GfhdsjI3CRUXcoGUI6RicIGg+rZQTJ36uCvi6C Ie253DzE5t0LSJmYcD6wrvWSGofKygqaX0xgI9HEOQfm8e7zew64I2FuzTAxuDAWaTUj z7DxSf/7BIuqOkSR9A07Melo69qXZ4e4QjWvfuqA25GjPMQMNYA/2ASfKdbCTJU687NW 6R721hn/YG1Pv88vPF1cwQ4CvJLqaCjRGNWucGFoVMyUgz1IqY0SErLq505ZHI6rrDns vvheAtrN3A57e6yGmUBuuTHWixlisuOSbdmgp0m3wvzqPmP8MLvZ8sjc1pe0wTPqAORl mKcg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CmTVc+i6HgQnntdEt0XT59Ou8nXAAJ8Xyr6MTgYkBgk=; b=ww0qX2EEc3HUsygsbTavOdlCd1vI3l/gOavLb7hB4CwnMbFJC2F6q11GLstWxpC+Xk SJiTtFWAhuzafzck8iDntQLZQGzoHtH9aJCULBRADZJLc50CZjc1N8CUaPe30yn4O0wI xf542TRjcOYsgd0umTSvhFAME6SjYGe3S3ziYPPr4OFpURpZGQfydVNZSkkSIc/ugb2C soBHbaW46C9v9Ul2vmqMVBB8z2NZcNLWRPAmNFYgiFeq+bV6fxm+wPWpmGBUwLGp3e3w tzSH85g3rpKJYV0n9Pqb2dIrRLuhJ55Oxr3OWBB0jSZuJJXIqUddb2rAeoEJTnpMYPgU 0ZFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="XO7t+CK/"; 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 d26si13307454edr.445.2021.07.16.12.47.29; Fri, 16 Jul 2021 12:47:52 -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="XO7t+CK/"; 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 S232888AbhGPTqj (ORCPT + 99 others); Fri, 16 Jul 2021 15:46:39 -0400 Received: from mail-mw2nam10on2059.outbound.protection.outlook.com ([40.107.94.59]:12800 "EHLO NAM10-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233755AbhGPTqi (ORCPT ); Fri, 16 Jul 2021 15:46:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IbP8q2Zw2YylLqRxE/+0mmz44905S1cIgTV0MFD1aDEsKvOuH+0idOLP7vHAvnF5CRba/u8L9Fxn8a8oN90K8o9Ah7NGxpfABoY7F4C2sBWN+BGEL1I9++oMC5Jq7NZmo8+g75r05b3wZ4wxBO7zNRV1Abi/Mr+wlNJj3Nlbj6ZEUYgeoYoh35IjsOmLFhnODKcb1tnIBoqH3y1u5oOb+iLHzwSMD4joe8RgewBfqlhSCNBt84XWju8ISBghBAqu56gs+WVVu5OtHNpqwQ81kAvtJ5zxnySM6wwLYKhxL+KCebR17OPtHBJQxdY91+lIjt8G9/dovtxDqi0aLh4Oxw== 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=CmTVc+i6HgQnntdEt0XT59Ou8nXAAJ8Xyr6MTgYkBgk=; b=DJdgYwX4WYtZERZAmyyiqgrjedZq8j2dPOeKLkptaO5Wdkp1zxG7jY1Gv/nHjdq99nyOuhYQILUocLMN5RuT8ikEjFHiZagb114R0+s/EdlsPx7sGZLMJdDCn9XykZY2CKyk7hv2dKIqzk4iyJ2yhxlcFEIH+/ETfqFcSw0THSqOi8gTfFDP9/NkuKZGjIpv268me5CfiPljNyreBINDXCOgLcSVioVsEoxM0cC5a/fGkmD4m0iIrjVpm6/d9dTOFdsCyMukPhSAdh5PvFJo6EW63aezjRqKk8w9w2EkRXavZ5RlqIStcqQaFzy3o8Dz2+h1StZoN1gXoy9Zatuf0g== 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=CmTVc+i6HgQnntdEt0XT59Ou8nXAAJ8Xyr6MTgYkBgk=; b=XO7t+CK/GeKmCqJeyVQ+M9/TNM2tRnc4DujZ6Ye5NWjcrfMGW5z8ITpMm3TTNAv4mdSbXqiHwGRsnLKzNngFz/xwUGlHpaC4A6edOyWyi01y+G4E10LnZUYWlwU7hPCNTPDvrZhhdgJuJByoRNT9n1fOHaxU3HZzEq3p1JEI70s= Received: from MWHPR12CA0059.namprd12.prod.outlook.com (2603:10b6:300:103::21) 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.4308.25; Fri, 16 Jul 2021 19:43:41 +0000 Received: from CO1NAM11FT023.eop-nam11.prod.protection.outlook.com (2603:10b6:300:103:cafe::48) by MWHPR12CA0059.outlook.office365.com (2603:10b6:300:103::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Fri, 16 Jul 2021 19:43:41 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT023.mail.protection.outlook.com (10.13.175.35) 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 19:43:40 +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; Fri, 16 Jul 2021 14:43:36 -0500 Received: from vijendar-System-Product-Name.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 14:43:28 -0500 From: Vijendar Mukunda To: , CC: , , , Vijendar Mukunda , Vijendar Mukunda , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , open list Subject: [PATCH RESEND V2 08/12] ASoC: amd: add vangogh i2s controller driver Date: Sat, 17 Jul 2021 09:30:55 +0530 Message-ID: <20210717040059.310410-9-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210717040059.310410-1-Vijendar.Mukunda@amd.com> References: <20210717040059.310410-1-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d8e2401-34c1-42a8-6a16-08d948920383 X-MS-TrafficTypeDiagnostic: DM5PR12MB1418: 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: xpbiyqxb+68UWqUK3Y145isSEgzwEoAr2oGuOiLkGH5Pm8RD8Dg44Pj2zp9hIpKqYWJndRinC5polM0Pbz+4hlF5b7LQ9xpWd1lvRTlWS5YJHDrmwdhO47nDI/GFXNWi5uIPLOcJLNKZlLQo/nloFPLm35NDCBqzUXihvrLKIpVGiI7Vcy+27OhAmh1gaRkrR6TIycIgsqYHCZk+BWyhx+65lmEkMk9Uk2cX54xM4MgZt6r1LGXnn4wvXoPup26Mq6ZU6n+dySf4IYMZXeYtnvpgxNtGevUXsCE38o48IIdxSejKiuxdls51bbiELOYmwDeG+Rn9he+WjaDrjFjS9UM4krOANg0ORKVLwzRDHVsBtluSboCdB+Ja1gWLyAuMzbtu3peUMLLFS43AmDDD4vgN/PhIDfInd+n6wfibmaNkYK05eXXoZFTvIIzfkhPpOSoC6Q05aQ6C02NUflGHjRLZ/Jy+cID2GdDhd5lsN/rxA7h3wZWz2/VLQnIQCsHkn2Vm9ZZDyGkz20LabnxR/TEhQKvgVgYpCtLzmm3gJOMPlEyj39wTbuuZByyVvlZqA+5YdTGKrA7F6myl0Tqw+3K9WeeST+2yB0GOWLBxgOiwYljS4TeibW6YF0k1ULmx8WCRJ4PyFj5bqczTmYKPD9lJP+/YAqwj69F2q6uBJpY3M2xEfNHQm25iz1dgpNDdvFre5jfZfG+G5R+lX+i/aHqu5MDo1r+OnyyQ/8PBcgU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(46966006)(36840700001)(70206006)(8676002)(8936002)(316002)(110136005)(508600001)(4326008)(356005)(2616005)(47076005)(26005)(1076003)(81166007)(6666004)(36860700001)(426003)(82310400003)(186003)(86362001)(54906003)(336012)(2906002)(36756003)(70586007)(7696005)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2021 19:43:40.9305 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d8e2401-34c1-42a8-6a16-08d948920383 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: CO1NAM11FT023.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1418 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vijendar Mukunda 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.25.1