From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from PH8PR06CU001.outbound.protection.outlook.com (mail-westus3azon11012049.outbound.protection.outlook.com [40.107.209.49]) (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 83A1C30146B for ; Thu, 20 Nov 2025 09:22:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.209.49 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763630553; cv=fail; b=HclQtg0anEA9H2fYW34LPOYw7q58gyledj3o+Sqjvfl54jxyfU2/C43Zxphhf1RGjz/tkc8x6rCXbhdNx63XpWNSSlcnzjIrEh1Mc3QnCcVtbimco7i1Hn5Lav68uNNwYbDYILg/rKRcimIWyYAgR3rSRUAbvlNVQ5jdCOLpL+M= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763630553; c=relaxed/simple; bh=99uCtvgEOVjeP0F2ThNgV6ZyT6N8o+/8BSswJQdhhec=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aQ2DRGBAJHGU5Is0pmwyihIuO5xoZSmYRBj3yGTKyRTW+Y8vWSjBTja8yoQ4+1qYKFMzB7/5nyZNltWOeG4nLvtq9s1FBKHdLNOUdwhu8UosJcaKS+hY8HHmYI0t8qRqVJMnoeNBXuezyKkN/QHHbsjQx57xb2EPMxKlMiP3Qps= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=FRzuQqWa; arc=fail smtp.client-ip=40.107.209.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="FRzuQqWa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=B2oVeHZmCLHuxhvEc5l7oVHBnAbc24Gp/xQ432ZarNiZgMu2reo27WCSqyQWjKk6W10YWDf3QH4dOs2izOe2LL5BdFUw/qgWfzXMJQ6TY/3g+rGY7kXpINRnBlVwvBC/DrRho6nifuX5YZIstyjamqvpd9UI/l77hrLSMFcCBU5O3qVIfaAOCnoeMvgPECsIeIgjtIzhLMkxK9IRs3ni9txJi8VCL7DdCMC7F4wtN/sICeeMgSNrpkQzhyjDLccpCOtj1d4ic8El21Z5SrScoSmeuQYTLog0ODWi3JbsseaFK92MjSDh4x1VqIRJAWTkEqC2mEWpQcg1nXJlwBV9lg== 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=PjRoxYtr+HwTX/62uVJXlN0rY04P0tBxVtRmL8VDcuA=; b=WY6uKTUHHxzAgT8gS/tTPYon883qLonUOoOV2g0xWXYx5DZM6t1CAV1RYbXVR/R0io2NNL8egiUwi5sR1BvCuYWfmG2q/lO4MYYcnBhRkQCK18ARm8c66fuemM5PsPqdAwplfe4JkZRjs0E1ftZbfIgPvBNEcOTJQaJRsWFfyLZMJA6jawLnqWZbYT4b8w7pNILaijW+Zm1i9bN2ZHuNACEUoWRUP0+esy261wEibnHPuLcQMJZv5m3v0Lp8sMPq52KxsV7LC3bctkkiux5qJMkcOjrvn3AqdG456/4mDk1DSKgj7e+Ah9HXdjqB5X/aicTXP6PgfSQObaUIhWXe+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 198.47.21.194) smtp.rcpttodomain=linaro.org smtp.mailfrom=ti.com; dmarc=pass (p=quarantine sp=none pct=100) action=none header.from=ti.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PjRoxYtr+HwTX/62uVJXlN0rY04P0tBxVtRmL8VDcuA=; b=FRzuQqWaBAZCvcOuJIFirioCu28z7PPMTl204paV0p+1PcaxSixBdrEsmuTLoVHlyUev3waI5SAr/W8Q1GPvBNA5sxNnIZLi7hzzEJ3IKIdfYUObf/Stx7TD3ujyMbI9EyqoOj0Bmkyg4E6RmQZLpqIF/c9I07X0fdfElWhhRz0= Received: from BN9PR03CA0897.namprd03.prod.outlook.com (2603:10b6:408:13c::32) by SJ0PR10MB4800.namprd10.prod.outlook.com (2603:10b6:a03:2da::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.10; Thu, 20 Nov 2025 09:22:29 +0000 Received: from BN2PEPF000044AA.namprd04.prod.outlook.com (2603:10b6:408:13c:cafe::22) by BN9PR03CA0897.outlook.office365.com (2603:10b6:408:13c::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9343.10 via Frontend Transport; Thu, 20 Nov 2025 09:22:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 198.47.21.194) smtp.mailfrom=ti.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ti.com; Received-SPF: Pass (protection.outlook.com: domain of ti.com designates 198.47.21.194 as permitted sender) receiver=protection.outlook.com; client-ip=198.47.21.194; helo=flwvzet200.ext.ti.com; pr=C Received: from flwvzet200.ext.ti.com (198.47.21.194) by BN2PEPF000044AA.mail.protection.outlook.com (10.167.243.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9343.9 via Frontend Transport; Thu, 20 Nov 2025 09:22:27 +0000 Received: from DFLE200.ent.ti.com (10.64.6.58) by flwvzet200.ext.ti.com (10.248.192.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 20 Nov 2025 03:22:16 -0600 Received: from DFLE206.ent.ti.com (10.64.6.64) by DFLE200.ent.ti.com (10.64.6.58) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20; Thu, 20 Nov 2025 03:22:16 -0600 Received: from lelvem-mr05.itg.ti.com (10.180.75.9) by DFLE206.ent.ti.com (10.64.6.64) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.20 via Frontend Transport; Thu, 20 Nov 2025 03:22:16 -0600 Received: from LTPW0EX92E.dhcp.ti.com ([10.249.133.122]) by lelvem-mr05.itg.ti.com (8.18.1/8.18.1) with ESMTP id 5AK9L1c73383883; Thu, 20 Nov 2025 03:22:10 -0600 From: Niranjan H Y To: CC: , , , , , , , , , , , , , , , , , Niranjan H Y Subject: [PATCH v1 7/8] ASoC: tas2783A: use acpi initialisation table Date: Thu, 20 Nov 2025 14:50:49 +0530 Message-ID: <20251120092050.1218-7-niranjan.hy@ti.com> X-Mailer: git-send-email 2.33.0.windows.2 In-Reply-To: <20251120092050.1218-1-niranjan.hy@ti.com> References: <20251120092050.1218-1-niranjan.hy@ti.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF000044AA:EE_|SJ0PR10MB4800:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ecb8533-f7c5-43d3-9376-08de2816528a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|376014|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1muGoourC9ZY9TCEL8K3VtUzp2aOZVQk35YMHQQyH4KZ3mBhigZqgUz7QbTR?= =?us-ascii?Q?6OjotWZ65VxTqrkR0D2ajBzIuf+SpW5Qtb5Ux2kdGnFni0UuQ8Fm5EQvW2Pi?= =?us-ascii?Q?LrTbJ4S0BTy+FNUpYGxOAmy1tSt2q5Z8GS6VI/jpeTnf+sXWw8PY0ozbB/Js?= =?us-ascii?Q?vOoFt/yZum05d8agwqE8ai1hJXxLOo2nmKPhEZ8QIJdw25wIX1VdzIEr1s79?= =?us-ascii?Q?9t7kYGqA2/i3iVTqatJ74awRTmv++Cor/98kIU612NVRcjBzaNdY6m8+wHlF?= =?us-ascii?Q?agAXlKiXc6z3vgGOFWlMvKWgMZAgEHxheS4ObuQyBuq5VlO6GczHjJP1lKW/?= =?us-ascii?Q?oMRmHQ4QflagcKk1HbAyuEs2JP8qO8/op9IZg3s6PeoMP9aJQdzGe6loVTYs?= =?us-ascii?Q?Kv8X3RNeT+BH8F80gw0tH8W9+aJbz6NH8WUX9jBO/36FZ9wF+ki7VkihmUi3?= =?us-ascii?Q?R2RbLZDY6OCOWQqAVqaPIyxr/M7Qe+e9Zm9tYqQPIM7nNYp6npU/JHfvzDTk?= =?us-ascii?Q?Gs7LUR4YCDmk/n2sfwqLARq6fNX4KcWYqpBx//BEW9Mqb1cgfYIJpXsM8HzG?= =?us-ascii?Q?TK0qzWrvOhTdb+0tT1JXdwd7U3JJTobQ5pFE9VgLRK44ugNyH4NAJYkDuzwA?= =?us-ascii?Q?r3V9xjq45Ub4EWRcov7KIDh39nfvebSUgnpwuLg1wuMlOagP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Hz3oxbUUOOaPIPZGyM=3D?= X-Forefront-Antispam-Report: CIP:198.47.21.194;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:flwvzet200.ext.ti.com;PTR:ErrorRetry;CAT:NONE;SFS:(13230040)(36860700013)(7416014)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: ti.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Nov 2025 09:22:27.1179 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3ecb8533-f7c5-43d3-9376-08de2816528a X-MS-Exchange-CrossTenant-Id: e5b49634-450b-4709-8abb-1e2b19b982b7 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=e5b49634-450b-4709-8abb-1e2b19b982b7;Ip=[198.47.21.194];Helo=[flwvzet200.ext.ti.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF000044AA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4800 This patch adds support for parsing the initilisation data from ACPI table. This table is required to configure each device correctly so that correct channel's data is selected during playback. Signed-off-by: Niranjan H Y --- sound/soc/codecs/Kconfig | 1 + sound/soc/codecs/tas2783-sdw.c | 61 +++++++++++++++++++++++++++++++--- 2 files changed, 58 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 433af9bc7..94d66e4d5 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -2146,6 +2146,7 @@ config SND_SOC_TAS2781_I2C config SND_SOC_TAS2783_SDW tristate "Texas Instruments TAS2783 speaker amplifier (sdw)" depends on SOUNDWIRE + depends on SND_SOC_SDCA depends on EFI select REGMAP_SOUNDWIRE select REGMAP_SOUNDWIRE_MBQ diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index adfbccedb..5be163664 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "tas2783.h" @@ -78,6 +79,7 @@ struct tas2783_prv { struct snd_soc_component *component; struct calibration_data cali_data; struct sdw_slave *sdw_peripheral; + struct sdca_function_data *sa_func_data; enum sdw_slave_status status; /* calibration */ struct mutex calib_lock; @@ -1179,7 +1181,7 @@ static s32 tas_io_init(struct device *dev, struct sdw_slave *slave) struct pci_dev *pci; struct sdw_bus *bus; struct tas2783_prv *tas_dev = dev_get_drvdata(dev); - s32 ret; + s32 ret, i; u8 unique_id = tas_dev->sdw_peripheral->id.unique_id; if (tas_dev->hw_init) @@ -1223,9 +1225,24 @@ static s32 tas_io_init(struct device *dev, struct sdw_slave *slave) dev_err(tas_dev->dev, "fw request, wait_event timeout\n"); ret = -EAGAIN; } else { - ret = regmap_multi_reg_write(tas_dev->regmap, tas2783_init_seq, - ARRAY_SIZE(tas2783_init_seq)); - tas_dev->hw_init = true; + if (tas_dev->sa_func_data) { + for (i = 0; i < tas_dev->sa_func_data->num_init_table; i++) { + ret = regmap_write(tas_dev->regmap, + tas_dev->sa_func_data->init_table[i].addr, + tas_dev->sa_func_data->init_table[i].val); + if (ret) + break; + } + } else { + ret = regmap_multi_reg_write(tas_dev->regmap, tas2783_init_seq, + ARRAY_SIZE(tas2783_init_seq)); + } + + if (ret) + dev_err(tas_dev->dev, + "init writes failed, err=%d", ret); + else + tas_dev->hw_init = true; } return ret; @@ -1275,12 +1292,47 @@ static s32 tas_sdw_probe(struct sdw_slave *peripheral, struct regmap *regmap; struct device *dev = &peripheral->dev; struct tas2783_prv *tas_dev; + struct sdca_function_data *function_data = NULL; + int ret, i; tas_dev = devm_kzalloc(dev, sizeof(*tas_dev), GFP_KERNEL); if (!tas_dev) return dev_err_probe(dev, -ENOMEM, "Failed devm_kzalloc"); + i = -1; + /* check if we have any SDCA function data available */ + if (peripheral->sdca_data.num_functions > 0) { + dev_dbg(dev, "SDCA functions found: %d", peripheral->sdca_data.num_functions); + + /* Look for Smart Amp function type */ + for (i = 0; i < peripheral->sdca_data.num_functions; i++) { + if (peripheral->sdca_data.function[i].type == + SDCA_FUNCTION_TYPE_SMART_AMP) { + dev_info(dev, "Found Smart Amp function at index %d", i); + break; + } + } + } + + if (i >= 0 && i < peripheral->sdca_data.num_functions) { + /* Allocate memory for function data */ + function_data = devm_kzalloc(dev, sizeof(*function_data), + GFP_KERNEL); + if (!function_data) + return dev_err_probe(dev, -ENOMEM, + "failed to parse sdca functions"); + + /* Parse the function */ + ret = sdca_parse_function(dev, peripheral, + &peripheral->sdca_data.function[i], + function_data); + if (!ret) + tas_dev->sa_func_data = function_data; + else + dev_warn(dev, "smartamp function parse failed:err%d, using defaults", ret); + } + tas_dev->dev = dev; tas_dev->sdw_peripheral = peripheral; tas_dev->hw_init = false; @@ -1335,6 +1387,7 @@ static struct sdw_driver tas_sdw_driver = { }; module_sdw_driver(tas_sdw_driver); +MODULE_IMPORT_NS("SND_SOC_SDCA"); MODULE_AUTHOR("Texas Instruments Inc."); MODULE_DESCRIPTION("ASoC TAS2783 SoundWire Driver"); MODULE_LICENSE("GPL"); -- 2.25.1