From patchwork Tue Sep 3 11:34:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkata Prasad Potturu X-Patchwork-Id: 13788545 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2084.outbound.protection.outlook.com [40.107.100.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE3431A42D1; Tue, 3 Sep 2024 11:34:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.84 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725363289; cv=fail; b=ogNxr+Oori6AqXEs7rCEzquWe5HeacMAy/kMeXisa8zU1rtvAafRPufLAHF/NQG8BisnuRKn15UfNrm/z3Sk5Rxr1ZyFsU3i8Q151A9WPPPFvtBwvvrfISvK3nSaqhUroJ+uuDeWHLB19Jpy3Ho9jx/rwh1gOu5smM31Vir77UA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725363289; c=relaxed/simple; bh=fqrZzJyd8MAy+NtiqjQ9CU8CvY3d+BXPJ3l2U5ZUcas=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CfL/SO+uxA03XZyych2zmAyE+zspJhoumhOwgYXaKLttDLLpkPEpaIfuZENJH2qkQsOTNyy0NRw2Xj90HpBza7a2Lr6ArmCtteaUY9aInrejhhNfS5509NP3RHZ727Hk319P4vPB4/TATnu9lNPsWvyD6UO+RvkYiOGtHTdE4nw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=H94G5Exn; arc=fail smtp.client-ip=40.107.100.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="H94G5Exn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vZkNDjj3fBqQudlsdHmm483NV0JiWGu21VTdOEkSjHFcQs68r68A216Jx7lxwMwGqBfYH4++7oRKaB+zzKqWK5Dx0GPYWQerQgg3RfUHn3zQDf705uXWe6cUv2W0mth7A8N3iU0YxT4wDUVJxTRJnm6IOYPSJQ6bCVFMSZNL3dtpb2/hiyhCpPG+sIihrBCei4SRUlFRaYBsPArYgNFqwRiA1XpsM8DcRscIcFRxv92Ihe+grdnsR45QWL1Fxp2pyfisKMhzvkdF3sFF8UXTjlrUgXzwP9EBIPuM9wGzt2oGERDAHjJ3hii6eYBreREg5ybsjJX48OUj4CurjB/Q6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=py8u4OX83i/3syVL8qYVVIMaXkGK1P/LrBgXyBaPsf4=; b=MtMLiZzU+5Al3MNk6DilfSjeZMcmicYov1APj/Boz//bcSLXXw0nbehk1rygoixY6TLwwkme5JcsWcARjm4hQspJ7wsRX5WFGg4qc18ac9rsdJNGxKFKtgFOMgXkaGTEdmTv8ZQz6on0P4XvWvTdCm22VKO0e27U6jFwXG6y+lXoMC3N98u5BLwmAYhilqc7toBPszDikOJQsL5gGoacBhYfVY9HHiTvBoO3YWqDE8WVBRn5rZPpuQboFIlO8EGYfWCPy14Z5i2c6QiolOFG9X5ysI8t0A2pq6GFtaSX+b7/zSOHPsULbw0qeEu+nHq7IgcEhDbmK1n/QPqXSgOQPg== 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 (0) 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=py8u4OX83i/3syVL8qYVVIMaXkGK1P/LrBgXyBaPsf4=; b=H94G5ExnfrSfCwwlUBvJ2kwpbvcb+SQJHjSrfFsx4euNkhLhP2YLG4gGX6ge50EjxviscTp0RE8NHHflsBhn/AQ6tM3wOPqcXE5EPS1NdGy/OpEyewu0KeZgc2ZMNHj+i8zMlw3z8xyKpYiM8+mTu0GJbKDDCHhTO+YWwUL2MaE= Received: from BN7PR06CA0066.namprd06.prod.outlook.com (2603:10b6:408:34::43) by PH8PR12MB7278.namprd12.prod.outlook.com (2603:10b6:510:222::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Tue, 3 Sep 2024 11:34:42 +0000 Received: from MN1PEPF0000ECD8.namprd02.prod.outlook.com (2603:10b6:408:34:cafe::55) by BN7PR06CA0066.outlook.office365.com (2603:10b6:408:34::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.27 via Frontend Transport; Tue, 3 Sep 2024 11:34:42 +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 MN1PEPF0000ECD8.mail.protection.outlook.com (10.167.242.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Tue, 3 Sep 2024 11:34:42 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 3 Sep 2024 06:34:41 -0500 Received: from prasad-r9-mach.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Tue, 3 Sep 2024 06:34:32 -0500 From: Venkata Prasad Potturu To: , CC: , , , , "Venkata Prasad Potturu" , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , "Syed Saba Kareem" , Jeff Johnson , "open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , open list Subject: [PATCH 01/12] ASoC: amd: acp: Refactor TDM slots selction based on acp revision id Date: Tue, 3 Sep 2024 17:04:16 +0530 Message-ID: <20240903113427.182997-2-venkataprasad.potturu@amd.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240903113427.182997-1-venkataprasad.potturu@amd.com> References: <20240903113427.182997-1-venkataprasad.potturu@amd.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Received-SPF: None (SATLEXMB04.amd.com: venkataprasad.potturu@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD8:EE_|PH8PR12MB7278:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f79c23c-6eb9-4376-ef57-08dccc0c6716 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-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vahSRNoGh8O/0cXYB9yBSPVhe++7/LmRbBAeZ/XlaET9VRdldISTKtQarGEKeILHNRiXtpKKrdSlBFL4jy2tBwj+g9Bp6lYNlfdFwmSEg8MqfHOJQArPZyzdL1yWAI2LTR4KrxIU1YLY8u0r6nMd/rCGFv+7Nnfgjrr5iEWbQAdiy7fC0MqCbtsZzghRa4aCy40Ik80U6rlmE4U9TQXt4vVZGNrvTPKa4DZ7ysLhK67A0bH8IC5GRIrzNdNmPSSUkeeVrp0q4sP6QPGXGB46h3iMKX5AXe9fs9BxZqCwyq0AW3Mzj6/ur1IpSp2dPXh4UxRD3T/pHeUCVs35xBMyIYo45TW3XrfDUcpg2o6tRDN0ohs5QvX2oSKVU8Bafen8vfj5zWKIjwq2b7st5CN8EBoHLlEWmKomIG0HYYW9mNKRG0mF3h8GDUWyRG6DplXqgzk32L88H+AV8N3mP1D1v 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:(13230040)(1800799024)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2024 11:34:42.0216 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f79c23c-6eb9-4376-ef57-08dccc0c6716 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: MN1PEPF0000ECD8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7278 Refactor TDM slots selection based on acp revision id. Signed-off-by: Venkata Prasad Potturu --- sound/soc/amd/acp/acp-i2s.c | 40 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/sound/soc/amd/acp/acp-i2s.c b/sound/soc/amd/acp/acp-i2s.c index 97258b4cf89b..5d1d27078626 100644 --- a/sound/soc/amd/acp/acp-i2s.c +++ b/sound/soc/amd/acp/acp-i2s.c @@ -95,9 +95,11 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas { struct device *dev = dai->component->dev; struct acp_dev_data *adata = snd_soc_dai_get_drvdata(dai); + struct acp_chip_info *chip; struct acp_stream *stream; int slot_len, no_of_slots; + chip = dev_get_platdata(dev); switch (slot_width) { case SLOT_WIDTH_8: slot_len = 8; @@ -116,15 +118,23 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas return -EINVAL; } - switch (slots) { - case 1 ... 7: - no_of_slots = slots; - break; - case 8: - no_of_slots = 0; + switch (chip->acp_rev) { + case ACP3X_DEV: + case ACP6X_DEV: + switch (slots) { + case 1 ... 7: + no_of_slots = slots; + break; + case 8: + no_of_slots = 0; + break; + default: + dev_err(dev, "Unsupported slots %d\n", slots); + return -EINVAL; + } break; default: - dev_err(dev, "Unsupported slots %d\n", slots); + dev_err(dev, "Unknown chip revision %d\n", chip->acp_rev); return -EINVAL; } @@ -132,12 +142,20 @@ static int acp_i2s_set_tdm_slot(struct snd_soc_dai *dai, u32 tx_mask, u32 rx_mas spin_lock_irq(&adata->acp_lock); list_for_each_entry(stream, &adata->stream_list, list) { - if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK) - adata->tdm_tx_fmt[stream->dai_id - 1] = + switch (chip->acp_rev) { + case ACP3X_DEV: + case ACP6X_DEV: + if (tx_mask && stream->dir == SNDRV_PCM_STREAM_PLAYBACK) + adata->tdm_tx_fmt[stream->dai_id - 1] = FRM_LEN | (slots << 15) | (slot_len << 18); - else if (rx_mask && stream->dir == SNDRV_PCM_STREAM_CAPTURE) - adata->tdm_rx_fmt[stream->dai_id - 1] = + else if (rx_mask && stream->dir == SNDRV_PCM_STREAM_CAPTURE) + adata->tdm_rx_fmt[stream->dai_id - 1] = FRM_LEN | (slots << 15) | (slot_len << 18); + break; + default: + dev_err(dev, "Unknown chip revision %d\n", chip->acp_rev); + return -EINVAL; + } } spin_unlock_irq(&adata->acp_lock); return 0;