From patchwork Tue Dec 20 07:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: potturu venkata prasad X-Patchwork-Id: 635485 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 73F59C4332F for ; Tue, 20 Dec 2022 07:24:24 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 318372AAD; Tue, 20 Dec 2022 08:23:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 318372AAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671521062; bh=wM451gIICXxkkvvMXV5+WJmmEKB2mVQF4Haz+DOqC0s=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=Z2aV7qswJ9kVijMqzKLn/s18hVpWdylLrkeoZvLSxt+y7qh8bTFRYB9zUYCVh+FNs X7Yjz719WAc4V2tvsQhiFdVgRGEb4w4KPXgGsNaR4oq9gaSJ/KyLppKfb1ung91GLv Fb8S0lZKQZe2IJ1vtKdMFxmANpOQEu6filaAjVBE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A9EA4F801C0; Tue, 20 Dec 2022 08:23:10 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B2045F8032B; Tue, 20 Dec 2022 08:23:06 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2054.outbound.protection.outlook.com [40.107.243.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 38F28F8025E for ; Tue, 20 Dec 2022 08:22:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 38F28F8025E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=1eUzgbCl ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tq4TL8lkBNPbqekHfdB4r/ZkRKxGYIbD7sBsl7JB0YihMDtdYfXSEYD6hosBmmsl19X4xDKBN7Obqy2HzP2Tx4Pwn7vrLpG/tNLgHv2/ihVCEUzxyegie7/rq40sZo+4ibxLGcmsEe3wjqcH1CLdlYtJs7U3fJrXiiq51d1thqw+53eD+ts/Qet2QdGx8E2E0PPd3xDiCXtrSX+YPukzw5XA6ZHaMDwJUJ0e/P3mLExasOClMfNeO/0l1Hmry+VOuAKdqG7jcvAmczMVYEQo/ZPETa2BfNmrnENPH3tqXaNZrmNnqqDGyjmg7w83l6ZMEXF1s64GQU+67HdSgbu16Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9FdkS6DEfFHEze2HIBSshFnNVres1tCHRpjco96ctNQ=; b=J6qc7NGkFWt3dLU7j1DMJ6ZZR6deu2yzkFzl8kui+QdMoU1a9uIe995pYgIfrgZ28/mQ3+hVp8kVQWuNWKtYwJiGfG57LcLnfUz9iTkrohJeu34YZi8I3ts/AO8ZldReS1zl8JUXfy+q+F4MeBAprNh2xiVxW+5V1Bbm9bi76NsaR/MpjCPXltgsI7aqO/4a4etZ+ZSSLAvdWBr7MBCgKJ3e8kA3uKdMeSTYcieyC++sTX3mXJrkechIZ48WTW9dI5SL3eHb6tlzepgS7znWIBoDkRMgCcyGLjO5Nx+o1pY0beiM71u2VlILSiSiwUXItsCOwIk121dFvCxc/UmPGA== 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=9FdkS6DEfFHEze2HIBSshFnNVres1tCHRpjco96ctNQ=; b=1eUzgbClPemi/EwhKlDwgvtIwqgPMAkYlsvVqbUr6thfFNXgzh74WnjSwq7s0ByQnC5vGlIcihKRCg0NRc8vPaVTdwKYFaiUWd7b25iVgdZfl7AAgLwDPKXBTEe/itJk9ajBOSy2cdwaEPhnaNkpaKqgDfTYI5gd8JX2BP7gR7s= Received: from BN0PR04CA0016.namprd04.prod.outlook.com (2603:10b6:408:ee::21) by DM4PR12MB5914.namprd12.prod.outlook.com (2603:10b6:8:67::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 07:22:54 +0000 Received: from BN8NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ee:cafe::40) by BN0PR04CA0016.outlook.office365.com (2603:10b6:408:ee::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 07:22:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT026.mail.protection.outlook.com (10.13.177.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.6 via Frontend Transport; Tue, 20 Dec 2022 07:22:54 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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.2375.34; Tue, 20 Dec 2022 01:22:53 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2375.34; Tue, 20 Dec 2022 01:22:50 -0600 Received: from amd-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 20 Dec 2022 01:22:40 -0600 From: Venkata Prasad Potturu To: , Subject: [PATCH 1/5] ASoC: amd: acp: Refactor i2s bclk calculation Date: Tue, 20 Dec 2022 12:57:01 +0530 Message-ID: <20221220072705.1456908-2-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> References: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT026:EE_|DM4PR12MB5914:EE_ X-MS-Office365-Filtering-Correlation-Id: 59515763-6905-40f9-25e0-08dae25b02ff X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hhuIq7NkteP6/j4q6RIzBaSZVYJUvTC+xguxQzfIvk31Eh5oouTyOKZCKK4NFMfPHLr/zAH1bf4MuA+w1eVVu3+9QERQUN/+eNwt9Ki8ySW4wZmYsHYt2JmZqDE60Wa6PSmbQ4bzGy86e+uhRTqA3E9Hsdc8ZD6ST9gZxAACDUuCI+IQLypY0sU6qGOwP92le9b6ZZ8wv6nNbtGqS7MP999sZXHQR7UIEBa75uo7dHtqjuvv9tW97kGCWyxuvSeQ46uaGTfL9QDeW+BvLCrE1McsSm2W3calgxyB3AlOc7GzTD9l0EBdMoYclVwIQ9DgLpsUqQqRifI7hr1Fe4jTJYepnX3kEzR9XWZo7wzMCshb88ab5t4/+fU+s3CFX4Ois2DAWKjwFDPM+kP4W31UDQtolBte4b4GGeJ3pOTKBjsFAN9EsaW2w5tEz+wmF4oa1sTR9blHE1IYheLg5JlMLsvSe1ijAiRVcKw8DDuFHXTnLMFHsXaC0Yg5HdxPHSlctDseVV6NzBFXCry1e3Xgy5k/jhjQv5pnWkJZTzouAVJsubHT1TyoZQ8OvfhRQ+nYBrxbTPFpYcOKFJweWvp01V2f6LmSuTA+y8B42pYzSk3mGOtagz/rrs2O7sGhUpKeX6yzPf9G09yfeNF3hz+R5QrqvUWvhUMDKzFGtWpj+aYHYAMkLcZ5RyWU3Yp9FUPNNr1uSOf4Maf1F8yjtooUpOeHEj+XVrkgPjJCEOHe9kE= 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:(13230022)(4636009)(376002)(136003)(346002)(39860400002)(396003)(451199015)(36840700001)(46966006)(40470700004)(82310400005)(41300700001)(36860700001)(356005)(8936002)(4326008)(70206006)(5660300002)(70586007)(8676002)(83380400001)(81166007)(47076005)(40460700003)(426003)(1076003)(2616005)(336012)(478600001)(186003)(26005)(86362001)(82740400003)(2906002)(7696005)(110136005)(40480700001)(54906003)(6666004)(36756003)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 07:22:54.6054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59515763-6905-40f9-25e0-08dae25b02ff 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: BN8NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5914 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Sunil-kumar.Dommati@amd.com, ssabakar@amd.com, Ajit Kumar Pandey , Venkata Prasad Potturu , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Jia-Ju Bai , Akihiko Odaki , Vijendar.Mukunda@amd.com, V sujith kumar Reddy Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Refactor i2s bclk value based on hw_params. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index a78cf29387a7..016110fd6ad8 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -352,8 +352,11 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai; int srate, i, ret = 0; + unsigned int ch, format; srate = params_rate(params); + ch = params_channels(params); + format = 8 * params_format(params); if (drvdata->amp_codec_id != RT1019) return -EINVAL; @@ -363,7 +366,7 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, continue; ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, - 64 * srate, 256 * srate); + ch * format * srate, 256 * srate); if (ret < 0) return ret; From patchwork Tue Dec 20 07:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: potturu venkata prasad X-Patchwork-Id: 635989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id DF86EC4332F for ; Tue, 20 Dec 2022 07:24:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EAD792ABB; Tue, 20 Dec 2022 08:23:58 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EAD792ABB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671521089; bh=cvbomxgj3tsdsMp0ip1fxGs0X+pJNLme7QCgBXAbdmM=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=eZrydVd2Pv2tI31KCbXRwCKZtMhfqsLkNbJkJHABn7StR9yt1zs4NYk+8uCZSA1qm nhD/cDLrPCu+qVposGwRA5H640jR+9J8If1eLOTDwTad5iG3k3MlN5of1HCKEkF7Q2 +GaFmCkyGxyFZhfJQDtnnyg+aHIpqroX7/Hyqg9A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 5470DF8052F; Tue, 20 Dec 2022 08:23:11 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BC6E2F804AD; Tue, 20 Dec 2022 08:23:09 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2063.outbound.protection.outlook.com [40.107.94.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 9A012F80496 for ; Tue, 20 Dec 2022 08:23:07 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9A012F80496 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=Y4T8Oom+ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J7ucRJ+zsIBM3Mw8Yi2433DwYRKkB7MVoAMHQSijVt6C8y/85aHNbzydNx+5GdnbHKTXCPfWjqbluWk0A3mHo8+aNcagSsUiieJMDaw/mRlrSOA3qJj7tApx93gZGiRM4kgbVrIvYdgyl/0mtI+OHgbXnu5qB+3dZipaWi2OyXaO8ba156RclZI3re66P6kwQTTrwN0ffr2xR2DTbJRu9RJsBBlT3SnZtuV7zB+ZVok95NwcwmPGqfgFYmfsZ2ahAA3Va4/Ef6qXgOHO6ecfRrMRjbwLKgojgWdbRkuQCeULteO8LLuesIrvBFtc11LUUjkUAld8NAiNnV3OGrX2JQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1Wa7IpqNolNQl3j7OOVK9dnF3RlNogITv8+toSIkQVg=; b=T8QeTWJyw04FVZCFwLHTJvW7oO0IW5XH9gea97yqPsjEtn/odrYnAtttQ0py3f/xcmyCfJBcY8lbAW8FyrECn4naXcEU9hWyENp+wYfdCcnT96v7MCVhafYb6PbHZwmV6hfRP3brNUfbONG3kR20ibByCbSNZJzM0KQ7TlFVbpoM7fLRtwtYX2DD2ZJY/Rju2uLr3Ypsh85IJjSvYD2nOkdliCygJppLAiu8lg1WwpJbBcYdfxdsB8NjeUu+siVHx634S+Y9+olYxrlYs1n4HpJ+y2hebhyOMEm8si5zw3Hx0rduwwS91ULsbAON11sFTeOVcyHhEM9vd/oGlwsIpA== 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=1Wa7IpqNolNQl3j7OOVK9dnF3RlNogITv8+toSIkQVg=; b=Y4T8Oom+1bk7pgTLFuOJ0RzgOwL/dRN3qpRh1zxRfavG7YWgwnf18pVU5iKgrVt8VHVxUO4I0PxU6KeGAHEIzC6peyEAW7/4RNyspLHwki+PymfFw+vT9g2oEltlVnhr52/JlgioS8pIoIQwU6bFBf0tvh+gIUEMTw5Ca509d/4= Received: from DM6PR03CA0094.namprd03.prod.outlook.com (2603:10b6:5:333::27) by CY8PR12MB7489.namprd12.prod.outlook.com (2603:10b6:930:90::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 07:23:03 +0000 Received: from DM6NAM11FT062.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::2c) by DM6PR03CA0094.outlook.office365.com (2603:10b6:5:333::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 07:23:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT062.mail.protection.outlook.com (10.13.173.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.16 via Frontend Transport; Tue, 20 Dec 2022 07:23:02 +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.2375.34; Tue, 20 Dec 2022 01:23:01 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2375.34; Tue, 20 Dec 2022 01:23:01 -0600 Received: from amd-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 20 Dec 2022 01:22:51 -0600 From: Venkata Prasad Potturu To: , Subject: [PATCH 2/5] ASoC: amd: acp: Add new cpu dai's in machine driver Date: Tue, 20 Dec 2022 12:57:02 +0530 Message-ID: <20221220072705.1456908-3-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> References: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT062:EE_|CY8PR12MB7489:EE_ X-MS-Office365-Filtering-Correlation-Id: 046be12b-fb7c-4d52-2cff-08dae25b07e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QkKybKJo0KE8z92B2gX9c46SoUrCnL6zmFhNFhqQ389kq9Wvw4euf7eBeOvFWqHpIJQZ4RGPcJPG/A30L+6cTDdjVhs0WFnmKhRgEOhH7QmU+6+7p+zd4ySlC1m3IGdwL2LsJzjPcb7umhwPCOBfsulbvXEQ2TWwaugJqWzq5ErBmsAGO39aPjKEraZymasStrRo7bayqPWuSwKjEGYEoXzntpF5/3W3eM/L1+iPP4H5IZ/boK/RgMs4Zvqnm798180bFG2LoHz+daESZja9Ix0sljmZpCxX59yPiBH0iPqwnfAkh5UKs2h29I5yDcJO7GX+DuR4vLDEN52FFIIVdpwHPqL0/WZTKVIZSd2ijmanvew9HOERQHn5VuBgtL8SR7k6GRRNjYWJ2hndt10SQZ9FSZNQdVDamt3Le8qKjTw5BxzXbQ6FJh0hnMNJvaMqxAUZ3oVpgFNJKa3fOjUcrn272u6P6TQUNz879KN31X99WaKRjXo3xbgFRuvGZBTQtnKXS1vby+OgWvS64foRxGCkQWGhMylc2LZqU4NDJyetkNPQNkF0eNu+QLwktma4uyqXd2POYn30M3U1jk8syRd4X/dy7Mtsv4uRZEENwDpNdUbYHJYFqlPyaWBNAdMrf8Cvr+eaOm05fP/400JGM+vzaNzvKA0iIBFWLv+rABC4Fv+LbugUQo6z5Vf8lbwRJ4VYuA3igLc3f29POj2rQC1OJsQETQyDG+KVWh3zj4Q= 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:(13230022)(4636009)(376002)(396003)(346002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(82310400005)(36860700001)(83380400001)(36756003)(1076003)(336012)(2616005)(426003)(86362001)(40480700001)(82740400003)(40460700003)(81166007)(356005)(316002)(8936002)(47076005)(110136005)(2906002)(70206006)(4326008)(8676002)(54906003)(5660300002)(70586007)(186003)(41300700001)(6666004)(7696005)(26005)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 07:23:02.7639 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 046be12b-fb7c-4d52-2cff-08dae25b07e3 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: DM6NAM11FT062.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7489 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Sunil-kumar.Dommati@amd.com, ssabakar@amd.com, Ajit Kumar Pandey , Venkata Prasad Potturu , open list , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Jia-Ju Bai , Akihiko Odaki , Vijendar.Mukunda@amd.com, V sujith kumar Reddy Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" While using same cpu dai for 2 different dai links below error is reported. error: can't find BE for DAI ACPHS_VIRTUAL1.OUT To avoid this error add new cpu dai. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 016110fd6ad8..5132fedef00f 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -568,8 +568,12 @@ SND_SOC_DAILINK_DEF(i2s_hs, DAILINK_COMP_ARRAY(COMP_CPU("acp-i2s-hs"))); SND_SOC_DAILINK_DEF(sof_sp, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp"))); +SND_SOC_DAILINK_DEF(sof_sp_virtual, + DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-sp-virtual"))); SND_SOC_DAILINK_DEF(sof_hs, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs"))); +SND_SOC_DAILINK_DEF(sof_hs_virtual, + DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-hs-virtual"))); SND_SOC_DAILINK_DEF(sof_dmic, DAILINK_COMP_ARRAY(COMP_CPU("acp-sof-dmic"))); SND_SOC_DAILINK_DEF(pdm_dmic, @@ -704,8 +708,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) if (drv_data->amp_cpu_id == I2S_SP) { links[i].name = "acp-amp-codec"; links[i].id = AMP_BE_ID; - links[i].cpus = sof_sp; - links[i].num_cpus = ARRAY_SIZE(sof_sp); + links[i].cpus = sof_sp_virtual; + links[i].num_cpus = ARRAY_SIZE(sof_sp_virtual); links[i].platforms = sof_component; links[i].num_platforms = ARRAY_SIZE(sof_component); links[i].dpcm_playback = 1; @@ -736,8 +740,8 @@ int acp_sofdsp_dai_links_create(struct snd_soc_card *card) if (drv_data->amp_cpu_id == I2S_HS) { links[i].name = "acp-amp-codec"; links[i].id = AMP_BE_ID; - links[i].cpus = sof_hs; - links[i].num_cpus = ARRAY_SIZE(sof_hs); + links[i].cpus = sof_hs_virtual; + links[i].num_cpus = ARRAY_SIZE(sof_hs_virtual); links[i].platforms = sof_component; links[i].num_platforms = ARRAY_SIZE(sof_component); links[i].dpcm_playback = 1; From patchwork Tue Dec 20 07:27:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: potturu venkata prasad X-Patchwork-Id: 635988 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AE2DEC4332F for ; Tue, 20 Dec 2022 07:25:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B45F22AC6; Tue, 20 Dec 2022 08:24:47 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B45F22AC6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671521137; bh=aknTmpdZXOvJGNUa+ek0OXHR/DhZQl6qaqqItgWvEvY=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=KSlCJkWGhjJZaKM4kb7QIOxpndNwKpL+6fzyFoHZlzifCJ+9OqfZgnylGSR9jLtzd VIjIa+kwUhgPoEW/58rRSAbNXEbfubaEbyy5sJkch3270sWWcGQDe3xEuhtxIWSxx4 um8BQsGn61LxFoNYAAy1paD1+j9Gkf55F0t7Ft28= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6AE85F804AD; Tue, 20 Dec 2022 08:24:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A66FF80496; Tue, 20 Dec 2022 08:24:46 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2061.outbound.protection.outlook.com [40.107.244.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 4A6BEF801C0 for ; Tue, 20 Dec 2022 08:24:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4A6BEF801C0 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=IOD5lqZe ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bnhxRs0c0sM/zRWHWvFaAh5YDLREJRbbLaEoZf58tQ38EbKA+c1DRIr6MBZwilY5W2V6GZ5rOWmy9XZP4bYO/Lolb2W+w4vRLxi4lv14XQtb3lGXm3L4DJZWWbZhGXviEu0MO81h/6DAT63OlrTDJX7Pfm6e3ll3w33JPXX5JkzrqDFavv+Wds/wYJ6sGJ1JphQ8MVL/v3uQHI+/kg4qPCVcUkvx0kL1ZlIxsi65qIPZzKgXD+kIIH/fhyCbTuYvPSeCBBVrW1znhGvjE/7iGgE3/AUXgTDcJA2R8T83dyfh8ysDexWsAViERQsIuhKk33i8ymAYwmbdXx9F02x4Bg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8xbCPOLaQLH0IsHAexek5YCEs/b2MJhpyvwcEOaY5Fc=; b=HH40FAHrzT8C8cRo6cxk9OiOJhe48bzRNoZSy0hgv+gxirmWAMmPMNQK7uKC0hCc3NrWa1foGqFBErE0sH+pPH7iruaDr2YyvsE3/c1fLlWKq7KAWLNbOcj5eCm411PPiCnlyC/324Y4mJvM6uYQ145hjrt4rsarylYUA7ZTsElSDZm5sM+Vib1zHaAFejXzF3NamMHggSAitnFT9JIJdGObG0FGCxhn/8xcgdBADE8Yga6AFtTKRhKJ0RsJRL7i1XW36wfSYxAbNDUmI2A1xN+A/RhkZvJUi9X2ZGDh6KMD4QyOvS3m/xnZUgefysX0onrA8TLXn+tuPCbVYiarTw== 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=8xbCPOLaQLH0IsHAexek5YCEs/b2MJhpyvwcEOaY5Fc=; b=IOD5lqZedNVN+9hxqtrQlAXCr6jyeqfL2L8EonI6YbBNXC2gLXKV/O1oZRr/hhuZHSF8a4XfSuIYYSQYcj0SKtkk6DhkQ30C/6dUQNQLv6Q3s0Fq2Y7dKJuCkiVLRxnGX5mrw760OSwljEHCwp8mExlTeWiZmZIMvbwfbowbUn4= Received: from DS7P222CA0014.NAMP222.PROD.OUTLOOK.COM (2603:10b6:8:2e::34) by DS0PR12MB8043.namprd12.prod.outlook.com (2603:10b6:8:14d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 07:24:38 +0000 Received: from DM6NAM11FT052.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2e:cafe::f2) by DS7P222CA0014.outlook.office365.com (2603:10b6:8:2e::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 07:24:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT052.mail.protection.outlook.com (10.13.172.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.16 via Frontend Transport; Tue, 20 Dec 2022 07:24:37 +0000 Received: from SATLEXMB07.amd.com (10.181.41.45) 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.2375.34; Tue, 20 Dec 2022 01:23:38 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB07.amd.com (10.181.41.45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Mon, 19 Dec 2022 23:23:12 -0800 Received: from amd-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 20 Dec 2022 01:23:02 -0600 From: Venkata Prasad Potturu To: , Subject: [PATCH 3/5] ASoC: amd: acp: Refactor dai format implementation Date: Tue, 20 Dec 2022 12:57:03 +0530 Message-ID: <20221220072705.1456908-4-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> References: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT052:EE_|DS0PR12MB8043:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b789f64-c15c-4622-8371-08dae25b4077 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6yJX3p0GSZbmbAez2ZFDA24ozQOumS0lujJz58K7/ret05AlA+c0+2/qtSbsiRD1aNaEtgpFl+Rm4lcPGAHlAEq9XluYoZhfz8g7spBS3nupAjCKPfgxTxLHQ8Lh6MtrE4wAPCtAUZB2WACZdcH0Hn9E+nrHF1KZg/psRCspPbat8XmwgJpZq6SZT/+cYd4CgZFauzeNscArAt+0G3CgRb51Aq8lzEgxkUnzJvR8gythM6+duyjT0xiTXLHbKeTR6lbwdYlzHIuRigkOLhSjtsT2tlPqDp30iWRwzXzS09U0+g0ucOut/0DR3I4S6GFNKPtGopUZGWYf2c3b2qJsg2T6XMpqlHcXq0Kwuk4E4ftnpbUfMQEAzvG/YQekoXLI8jXOmWGBBNOh6A9e+NrcryNVwsPLpZ6j6HB0ExmmPICaugpLkDYg9HmZVSgDtlf9fW3wz+UT+GV81n3WGejsAXvDmVBprp/KBnojn4Vj/Ymwq11zEZ7SNmQHFeyh1j3AA8H+5DYOKTFKe+csHVP/GnMJxBirC0CXnCsl8LiqQYIgOkO63GWisAK1BscGzE8gQ/RSO2v12PAwprSwjxSA5A6K/7pHfef+9HmXdFxJkPzbnDsSZI+KAOSn3Ye4GuSU+SWoM3zUSkKG0fzwMo6JfbsDiqOcqzOFWAXQxpKUYKkgraU+UQhE3xUOHwC14hKXkr1fW3u+ptGs+RAxT3T7xWFKVHkKTTGwt4kxvMTIwmY= 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:(13230022)(4636009)(39860400002)(396003)(376002)(346002)(136003)(451199015)(36840700001)(46966006)(40470700004)(40480700001)(41300700001)(86362001)(70206006)(5660300002)(356005)(4326008)(54906003)(8676002)(81166007)(70586007)(316002)(8936002)(2906002)(110136005)(7696005)(82310400005)(26005)(186003)(82740400003)(83380400001)(40460700003)(36756003)(426003)(2616005)(1076003)(47076005)(336012)(36860700001)(478600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 07:24:37.7040 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b789f64-c15c-4622-8371-08dae25b4077 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: DM6NAM11FT052.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8043 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Sunil-kumar.Dommati@amd.com, ssabakar@amd.com, Ajit Kumar Pandey , Venkata Prasad Potturu , ye xingchen , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Jia-Ju Bai , Akihiko Odaki , Vijendar.Mukunda@amd.com, V sujith kumar Reddy , open list Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Refactor dai format implementation in dai_link specific snd_soc_ops. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-mach-common.c | 134 +++++++++++++++++++--------- 1 file changed, 90 insertions(+), 44 deletions(-) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 5132fedef00f..748cbefa8252 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -86,13 +86,6 @@ static int acp_card_rt5682_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682) return -EINVAL; - ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF - | SND_SOC_DAIFMT_CBP_CFP); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } - ret = snd_soc_dai_set_pll(codec_dai, RT5682_PLL2, RT5682_PLL2_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -148,19 +141,7 @@ static int acp_card_hs_startup(struct snd_pcm_substream *substream) struct snd_soc_card *card = rtd->card; struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); - int ret; - unsigned int fmt; - - if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; - else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } + int ret = 0; runtime->hw.channels_max = DUAL_CHANNEL; snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, @@ -191,9 +172,41 @@ static void acp_card_shutdown(struct snd_pcm_substream *substream) clk_disable_unprepare(drvdata->wclk); } +static int acp_card_rt5682x_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + int ret; + unsigned int fmt; + + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + return 0; +} + static const struct snd_soc_ops acp_card_rt5682_ops = { .startup = acp_card_hs_startup, .shutdown = acp_card_shutdown, + .hw_params = acp_card_rt5682x_hw_params, }; /* Define RT5682S CODEC component*/ @@ -212,7 +225,6 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_component *component = codec_dai->component; - unsigned int fmt; int ret; dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); @@ -220,17 +232,6 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != RT5682S) return -EINVAL; - if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; - else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } - ret = snd_soc_dai_set_pll(codec_dai, RT5682S_PLL2, RT5682S_PLL_S_MCLK, PCO_PLAT_CLK, RT5682_PLL_FREQ); if (ret < 0) { @@ -283,6 +284,7 @@ static int acp_card_rt5682s_init(struct snd_soc_pcm_runtime *rtd) static const struct snd_soc_ops acp_card_rt5682s_ops = { .startup = acp_card_hs_startup, + .hw_params = acp_card_rt5682x_hw_params, }; static const unsigned int dmic_channels[] = { @@ -351,8 +353,9 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, struct snd_soc_card *card = rtd->card; struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai; + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int srate, i, ret = 0; - unsigned int ch, format; + unsigned int ch, format, fmt; srate = params_rate(params); ch = params_channels(params); @@ -361,6 +364,17 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, if (drvdata->amp_codec_id != RT1019) return -EINVAL; + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + for_each_rtd_codec_dais(rtd, i, codec_dai) { if (strcmp(codec_dai->name, "rt1019-aif")) continue; @@ -429,9 +443,31 @@ static int acp_card_maxim_init(struct snd_soc_pcm_runtime *rtd) ARRAY_SIZE(max98360a_map)); } +static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + unsigned int fmt; + int ret; + + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + return 0; +} + static const struct snd_soc_ops acp_card_maxim_ops = { .startup = acp_card_amp_startup, .shutdown = acp_card_shutdown, + .hw_params = acp_card_maxim_hw_params, }; /* Declare nau8825 codec components */ @@ -449,7 +485,6 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); struct snd_soc_component *component = codec_dai->component; - unsigned int fmt; int ret; dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name); @@ -457,16 +492,6 @@ static int acp_card_nau8825_init(struct snd_soc_pcm_runtime *rtd) if (drvdata->hs_codec_id != NAU8825) return -EINVAL; - if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; - else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; - - ret = snd_soc_dai_set_fmt(codec_dai, fmt); - if (ret < 0) { - dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); - return ret; - } ret = snd_soc_card_jack_new(card, "Headset Jack", SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_BTN_0 | SND_JACK_BTN_1 | @@ -495,8 +520,12 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int ret; + unsigned int fmt; ret = snd_soc_dai_set_sysclk(codec_dai, NAU8825_CLK_FLL_FS, (48000 * 256), SND_SOC_CLOCK_IN); @@ -510,6 +539,23 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->soc_mclk) + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + else + fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + + ret = snd_soc_dai_set_fmt(cpu_dai, fmt); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_fmt(codec_dai, fmt); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + return ret; } From patchwork Tue Dec 20 07:27:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: potturu venkata prasad X-Patchwork-Id: 635483 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C6962C4332F for ; Tue, 20 Dec 2022 07:25:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0B95B2AC0; Tue, 20 Dec 2022 08:24:54 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0B95B2AC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671521144; bh=U6Zgmlkk7XjrXLWRWGpxJwJMx4lJ2xJTQrr2cTnurxA=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=n4tUAhbzxfXWrhp+aM+PqAqiITForz4KZ2WIqEDZL9Fmo5flap+oABQmsAxbEEN6A hXQSo+Ngw0fMmm5yCBsj1qmoa0eiKXbv7GOHl1JPOwACEfi73TOTeE3Rjgqc07EQzf 61edBrC2axsGAm1mkDn8fAP/gqq9BKAxMqKeGpsM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 398FCF80537; Tue, 20 Dec 2022 08:24:53 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F11A4F80496; Tue, 20 Dec 2022 08:24:48 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.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 02AF5F8025E for ; Tue, 20 Dec 2022 08:24:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 02AF5F8025E Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=wRixHSF8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L8Ca0SMZapVJSiJ2vOR3aVwF2Up+ASy2aFXxcFSk4O0uXWutYS6QPSOw8LK+PuM9HtEHTX7BeRw6ak3wOu0QEDbEcECtP3sE+wz3PFmJeByetDVGF/EhAwdWzVV5gPdKaXExwSIAYZd7II+O1yaGb+d2kaw/5yqkFI2dcvynKAVmisiIskmo/lGyWJcD8IpKbDa9OrYiUMwcdCpqK6+Ln4qDgnSQqTwkPrMHGcasKdG0WxPUhnNgKR/5FdSdqJp93kAAU2xq7dItHq3ND7GvVNb+EsNavjhbRoCG7oubBcjV61uhmYdbIKaYnzCJqsRrjppZU89FGOiNxNUhHfWO+Q== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mdNgbIcv5DunzMSQAN4qFyyoS+KexLcIFjidToiIkyA=; b=dw4uDouzBoQi2Np/KcXxJKMZtHj/kbY3q7diY20X6eqbZsE9JEwN5uCYe886L3Ohbe2BFhr1xreQ2MHUBeT6aLiCI1g6TOGrG8WphTGp0+3Y5gscsQvGnDKpJvx8J0yRebbCe4P0dADkNwEkehJXUfc8HafUZx2GkPz3/RK7gyoDNHbC+uajju9Bv9gy+OtakQTxunLPyIMKt7gs/DYSeyjFY/f/cSqikbKCMtK9Tp0sfNhLJrRXb0eA0mkQyKKPbBzoieHtzC0IC6vZmY4UCfj1k3lJrGaWz/+ipH7Mo0jR0wLvU3ncGtsVFF9fILo3GSrSDr389w1mhdYXwa7Z3Q== 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=mdNgbIcv5DunzMSQAN4qFyyoS+KexLcIFjidToiIkyA=; b=wRixHSF8DypcpoaYiyhrhIuEhxMRUJZ6smto94ewDgRYr/PHF+0q02o0NuoHSW5UYFDWwfBsF1Gzjht86cD+Y8/bhK+sNFrNwXfpSQJJ+fGViNC25giHpxtP3aebN43xFyeTeOt2wrL01dzR7tqhpMIGHSCFKbSpJBdpL7mYt7g= Received: from BN9PR03CA0614.namprd03.prod.outlook.com (2603:10b6:408:106::19) by BN9PR12MB5323.namprd12.prod.outlook.com (2603:10b6:408:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 07:24:40 +0000 Received: from BN8NAM11FT040.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::61) by BN9PR03CA0614.outlook.office365.com (2603:10b6:408:106::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 07:24:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT040.mail.protection.outlook.com (10.13.177.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.16 via Frontend Transport; Tue, 20 Dec 2022 07:24:40 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2375.34; Tue, 20 Dec 2022 01:23:38 -0600 Received: from amd-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 20 Dec 2022 01:23:16 -0600 From: Venkata Prasad Potturu To: , Subject: [PATCH 4/5] ASoC: amd: acp: Add tdm support in machine driver Date: Tue, 20 Dec 2022 12:57:04 +0530 Message-ID: <20221220072705.1456908-5-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> References: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT040:EE_|BN9PR12MB5323:EE_ X-MS-Office365-Filtering-Correlation-Id: 95c98bc6-b28b-49e8-b7ec-08dae25b41e5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ta1+V/oVY+NUYVJKFyfqMiUEWOvZgRfMmpNOH1CbCWCYQZAPKC2HAgyPfjRQi/zanL7Rmlnh7/WU2/oFIcz5CgKcozIZTT4xKXJ7QztxM5V5x9+7Zd0bNPA9QVX52W2eMHZdnBeJBsmOXIQlFvQyT5FOjPEeo6iwEGchXDT2Ayzn3WjXay2NcbaMx7CBv+xZ7J8TUZWQ8yy2xlrTAupzXau4cgynnA7+mHblfGK9lG0GbGAzvaIVGwkeyvyRNaUtHzJswQSGAbqDupATT1Z/UR7bSdyq/o6is2q+wMdzNSjxJ99UnV0j/PEvWI2OR9cdeBuGVVrav5iR+FZt2CJU2eOT8pVIec/ZwoKsFIYdRyGoy3A0COXwo17Gl0HA3ojyZM/JmUP7lgjpvORUVvdxay0/kZrn11gI6PTSvB+fRSmqllrCENAiS63mq4szyCuH8AFWmcMBMz/gyd34XmM8lOpxmKzzVirpWBo7TOzzElhf3NmgTGF4eRwArBL+SAITmBgbIHRPcC2Tl3yTS5/OfeWDR2XWXBtWd0+pySRhkG2T7SyyAzQb7eyzpWd+NKdr8MfG8QdmmM5yRv1AmsyXZ4go5KdRUdcXR0GdabaxyjlD71xWsESXBqzXavXMU+R8CA3nBUp6Ew7hWFEMl6ylkpeT4c3z/c4l1UeRgXlZqeve+wtpTPBjCs/7pZPtmQ/H5yReoSshDrY7Rvi7KSnQGSEIe3Cgca6BbtFUlzDwmDM= 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:(13230022)(4636009)(396003)(376002)(346002)(136003)(39860400002)(451199015)(46966006)(36840700001)(40470700004)(70206006)(86362001)(70586007)(8676002)(40460700003)(4326008)(316002)(5660300002)(36756003)(8936002)(2616005)(41300700001)(186003)(1076003)(82310400005)(6666004)(7696005)(36860700001)(83380400001)(47076005)(426003)(336012)(356005)(26005)(54906003)(40480700001)(82740400003)(81166007)(478600001)(110136005)(2906002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 07:24:40.1352 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 95c98bc6-b28b-49e8-b7ec-08dae25b41e5 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: BN8NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5323 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Sunil-kumar.Dommati@amd.com, ssabakar@amd.com, Ajit Kumar Pandey , Venkata Prasad Potturu , ye xingchen , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Akihiko Odaki , Vijendar.Mukunda@amd.com, V sujith kumar Reddy , open list Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add tdm support for amd platforms. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-legacy-mach.c | 5 ++ sound/soc/amd/acp/acp-mach-common.c | 130 +++++++++++++++++++++++++--- sound/soc/amd/acp/acp-mach.h | 3 + sound/soc/amd/acp/acp-sof-mach.c | 6 ++ 4 files changed, 133 insertions(+), 11 deletions(-) diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index 1f4878ff7d37..d508792dba4f 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -27,6 +27,7 @@ static struct acp_card_drvdata rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_max_data = { @@ -36,6 +37,7 @@ static struct acp_card_drvdata rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_rt1019_data = { @@ -45,6 +47,7 @@ static struct acp_card_drvdata rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata max_nau8825_data = { @@ -56,6 +59,7 @@ static struct acp_card_drvdata max_nau8825_data = { .dmic_codec_id = DMIC, .soc_mclk = true, .platform = REMBRANDT, + .tdm_mode = false, }; static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { @@ -67,6 +71,7 @@ static struct acp_card_drvdata rt5682s_rt1019_rmb_data = { .dmic_codec_id = DMIC, .soc_mclk = true, .platform = REMBRANDT, + .tdm_mode = false, }; static const struct snd_kcontrol_new acp_controls[] = { diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 748cbefa8252..73a27f02b52b 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -183,10 +183,15 @@ static int acp_card_rt5682x_hw_params(struct snd_pcm_substream *substream, int ret; unsigned int fmt; + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -200,6 +205,23 @@ static int acp_card_rt5682x_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 0 and slot 1 for playback and capture. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x3, 0x3, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 8, 16); + if (ret < 0) { + dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); + return ret; + } + } + return 0; } @@ -364,10 +386,15 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, if (drvdata->amp_codec_id != RT1019) return -EINVAL; + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -375,12 +402,27 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 2 and slot 3 for playback. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xC, 0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + } for_each_rtd_codec_dais(rtd, i, codec_dai) { if (strcmp(codec_dai->name, "rt1019-aif")) continue; - ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, - ch * format * srate, 256 * srate); + if (drvdata->tdm_mode) + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, + TDM_CHANNELS * format * srate, 256 * srate); + else + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1019_PLL_S_BCLK, + ch * format * srate, 256 * srate); + if (ret < 0) return ret; @@ -388,8 +430,34 @@ static int acp_card_rt1019_hw_params(struct snd_pcm_substream *substream, 256 * srate, SND_SOC_CLOCK_IN); if (ret < 0) return ret; - } + if (drvdata->tdm_mode) { + ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_A + | SND_SOC_DAIFMT_NB_NF); + if (ret < 0) { + dev_err(rtd->card->dev, "Failed to set dai fmt: %d\n", ret); + return ret; + } + + /** + * As codec supports slot 2 for left channel playback. + */ + if (!strcmp(codec_dai->component->name, "i2c-10EC1019:00")) { + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x4, 0x4, 8, 16); + if (ret < 0) + break; + } + + /** + * As codec supports slot 3 for right channel playback. + */ + if (!strcmp(codec_dai->component->name, "i2c-10EC1019:01")) { + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x8, 0x8, 8, 16); + if (ret < 0) + break; + } + } + } return 0; } @@ -448,19 +516,38 @@ static int acp_card_maxim_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); + struct snd_soc_card *card = rtd->card; + struct acp_card_drvdata *drvdata = card->drvdata; unsigned int fmt; int ret; + + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { dev_err(rtd->dev, "Failed to set dai fmt: %d\n", ret); return ret; } + + if (drvdata->tdm_mode) { + /** + * As codec supports slot 2 and slot 3 for playback. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0xC, 0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + } return 0; } @@ -539,10 +626,15 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) + fmt = SND_SOC_DAIFMT_DSP_A; + else + fmt = SND_SOC_DAIFMT_I2S; + if (drvdata->soc_mclk) - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBC_CFC; else - fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; + fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP; ret = snd_soc_dai_set_fmt(cpu_dai, fmt); if (ret && ret != -ENOTSUPP) { @@ -556,6 +648,22 @@ static int acp_nau8825_hw_params(struct snd_pcm_substream *substream, return ret; } + if (drvdata->tdm_mode) { + /** + * As codec supports slot 4 and slot 5 for playback and slot 6 for capture. + */ + ret = snd_soc_dai_set_tdm_slot(cpu_dai, 0x30, 0xC0, 8, 16); + if (ret && ret != -ENOTSUPP) { + dev_err(rtd->dev, "set TDM slot err: %d\n", ret); + return ret; + } + + ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x40, 0x30, 8, 16); + if (ret < 0) { + dev_warn(rtd->dev, "set TDM slot err:%d\n", ret); + return ret; + } + } return ret; } diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index 20583ef902df..9f87439b3cfd 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -18,6 +18,8 @@ #include #include +#define TDM_CHANNELS 8 + enum be_id { HEADSET_BE_ID = 0, AMP_BE_ID, @@ -58,6 +60,7 @@ struct acp_card_drvdata { struct clk *wclk; struct clk *bclk; bool soc_mclk; + bool tdm_mode; }; int acp_sofdsp_dai_links_create(struct snd_soc_card *card); diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index f19f064a7527..f3ba22a25962 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -27,6 +27,7 @@ static struct acp_card_drvdata sof_rt5682_rt1019_data = { .hs_codec_id = RT5682, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682_max_data = { @@ -36,6 +37,7 @@ static struct acp_card_drvdata sof_rt5682_max_data = { .hs_codec_id = RT5682, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_rt1019_data = { @@ -45,6 +47,7 @@ static struct acp_card_drvdata sof_rt5682s_rt1019_data = { .hs_codec_id = RT5682S, .amp_codec_id = RT1019, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_max_data = { @@ -54,6 +57,7 @@ static struct acp_card_drvdata sof_rt5682s_max_data = { .hs_codec_id = RT5682S, .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, + .tdm_mode = false, }; static struct acp_card_drvdata sof_nau8825_data = { @@ -64,6 +68,7 @@ static struct acp_card_drvdata sof_nau8825_data = { .amp_codec_id = MAX98360A, .dmic_codec_id = DMIC, .soc_mclk = true, + .tdm_mode = false, }; static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { @@ -74,6 +79,7 @@ static struct acp_card_drvdata sof_rt5682s_hs_rt1019_data = { .amp_codec_id = RT1019, .dmic_codec_id = DMIC, .soc_mclk = true, + .tdm_mode = false, }; static const struct snd_kcontrol_new acp_controls[] = { From patchwork Tue Dec 20 07:27:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: potturu venkata prasad X-Patchwork-Id: 635484 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 943B8C4332F for ; Tue, 20 Dec 2022 07:25:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A81D62AF2; Tue, 20 Dec 2022 08:24:11 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A81D62AF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1671521101; bh=/BGRpm3PAgGqmq7F9GlLFIiLhboYYGRTXAdk6VgNwpo=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=ZSuY8zwv3ZyNTz1VtQRJriVtcsJ4m6pqE/uVn9ObIc7QMej5T+gVXq2I5HFRfBZBT 1GHA7bh46PziXF8opF+S43sM/ozvghyiXIj99xeZVXgJzhCxgFFRSt0EHorwBXeVE6 faLkhDbxV7clfzojll5XvfZS7uOBgN73kDJ8Qv1c= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 857BBF8026D; Tue, 20 Dec 2022 08:24:03 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F10CCF8026D; Tue, 20 Dec 2022 08:24:01 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2064.outbound.protection.outlook.com [40.107.100.64]) (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 86D35F8026D for ; Tue, 20 Dec 2022 08:23:59 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 86D35F8026D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=F6XLg7dJ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTaJYYZ27ltCVsPCUlY09b3Kjo9cgwc59uObIdwLfSZyCY38SpbhN+OIYW15e2kwJTCe/wJbxvT9pS+Ifafl94Z2Sxgc6WNGUYycZi3O6T+xpULyrF00epf6lhWJaxtIA+3HyazhQh8+beIrEqNWzTXckSFYh5DKaz3Pgnz4G9c7AufjwBsdbPySml29nYsyHaQzs5J1SIrAQD+bzApKuCj60S2ZpE3v9dYt0qyW1CKUiQ2PEWgXea7+csL1jn+FoDSCQ/P3EwbUj4tjBjeRIucjRpDgrHDAZuMP0aOhP9U95tXQFcr8EWwXEM+EdiET0goco1NczDj5XLKr6O52sw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ykCI5N8keBqShLGS5+VKgUK3O6kAbfgv32T0VSJUBok=; b=StPfj0eZvZxCBfTSKW+KvtBdPTcahryxVLeNGUL5/YAlJBjUv+imERf61gSfMvsZF5Tr+QfhePlhFLaq+9OJWck4q4pclwmAafK3njV6VhPb+YTryWOLX2M1Ti+v8n1rFGs1SzkbV8yntZhEHSz1zUvtqvI0pQx5UgMVQx++4HkVhX8yiqImJTjr8r53o0sEHCsPjFo0y2eiT+WcHLJ0yy7Q2ipBkfc/t4THX80/3BcBeZnUU5kB9bOkc7APlubTUk6uZAyYie3pMugmFLfO1HLaKRgkxZ1Hyj1Hhs5c2cIZ2I93QxDYf9pTCDElWdowTu3xzLM4T8CQzE8SuRAL+g== 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=ykCI5N8keBqShLGS5+VKgUK3O6kAbfgv32T0VSJUBok=; b=F6XLg7dJu8oj3iovNmVFEQ9SQg3OEf0tOIZfg6hoYD5o7Egkzll9fFOboW+z5O8DlcZJqyNQ6KS5z/fddTU83xKUyU/uXWcMqlK/Ahb4BqtYZmnpSHwGJiH5gnkHEGX4sDA2d4IXvRVTD5crwdfgEF5nZeTUNOkbeaif2ieHtYc= Received: from DS7PR03CA0147.namprd03.prod.outlook.com (2603:10b6:5:3b4::32) by IA0PR12MB8349.namprd12.prod.outlook.com (2603:10b6:208:407::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 07:23:55 +0000 Received: from DM6NAM11FT110.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3b4:cafe::32) by DS7PR03CA0147.outlook.office365.com (2603:10b6:5:3b4::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.21 via Frontend Transport; Tue, 20 Dec 2022 07:23:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;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; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by DM6NAM11FT110.mail.protection.outlook.com (10.13.173.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5924.16 via Frontend Transport; Tue, 20 Dec 2022 07:23:54 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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.2375.34; Tue, 20 Dec 2022 01:23:51 -0600 Received: from amd-System-Product-Name.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 20 Dec 2022 01:23:42 -0600 From: Venkata Prasad Potturu To: , Subject: [PATCH 5/5] ASoC: amd: acp: Enable tdm support for skyrim platforms Date: Tue, 20 Dec 2022 12:57:05 +0530 Message-ID: <20221220072705.1456908-6-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> References: <20221220072705.1456908-1-venkataprasad.potturu@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT110:EE_|IA0PR12MB8349:EE_ X-MS-Office365-Filtering-Correlation-Id: 381d2692-0ef9-4c88-d38c-08dae25b26a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fDa7D/DPwEg+b26SyEwH7YaifUGfbkZrhkN0Fk2kF2B6PcKK4stI/ckMwS00Pi8F4qLgdXY3JaVlG6+f/qrbnh+yuIwld2I2Omr6+WWxHppoNHzJHzfwuTTlgxghHsEyBCBoK4ghKz20ciNhmh/i0kE36kANqZEJ6b3aPzrKbIWy26yrs6uwv4Tsq6yp7ms/RQHMEK2P01n59PpzMppkUKfXyvxchqvospaR6My1iIBoaIC5ii1eVnndMMgPc2tAf4Tr+PU84GiLHNHezho7FvuLRArGpE4Sxnvb0n4mM5tdWcggITz2dUnuubk3odpjxHolNzAdknxwP7PYUqXMUYwFdalul6uZwoHRErSIOdSSfsndH18TD3beVI5WmXZJfbEauwwPujMQ2uMgmAs8sVrqdpTcNN/D0P+gxhh511KzbP2PRh6OJndBMhT0WpmHJcOpenFQmO+rQCJHOLBckaR7URezJrM/MU2Ffwqs0gByVnaI6bP6F/qgmqbV8tEUHeOaGP7ps4t3gqkS1sDDM42kzgtvHQAxABCKfJnllKYQYtLCiuLQMidTY4CgrX68EHPJJKpHXbK0LDbteJ0nuBpwsUOncNnzJCl2v+Wl7S+EL2Rr/6ZopxFIXmjeIA5m2KN+Ah3wa/Omd9UHIfX1HlAhNHbJ5kkjNMm9vTcEV6ZJOBXmfZzn8OtMBF0pgyvjDJEjQGrdhUc3jdcZEnQNqtPXqGOlzkgD8WnyBjYshyE= 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:(13230022)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199015)(46966006)(40470700004)(36840700001)(5660300002)(4326008)(8676002)(110136005)(54906003)(70586007)(70206006)(2906002)(6666004)(478600001)(26005)(186003)(7696005)(41300700001)(47076005)(426003)(40480700001)(86362001)(82310400005)(36860700001)(2616005)(336012)(1076003)(36756003)(82740400003)(81166007)(356005)(8936002)(316002)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 07:23:54.3868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 381d2692-0ef9-4c88-d38c-08dae25b26a5 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: DM6NAM11FT110.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8349 X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.29 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: , Cc: Sunil-kumar.Dommati@amd.com, ssabakar@amd.com, Ajit Kumar Pandey , Venkata Prasad Potturu , ye xingchen , Basavaraj.Hiregoudar@amd.com, Takashi Iwai , Liam Girdwood , Jia-Ju Bai , Akihiko Odaki , Vijendar.Mukunda@amd.com, V sujith kumar Reddy , open list Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Enable tdm support for skyrim platform using dmi quirks. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-legacy-mach.c | 8 ++++++++ sound/soc/amd/acp/acp-mach-common.c | 14 ++++++++++++++ sound/soc/amd/acp/acp-mach.h | 1 + sound/soc/amd/acp/acp-sof-mach.c | 8 ++++++++ 4 files changed, 31 insertions(+) diff --git a/sound/soc/amd/acp/acp-legacy-mach.c b/sound/soc/amd/acp/acp-legacy-mach.c index d508792dba4f..04958a884cfd 100644 --- a/sound/soc/amd/acp/acp-legacy-mach.c +++ b/sound/soc/amd/acp/acp-legacy-mach.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "acp-mach.h" @@ -95,6 +96,8 @@ static int acp_asoc_probe(struct platform_device *pdev) { struct snd_soc_card *card = NULL; struct device *dev = &pdev->dev; + const struct dmi_system_id *dmi_id; + struct acp_card_drvdata *acp_drvdata; int ret; if (!pdev->id_entry) @@ -113,6 +116,11 @@ static int acp_asoc_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; + acp_drvdata = card->drvdata; + dmi_id = dmi_first_match(acp_quirk_table); + if (dmi_id && dmi_id->driver_data) + acp_drvdata->tdm_mode = dmi_id->driver_data; + acp_legacy_dai_links_create(card); ret = devm_snd_soc_register_card(&pdev->dev, card); diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 73a27f02b52b..bde3ea3377ef 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -32,6 +32,20 @@ #define DUAL_CHANNEL 2 #define FOUR_CHANNEL 4 +#define TDM_MODE_ENABLE 1 + +const struct dmi_system_id acp_quirk_table[] = { + { + /* Google skyrim proto-0 */ + .matches = { + DMI_EXACT_MATCH(DMI_PRODUCT_FAMILY, "Google_Skyrim"), + }, + .driver_data = (void *)TDM_MODE_ENABLE, + }, + {} +}; +EXPORT_SYMBOL_GPL(acp_quirk_table); + static struct snd_soc_jack pco_jack; static const unsigned int channels[] = { diff --git a/sound/soc/amd/acp/acp-mach.h b/sound/soc/amd/acp/acp-mach.h index 9f87439b3cfd..165f407697c0 100644 --- a/sound/soc/amd/acp/acp-mach.h +++ b/sound/soc/amd/acp/acp-mach.h @@ -65,5 +65,6 @@ struct acp_card_drvdata { int acp_sofdsp_dai_links_create(struct snd_soc_card *card); int acp_legacy_dai_links_create(struct snd_soc_card *card); +extern const struct dmi_system_id acp_quirk_table[]; #endif diff --git a/sound/soc/amd/acp/acp-sof-mach.c b/sound/soc/amd/acp/acp-sof-mach.c index f3ba22a25962..e5b3a0d5363a 100644 --- a/sound/soc/amd/acp/acp-sof-mach.c +++ b/sound/soc/amd/acp/acp-sof-mach.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "acp-mach.h" @@ -102,6 +103,8 @@ static int acp_sof_probe(struct platform_device *pdev) { struct snd_soc_card *card = NULL; struct device *dev = &pdev->dev; + const struct dmi_system_id *dmi_id; + struct acp_card_drvdata *acp_drvdata; int ret; if (!pdev->id_entry) @@ -120,6 +123,11 @@ static int acp_sof_probe(struct platform_device *pdev) card->num_controls = ARRAY_SIZE(acp_controls); card->drvdata = (struct acp_card_drvdata *)pdev->id_entry->driver_data; + acp_drvdata = card->drvdata; + dmi_id = dmi_first_match(acp_quirk_table); + if (dmi_id && dmi_id->driver_data) + acp_drvdata->tdm_mode = dmi_id->driver_data; + acp_sofdsp_dai_links_create(card); ret = devm_snd_soc_register_card(&pdev->dev, card);