From nobody Sat Nov 30 00:57:24 2024 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2074.outbound.protection.outlook.com [40.107.96.74]) (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 5CF9B1D67AB; Fri, 13 Sep 2024 09:07:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218424; cv=fail; b=vCKwDPa+Ha+sQrwzXjmPj9/5dfuKfgtkhgalBl/i/+IGsj7jP668IJ9+dVX51rE5my/iYezSKYu33qJXsViqBd8Ji6Dw7/tPAAQgf5WO2802zYt0f5xOgFrRbRuVzM+TeNrgDMsjhAo8XP+NEmY+vF3opbizuRSzXrwUqqwqq0U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218424; c=relaxed/simple; bh=67QgmAMHmco+n8LJcc8yjIzjhmMa7X+JYsIcl4wRFZw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QfFKIaIPTQO0x6xn8VDIUJw4YIsN1HuxAuwqvNZ5FY6c3Nbf18O2vdItkxpinnr/Nnc1w8pj5thMbB4kXJPl8C31tzzCzw+Hi3w9mA8Pnf4DtjWCh1Xrt0364bSncgDGZLjvYXSt57Zy1oop4+nnvwE9i5uY5zgOIfOW1M10Kfw= 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=G5n5S/Am; arc=fail smtp.client-ip=40.107.96.74 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="G5n5S/Am" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=or27utf2W9jqaIcFxB2w8Ox9Kh6KNEZiyXvjAO02mQRAYp3Ii6deoFrqFIUOxValu1xumGh3GpGlLQFpfy3YI1RfViUJocIkZv2yy5Xl8HU7B/aVKmr0GDaUzrtjVA9iKbq0rF/81cFV7j9pInqU/CKlX3jBuMrBrzj7UjnbWVxJoGMx+r60HP5Ss6q9tAPWdy2F37cmPu0G7upH7jBihrmzKtjJC7gyMga8Qu6DVyy/z9uyd7qmBb19HOttf5txZFjnw2nXv03cgCXPSUdFrxICiIVm4Gz9fpigU0eEr+3lIyoafy2+jwNAG/IF2Zj7oECpNwAdJI9MGEb7jkPkxA== 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=JKJRG52gtc3gAAXgs1/Xvt5aYJVV5qg7RqE2NMVaod4=; b=XPlGT8tbTekcW9biWT/U1DzpJq0rr9C9nwB0Xs+ah1dgH0iHm5jjHvSurb25Ud7FPO8IM7plo7x1PvH6omrJBzDSOAzHs6lgwORTUv1CQpMrHyT6dFKSTepMJY4njt9QEC071fsLq61Yf302FQbsgcM1qno6UYWggj86WYLRQCWx9v4e4lIwSVu1FfCDgN0vUkUf4wfItfELFxp3uxLcKoj9RQPLLpaChelAv24iq+XmgHfavgXxpJ5pdi2SwlS73ImvpBio437cbNpheiOpZiDqKeDoW06hylU7aam8beKzjdOitMw/gffwSUWnFXUUm2oolm1lR9qwi6AcCH5wbQ== 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=JKJRG52gtc3gAAXgs1/Xvt5aYJVV5qg7RqE2NMVaod4=; b=G5n5S/Amguqc8m2gZKn2yX125AzI373DGDTk9qlax0YDQ3krCoNsRxXh9A7+8SaXyFALUFrHwWHc/nhXYJCIvBTannBHUWf5mkGAekzn4L/kjdD6FRAYIDOtGy/zcHNj4HkFWAjrpsLZjpmQpDJFxvcarHCX7x7AV1ZOOpMHV/M= Received: from PH7P222CA0029.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::31) by CY8PR12MB9034.namprd12.prod.outlook.com (2603:10b6:930:76::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.22; Fri, 13 Sep 2024 09:06:58 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:510:33a:cafe::41) by PH7P222CA0029.outlook.office365.com (2603:10b6:510:33a::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.29 via Frontend Transport; Fri, 13 Sep 2024 09:06:58 +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 CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 09:06:58 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) 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; Fri, 13 Sep 2024 04:06:52 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 1/5] ASoC: intel: sof_sdw: rename soundwire endpoint and dailink structures Date: Fri, 13 Sep 2024 14:36:27 +0530 Message-ID: <20240913090631.1834543-2-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> References: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|CY8PR12MB9034:EE_ X-MS-Office365-Filtering-Correlation-Id: c7ba93d4-9eb8-4e09-5fc9-08dcd3d36bed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?x2ilpS4krt+Lgryks0dV0g8YiGDtxsjuDXCqUGgtKbM0JStbb4uliPiMNC0E?= =?us-ascii?Q?iLbrZ+dV3avmy57L30bOrbrUEhmBdRzPGJr4a/WRXqv9CTJ4wPt3kq4UTeW1?= =?us-ascii?Q?QrXEmSB3f2WvaZSn2gnkxWiFb8tpzC/fRLZBk++veMpuzrLu8iw1lZtyN38x?= =?us-ascii?Q?T8LkhQPc1eMG8DSJaUztnle2zpkX9qbG14eF0czX7xwSFKvHNyVBdzFd7KKC?= =?us-ascii?Q?wA7LqBpidNAvhL4Y1ZESOkXC/hEGFG8R1mLiRafidkJDD89692JjjgTJEbu7?= =?us-ascii?Q?gUmOAXHMgXNPO+o9Nkfc+npW0YuzefFhUeTccryvLQYx3oI9UJSMEddUkZct?= =?us-ascii?Q?lNC6hdPCZhzSWnqRtsysvxgD+L9h0A8Ov5Owiz5V0QbkaOrhsqSYrVdNJYPR?= =?us-ascii?Q?0SgCQf3klxFXHnwLw38Jzbwl/4g5rq1beklKGm9gDrx6Wvk93/Sm3O6WCPVd?= =?us-ascii?Q?xA/sVfwQvgh0TfvJ4n2XFulMM1D4mZCC87ukX8ZLYIryjuIjY48e3wjeHtKO?= =?us-ascii?Q?xbX+i2uqOUjT0208P3b2n9/1SMa83zGyN91k2uX02npfNOnlz2XBf6iVL6lW?= =?us-ascii?Q?BR8OeeGFVyiGD/7yTBUM0H9fv6+w+QQ7urK+gOIASsQmgNJf6UxigPnfYZWP?= =?us-ascii?Q?Zz7htTr2Y2mCivgT2eWJ3jcjAK8QB4Hv4BqIgNm2dF2N0oAgZU0ztFnLaLAC?= =?us-ascii?Q?6scxb4+qqR76hdsUDYSNuiX0INGKQghpj/imc7pHso+majHngR/2sx9476V/?= =?us-ascii?Q?YAQZAzFdJC6lnWiMiv3wnAFkjCI8BYM9hVXkR0zyKCxtTXsl5lCvfmySZMbd?= =?us-ascii?Q?Nwx0sa5WToOLPsUjUlG1uuPmqWW1D4IuoZ6Vj7tdyniA/lgEwFYegf2pIzaW?= =?us-ascii?Q?k02zANi4bA5BGDFztzSrHyHe5O+FHXv4zRXTVW5lI0u5XuRZY3lDFPNZbg0U?= =?us-ascii?Q?3dTU76hqAmUDkoLX4e0MiQOKDlTWr9qaLJM/yY28tcZkmD9hhCqUc1mxJF5s?= =?us-ascii?Q?iMvszkkEGkTJ0YodtexP7+Sn17um1kgxc5X4+wsv5jnHDwxyYR1Ban1sRdj7?= =?us-ascii?Q?gc7wpe5u6IZDdOgZu6MyT/NzqiIPGykIekUmreMzy+cS4hmARC3/4R19xZWX?= =?us-ascii?Q?iui/hrI55ixjyTEPKJg/cZYVnFmB6hv+HPTvmkSQ0x0JY3NhynfkhNLfP3Lc?= =?us-ascii?Q?eYhZYG2s5Vk2k0NCFVZ1tzRhLorGU10AbKQb2oxAYOZuwV6eEEf27aC74W74?= =?us-ascii?Q?ulORvtZdgHbLUYFkv82Uo8olTlJZZUIfhCIOl6PcqRqXFf0z2OETDY5Xn4Gx?= =?us-ascii?Q?0AtN4457USrYrFtMqpn57tpwDO1LkZEgAVqbilZ3MSUtCXofAtCnkpr+A4mL?= =?us-ascii?Q?nS2GPTvsJtvilNrpmRSh86KKPpsZVjEy73WMfdX8UqNaR9VbpG/wTw86dDLg?= =?us-ascii?Q?ucNQeNwYB0JREujJk5GPG7Fcx4n75VVn?= 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)(82310400026)(1800799024)(36860700013)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 09:06:58.0171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c7ba93d4-9eb8-4e09-5fc9-08dcd3d36bed 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: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB9034 Content-Type: text/plain; charset="utf-8" Rename SoundWire endpoint and dai link structures with asoc tag to make it generic. Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index f10ed95770ea..6eeddced1f6f 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -617,7 +617,7 @@ static const struct snd_soc_ops sdw_ops =3D { .shutdown =3D asoc_sdw_shutdown, }; =20 -struct sof_sdw_endpoint { +struct asoc_sdw_endpoint { struct list_head list; =20 u32 link_mask; @@ -629,7 +629,7 @@ struct sof_sdw_endpoint { const struct asoc_sdw_dai_info *dai_info; }; =20 -struct sof_sdw_dailink { +struct asoc_sdw_dailink { bool initialised; =20 u8 group_id; @@ -660,8 +660,8 @@ static int count_sdw_endpoints(struct snd_soc_card *car= d, int *num_devs, int *nu return 0; } =20 -static struct sof_sdw_dailink *find_dailink(struct sof_sdw_dailink *dailin= ks, - const struct snd_soc_acpi_endpoint *new) +static struct asoc_sdw_dailink *find_dailink(struct asoc_sdw_dailink *dail= inks, + const struct snd_soc_acpi_endpoint *new) { while (dailinks->initialised) { if (new->aggregated && dailinks->group_id =3D=3D new->group_id) @@ -678,8 +678,8 @@ static struct sof_sdw_dailink *find_dailink(struct sof_= sdw_dailink *dailinks, } =20 static int parse_sdw_endpoints(struct snd_soc_card *card, - struct sof_sdw_dailink *sof_dais, - struct sof_sdw_endpoint *sof_ends, + struct asoc_sdw_dailink *sof_dais, + struct asoc_sdw_endpoint *sof_ends, int *num_devs) { struct device *dev =3D card->dev; @@ -687,7 +687,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *car= d, struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; const struct snd_soc_acpi_link_adr *adr_link; - struct sof_sdw_endpoint *sof_end =3D sof_ends; + struct asoc_sdw_endpoint *sof_end =3D sof_ends; int num_dais =3D 0; int i, j; int ret; @@ -738,7 +738,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *car= d, for (j =3D 0; j < adr_dev->num_endpoints; j++) { const struct snd_soc_acpi_endpoint *adr_end; const struct asoc_sdw_dai_info *dai_info; - struct sof_sdw_dailink *sof_dai; + struct asoc_sdw_dailink *sof_dai; int stream; =20 adr_end =3D &adr_dev->endpoints[j]; @@ -799,14 +799,14 @@ static int parse_sdw_endpoints(struct snd_soc_card *c= ard, } =20 static int create_sdw_dailink(struct snd_soc_card *card, - struct sof_sdw_dailink *sof_dai, + struct asoc_sdw_dailink *sof_dai, struct snd_soc_dai_link **dai_links, int *be_id, struct snd_soc_codec_conf **codec_conf) { struct device *dev =3D card->dev; struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); struct intel_mc_ctx *intel_ctx =3D (struct intel_mc_ctx *)ctx->private; - struct sof_sdw_endpoint *sof_end; + struct asoc_sdw_endpoint *sof_end; int stream; int ret; =20 @@ -845,7 +845,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, continue; =20 sof_end =3D list_first_entry(&sof_dai->endpoints, - struct sof_sdw_endpoint, list); + struct asoc_sdw_endpoint, list); =20 *be_id =3D sof_end->dai_info->dailink[stream]; if (*be_id < 0) { @@ -936,7 +936,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, =20 static int create_sdw_dailinks(struct snd_soc_card *card, struct snd_soc_dai_link **dai_links, int *be_id, - struct sof_sdw_dailink *sof_dais, + struct asoc_sdw_dailink *sof_dais, struct snd_soc_codec_conf **codec_conf) { struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); @@ -1104,8 +1104,8 @@ static int sof_card_dai_links_create(struct snd_soc_c= ard *card) struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; struct snd_soc_codec_conf *codec_conf; struct asoc_sdw_codec_info *ssp_info; - struct sof_sdw_endpoint *sof_ends; - struct sof_sdw_dailink *sof_dais; + struct asoc_sdw_endpoint *sof_ends; + struct asoc_sdw_dailink *sof_dais; int num_devs =3D 0; int num_ends =3D 0; struct snd_soc_dai_link *dai_links; --=20 2.34.1 From nobody Sat Nov 30 00:57:24 2024 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2053.outbound.protection.outlook.com [40.107.223.53]) (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 C28731D58AF; Fri, 13 Sep 2024 09:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218433; cv=fail; b=MWyI/6y0Yi7Fk+CXISHZOipWy8PnntVcGtmnlq4DXwWRzc3OsgWNj3IgoysbX6KOvCzIELx7l+yr4Y+pYe4e48mXixeuEnn7qnld01HWRSabb2AHLN2P8ObJ7iXAv40BZCJ23zVh8AgB3LKwY1TmEk4daP0mjCdvM8VLdHHk1TI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218433; c=relaxed/simple; bh=akWy9Jc7+hF8GsuZFH9CGA48tSlEyDt4Hgfa1IFYXJc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dvBk1Di8O8g3CSx9GaiEuWmMSld0/Tg3oXwmyBO9WGqhhmQ2ynEdcsxoPhfbF2JxWKW9pQMIYRpPWrZ2r1TkthkEVdSbiB8/7ag5lMfBwMihAcj4wOVmV9YjrrOcG8pvyFfmTMFI6mZaxHGTS+gy13cQoDUgspU4SeaJDmwXC18= 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=XE7XSnef; arc=fail smtp.client-ip=40.107.223.53 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="XE7XSnef" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ir2ihDnq5F2PLbYeSLSzTwfWRKC+J6SoyFxAgmUJH9xYyDtFikpIB/42ZbspBXB+SNHbdM5zMGsS1dzfVVO9f4Z7980qQeSCvuN5awZYgcWjUjvvs/UZ9n365qPqHpAiT1zlfyCnT3WpHT+Uz9bpMuapogTbZH6v+oK9mtjXS2aM69MpXbFKPek8GlRpM9T8vxkfSpYMOOA33JHFJ7eVYuMFP5shdx7gZ2/1TrAcL4gA/FW7hUO8eHfIWsI5GAin4imI882QdQtRMMmbqYSWOJLs/qB48j9r4AZ8/IQHqxHeCS+PdzzZjDrpDiDDbEqT9WL1PDp5RqQKvf70n8LJPg== 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=19q26TQkLNuoRQJYZM+DRc1DluH0Dy5Xu3w7aezap6U=; b=IHQUiZROGl6SR0+CvpTJyyaCqy+pl8/U66bPESFXx9fAGHDz63sfMH28EPBpBlNvmSRpQMAehzVPEOlQr7Y/bazxMvLcQtJmyqSdbJIHPsoeDqdyYlH/RcuvSWQWYbasY1k1HTox44PUiMl7a8pfDsOAmDjzVMMmJKKi8dmOEBcDiu6wrn/m/pTKaVkOsL4isJU5xE4IRTOkAbRDObcN2jUQlMa8PzLaTT9Ln57lHuBHh22PmmN+BXhCXFvitRaXl2cEVCgaKTQXeQIfW0VMrhkyWcSndNKhOxKEnHKbhCJIkDyA+bvhhROEVouiqY51sorO71S0AiE1owfxcPYCrg== 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=19q26TQkLNuoRQJYZM+DRc1DluH0Dy5Xu3w7aezap6U=; b=XE7XSnefelBxcnu+1b20kR+aKDZg+0oupXq0FNuie1i8IQhY7bon2Y+CgHSe2Hg8uuUL18JWu26Zv7V4qWerb4yKGs8FQVhPSOTWJ2LW1AsXE4LCB4xB4gYEvlVWijd7I1DqPJK25bktUDvzbZMbyRpANGYJxtgt/5XGJs03/so= Received: from PH8PR02CA0007.namprd02.prod.outlook.com (2603:10b6:510:2d0::18) by SJ0PR12MB6781.namprd12.prod.outlook.com (2603:10b6:a03:44b::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Fri, 13 Sep 2024 09:07:08 +0000 Received: from CY4PEPF0000EE35.namprd05.prod.outlook.com (2603:10b6:510:2d0:cafe::3d) by PH8PR02CA0007.outlook.office365.com (2603:10b6:510:2d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23 via Frontend Transport; Fri, 13 Sep 2024 09:07:07 +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 CY4PEPF0000EE35.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 09:07:07 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) 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; Fri, 13 Sep 2024 04:06:57 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 2/5] ASoC: intel: sof_sdw: rename soundwire parsing helper functions Date: Fri, 13 Sep 2024 14:36:28 +0530 Message-ID: <20240913090631.1834543-3-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> References: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE35:EE_|SJ0PR12MB6781:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c1cbc95-1138-4b17-7a2e-08dcd3d37179 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?KGEIbOXqNHLupUyBUDju1r0mYuV0QOdG8VzkRH9eHlFVsblnWgCr/6hXzbdB?= =?us-ascii?Q?tG+jI/NQ0lGeI8oDuNM1gD26jnC/h5bYjk5zyKNK13BxWRYZZSCLj5iPO1no?= =?us-ascii?Q?aQGaDFiBx9QpJKL3AffCSgWGyXBh04qPgc3Ij0xUKCRhazPTOusOccRzhX5l?= =?us-ascii?Q?MLE5XVeO5NrGrK1IGyBEpny1eMyWBkK+QhSURgdcST/zOgutwEjxFFrSaa3d?= =?us-ascii?Q?6jeKUjEA1FQt3GP9ckIJM3pBOwDx3tTdd0eLY7rrz2lBfyz4+X9xnvUbFuL9?= =?us-ascii?Q?T1evK8/iN7ULUUthugrlyh2QLiRSC+JSsogW1DBv5Nl4F4GqnFrEbqOgkfAw?= =?us-ascii?Q?4ZMgA6OBRu+VX1Z0hNabwHEWvbmZEAg4lymQiQHEknASqtf/BdKLUeBcbqRx?= =?us-ascii?Q?eDn/S0Hux+iDQS2CRQ+BgoviHLZjFIL0rmZNYxshQGeU8eIwLpM7mcXdGEYS?= =?us-ascii?Q?Dv8DQjBJokxWxYNLWkS6IMo20ZhJ7uvLNVo3o8v+Ags+Rf68qDpHPm7vHTT8?= =?us-ascii?Q?RQ1ixN5j4xrE3OYewqG2eqDgMAodEVpyHfPg+jG88hguSLX2ozBhJtWsENVH?= =?us-ascii?Q?5QDWBzhaoTLTM0pU/Cew89sab+NnOY++4BseUzSR8nuZkx77ZtXvpzLBRsyQ?= =?us-ascii?Q?HU0fbR15Cj9Psgy6OzfGPLRBIgag5qrMasRWC2Yfh+cBkvf9aM0MQIScBiR0?= =?us-ascii?Q?2JKSvjJd4JecL7+Oorsh+65YAU36eM3siMW8xaefa3FnVmBASxape+eZkrnD?= =?us-ascii?Q?jGzSQUcO+jjCowISHfWUE4XQnaC5lY3zAuap9nAYjgJljt+ixZb274u4r/jP?= =?us-ascii?Q?Vr2KS5M2/kdOsfHA1l5vESsyrMPueIXyWtqJCv6szRT5kQWaPLd0bR1rC4gh?= =?us-ascii?Q?rN4Jrbqz5oB5H3Z7bEeS/Yvh/uRrB7yxLLVerLRedDOrbMqNX3aR9n71RtEX?= =?us-ascii?Q?XYZ9OVXB2RT5biMDlXbhiGqnx73OdAxgm8w2oZMSK4IR30VNajti2FShQ3p6?= =?us-ascii?Q?e3VJuUFibU5wLFVZ/qBDJ7bjojKHzX78kNpsJG+t5eWhsAQFgUd0SSbBJ0Bk?= =?us-ascii?Q?mfs0SICrsu8Nb+zS0BYXcvGID85xbIo17rRlkIXVC9dpfzShqxqQRtEIu/ak?= =?us-ascii?Q?mM4I1nsPZjmb1Wq7+RWKgbdExVvYzxmOAeQaYrvfrttkPPVG8glFrZJKQG/S?= =?us-ascii?Q?XCdTASkFXhirFqTCjXt0wMw/1gVRDa9UgSUZYCEmVW87It73Gfv4crpy2GXa?= =?us-ascii?Q?jY3MFvBd+OL2U0nn2UVHAX3FBQi2gjJzD6XTLmforjwKmSkNF/8FAKSpp3tw?= =?us-ascii?Q?vvUTio5H3BoqWPjsmgU6qRs2pOr75fDN0wtvbATfiWr2X50INlLL3xWZBONT?= =?us-ascii?Q?paI6BJ7f9dtd3J3B4x7PosIVyL9baDfMCn73ZWMFqOHhYPQS9ildi9LbdTF7?= =?us-ascii?Q?DJgzgXaDS3fQ07yvq2uF7JE99z/Jm5Z4?= 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)(36860700013)(7416014)(376014)(1800799024)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 09:07:07.3239 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0c1cbc95-1138-4b17-7a2e-08dcd3d37179 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: CY4PEPF0000EE35.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6781 Content-Type: text/plain; charset="utf-8" Rename SoundWire parsing helper functions with 'asoc_sdw' tag to make it generic. Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao --- sound/soc/intel/boards/sof_sdw.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 6eeddced1f6f..222cf4a37707 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -640,7 +640,7 @@ struct asoc_sdw_dailink { =20 static const char * const type_strings[] =3D {"SimpleJack", "SmartAmp", "S= martMic"}; =20 -static int count_sdw_endpoints(struct snd_soc_card *card, int *num_devs, i= nt *num_ends) +static int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *nu= m_devs, int *num_ends) { struct device *dev =3D card->dev; struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); @@ -660,8 +660,8 @@ static int count_sdw_endpoints(struct snd_soc_card *car= d, int *num_devs, int *nu return 0; } =20 -static struct asoc_sdw_dailink *find_dailink(struct asoc_sdw_dailink *dail= inks, - const struct snd_soc_acpi_endpoint *new) +static struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dail= ink *dailinks, + const struct snd_soc_acpi_endpoint *new) { while (dailinks->initialised) { if (new->aggregated && dailinks->group_id =3D=3D new->group_id) @@ -677,10 +677,10 @@ static struct asoc_sdw_dailink *find_dailink(struct a= soc_sdw_dailink *dailinks, return dailinks; } =20 -static int parse_sdw_endpoints(struct snd_soc_card *card, - struct asoc_sdw_dailink *sof_dais, - struct asoc_sdw_endpoint *sof_ends, - int *num_devs) +static int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, + struct asoc_sdw_dailink *sof_dais, + struct asoc_sdw_endpoint *sof_ends, + int *num_devs) { struct device *dev =3D card->dev; struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); @@ -743,7 +743,7 @@ static int parse_sdw_endpoints(struct snd_soc_card *car= d, =20 adr_end =3D &adr_dev->endpoints[j]; dai_info =3D &codec_info->dais[adr_end->num]; - sof_dai =3D find_dailink(sof_dais, adr_end); + sof_dai =3D asoc_sdw_find_dailink(sof_dais, adr_end); =20 if (dai_info->quirk && !(dai_info->quirk & sof_sdw_quirk)) continue; @@ -1115,7 +1115,7 @@ static int sof_card_dai_links_create(struct snd_soc_c= ard *card) unsigned long ssp_mask; int ret; =20 - ret =3D count_sdw_endpoints(card, &num_devs, &num_ends); + ret =3D asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends); if (ret < 0) { dev_err(dev, "failed to count devices/endpoints: %d\n", ret); return ret; @@ -1133,7 +1133,7 @@ static int sof_card_dai_links_create(struct snd_soc_c= ard *card) goto err_dai; } =20 - ret =3D parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); + ret =3D asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); if (ret < 0) goto err_end; =20 --=20 2.34.1 From nobody Sat Nov 30 00:57:24 2024 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2087.outbound.protection.outlook.com [40.107.223.87]) (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 486731D7E21; Fri, 13 Sep 2024 09:07:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218436; cv=fail; b=H8SmWUJsEa8yW/oMTMKrQq9jjEdSj+S5T0CiT3E3HQ2ylzdCF050f14KxGIR6p9O/qZ9cMfPGNOpNavxkuPFTqribPuYnxr2k2VH7LO+P52liu33jhVtZ3yYDgTcnKFi5u7IwYUmqfXZtKekLyAq7jTaQc1RdfsBxymhyGOSHqM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218436; c=relaxed/simple; bh=2Lc4GiLB8K1mdzeTgxlYGhsrGSETeSJTaQUqJMgN+WE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TNxMNiJt+WiEOrjLJ7rOc/K/TGhzXdHX48cWliBniZvmPjlWmhWAIV0QX1R28Oi0JON5Rd82PooBZJ0eIREQR+43Ln7eY+87/tJiDLfZd55aFRm/HtI6ycOMKsDU9YAY0aMaoECeXH0nNBE8eWetDFws+lHgxCajNPPiwKj5oio= 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=LH+x8Ulr; arc=fail smtp.client-ip=40.107.223.87 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="LH+x8Ulr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AOuEJ5Yxw9AEgZwoL8EQ/2ZIQoervGaaT0jqoGqiwKCg8UqXf6L7D1BoYdMgP8LVOEcYwiuNADJDQPcwhckvr/nCjORTdZKTP0ZVCcYfeqHkZ5PidG0h/Xjws85NYd+MW+zsOQ0NdL3ZNClqMr57WawZqdJsNW9Zpz1SBAXRMp6bs/sGTaT2yXE953q0aDJ/SPnRje8HwcuSSYxzLKmI4Rl1ZcsKceT9cV3BxJfTsvLVBYXDhQy8y8H1Li8kcTpjJ+63ic2HdSQa8R0o5eQqP0YMF9Hxw7T/RoX1X9AYgfvPjkqvhNY3eXG4AmPFi1Y0ZAnSa7BgLQjG0sn+gj9+1A== 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=2TGVG1rAtIOo6XDRP4na37RieCa1dYr9ZKoZRy2HGPk=; b=wcKmobwM0OZpYXwIheCZBIuxoslmJNleWr/pNjoKYYQwjndp2gtY3kIeXBOn8n3vZ+zZtPRiwYIZ2Zy2Zg4mZHtWpeme4SdgPoref6NnrtyirM27T7lQLWCvYuCFCJlebzkMvfKzvmUibFr57WB8Z78WKh3oHGfGmLsFX4BEqfvgUScUnDSFxm2q081pf9qd9vE6i9M/MexUp8MEdwHm2AfrvevkxxZu0E80U8IaLQ9KKMHlKyShvb+TWjLFaHF5eO7RRkC9851in4WCXzMTuXV9tWWQ9u+B7sz9R5frExlbZjadizcpPAeQUTub783erRBFYmYaKe9w3cPo/73N1Q== 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=2TGVG1rAtIOo6XDRP4na37RieCa1dYr9ZKoZRy2HGPk=; b=LH+x8Ulr7yroSbLJgiOuA39uUkUbfOCiwNA4JACRpfk9bqb19b/y51jPpfaSL5kVVGLf6mlgGxBqZsdnrfNkPwzr3aVPH5Am2pzIiNoS9xCZ/k1h7e9wl19vhI+Vzu4QBziJXs5foTkNQ4r9MgcOe7QACgga0wpTp1hkWOPmJxw= Received: from PH8PR02CA0014.namprd02.prod.outlook.com (2603:10b6:510:2d0::6) by SJ2PR12MB7944.namprd12.prod.outlook.com (2603:10b6:a03:4c5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Fri, 13 Sep 2024 09:07:11 +0000 Received: from CY4PEPF0000EE35.namprd05.prod.outlook.com (2603:10b6:510:2d0:cafe::dc) by PH8PR02CA0014.outlook.office365.com (2603:10b6:510:2d0::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.23 via Frontend Transport; Fri, 13 Sep 2024 09:07:11 +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 CY4PEPF0000EE35.mail.protection.outlook.com (10.167.242.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 09:07:11 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) 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; Fri, 13 Sep 2024 04:07:02 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 3/5] ASoC: sdw_util/intel: move soundwire endpoint and dai link structures Date: Fri, 13 Sep 2024 14:36:29 +0530 Message-ID: <20240913090631.1834543-4-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> References: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE35:EE_|SJ2PR12MB7944:EE_ X-MS-Office365-Filtering-Correlation-Id: 8671b957-db5d-4a71-d2dc-08dcd3d373fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IoNyGWLD/SvzZY+WTV+aQi3G2GBkqkSY8ifbGmOP/1D3ZtzQjqAlpILs52AL?= =?us-ascii?Q?/Acnh1QIT7WI25QGMzMbeI5ngjqgLEhwbTsaHNIOGW1JcTCo29cGaMxCaZQl?= =?us-ascii?Q?o4U6BEsk9iTSg+QBy9yiaqHeFmsFUK09pGS3zhz37QakSt5qBk9/2aDzS8+Y?= =?us-ascii?Q?Hh0xDAtF2TTNBvhMI4oWfAbMswVJAb5sHgrQZXa4n6GpIMAOSxwwqOlbK0OA?= =?us-ascii?Q?HZEsyPqwdFCG/aSxtTu94Lu2gSoM+lEPUEizL3fzi7MWH/5Y3chp0gaRSmPf?= =?us-ascii?Q?C4KOiHB5LPvY+Zn12UwMp6VIJ0NP0n4xkbueXizxzWbIiq1Lp58J7lYCTmPd?= =?us-ascii?Q?iPeYTAGNNlfdWxsx0qccMtcDylPxVLiVbcLekLE29n6zr/WFh9z1JOBbiEc6?= =?us-ascii?Q?6sECagDEVBM87yaqifoGUTryJoMqonE+AO3TxP2r2YoNDwgoMOQkeV3UHKH0?= =?us-ascii?Q?1EpSciGZmPstinbojrAMYtN0HU/T5aNve7brSDNl+pcY6iuUuZByrhPssY1g?= =?us-ascii?Q?EQKTrjm7D47+gZCLeZ1gWfdfUHinSfU8PRCZWCCLPQyfHkIDUooTX6kF90s/?= =?us-ascii?Q?xR9S/pBYl4KjS0ZTJGi0wH887mybesxGEnmaJWS1LLoLrihix9KlfFjDHN5L?= =?us-ascii?Q?0xZulyDc+QHZvdNxkSUT8TfDx3jFdeowDaElfxmvogiXSYsgLuwktZQoT1T4?= =?us-ascii?Q?j0jDLwYC0jvJMCkanFdpiBCWVsyg/6SxL39CGYClZi3AImnDZbFyueYG3Rxr?= =?us-ascii?Q?EGqYkfc11DWQ9SC82tV4dCD1YDGsuGRhVp3LpatbM88hFFHZ7RjHwRrDJ4aa?= =?us-ascii?Q?HDpN5QJ63gxT/szEiNq25VpuIwGEc3++wPGc7QfTR02AcOsiLRwCJc7LuxGp?= =?us-ascii?Q?dG/Tn11BSwyXu+5DOzDTzHsB1GaVazFb8s5uS7RxI7ozVve/LW9RzjdmkoSG?= =?us-ascii?Q?ulTgfC7VMBbh6GXAQQAE7obZfc+QPSJ66gFJ0ptDpqEot0m8t5E144POHoTB?= =?us-ascii?Q?h8PECd+EmUgol4xZKnubXQtkoOTMS9kGHbqn41GoVZNs9XQAL3bnyRC8QfGR?= =?us-ascii?Q?ws8zXs7J9RVgGTqt6JGFzD4LdklBN21U/Uh6MY4gF1bx3G0XDz93BBKsOoQB?= =?us-ascii?Q?DJyAtahXizfQqL2vH8GNA90llwzIgOH5RV3ZqwmZQ4sy1YqexhS9uLdMUeGi?= =?us-ascii?Q?lR509kGAd4BttyW5O5TQ7YvCshCd7FkmbPBMJpFAZvlQlYf78Q6ti/kknGTS?= =?us-ascii?Q?5FajKorWmEMi3f6frUFHQsKfdeig+YAYW63hknReamiNTftdlghWS3/KEqCT?= =?us-ascii?Q?TJN/BhWrjdlJP5Wpcvvt0Af2e2kSymyZGSKgN2MTc9kiUt2xy8U4N/rLV+dH?= =?us-ascii?Q?sAG2AveRuN9wqgz97prr1qkpAC4pzMplWKg1I9lVvfGnDmstHr31pZiVeORu?= =?us-ascii?Q?+c1/0I08rIYxpQ6t2+o3jkt49HNstRPs?= 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)(7416014)(376014)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 09:07:11.5270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8671b957-db5d-4a71-d2dc-08dcd3d373fa 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: CY4PEPF0000EE35.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7944 Content-Type: text/plain; charset="utf-8" Move Soundwire endpoint and dai link structures from Intel generic machine driver code to common place holder(soc_sdw_utils.h). These structures will be used in other platform SoundWire machine driver code. Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao --- include/sound/soc_sdw_utils.h | 21 +++++++++++++++++++++ sound/soc/intel/boards/sof_sdw.c | 21 --------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/sound/soc_sdw_utils.h b/include/sound/soc_sdw_utils.h index e366b7968c2d..e3482720a3eb 100644 --- a/include/sound/soc_sdw_utils.h +++ b/include/sound/soc_sdw_utils.h @@ -93,6 +93,27 @@ struct asoc_sdw_mc_private { int codec_info_list_count; }; =20 +struct asoc_sdw_endpoint { + struct list_head list; + + u32 link_mask; + const char *codec_name; + const char *name_prefix; + bool include_sidecar; + + struct asoc_sdw_codec_info *codec_info; + const struct asoc_sdw_dai_info *dai_info; +}; + +struct asoc_sdw_dailink { + bool initialised; + + u8 group_id; + u32 link_mask[SNDRV_PCM_STREAM_LAST + 1]; + int num_devs[SNDRV_PCM_STREAM_LAST + 1]; + struct list_head endpoints; +}; + extern struct asoc_sdw_codec_info codec_info_list[]; int asoc_sdw_get_codec_info_list_count(void); =20 diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 222cf4a37707..6b30659f0e25 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -617,27 +617,6 @@ static const struct snd_soc_ops sdw_ops =3D { .shutdown =3D asoc_sdw_shutdown, }; =20 -struct asoc_sdw_endpoint { - struct list_head list; - - u32 link_mask; - const char *codec_name; - const char *name_prefix; - bool include_sidecar; - - struct asoc_sdw_codec_info *codec_info; - const struct asoc_sdw_dai_info *dai_info; -}; - -struct asoc_sdw_dailink { - bool initialised; - - u8 group_id; - u32 link_mask[SNDRV_PCM_STREAM_LAST + 1]; - int num_devs[SNDRV_PCM_STREAM_LAST + 1]; - struct list_head endpoints; -}; - static const char * const type_strings[] =3D {"SimpleJack", "SmartAmp", "S= martMic"}; =20 static int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *nu= m_devs, int *num_ends) --=20 2.34.1 From nobody Sat Nov 30 00:57:24 2024 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2052.outbound.protection.outlook.com [40.107.212.52]) (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 CEE8E1D7E47; Fri, 13 Sep 2024 09:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218442; cv=fail; b=dErQLY1dkNFtmSQKEQnrpGWUaVdJinf53Yg4X0U7zwl7a+vqDiQGb35dp5HszE66Akn33vZRrBLvl/gmwnxIBBpzyOdYlMnC+ODGHrIOtE68EVavlkfw39TOl7ViTZ0yis20SNMsT/a7xLwmSQfVygGFLhI1Htx9p6oo3oGKR14= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218442; c=relaxed/simple; bh=Di1bxmwysb9WFJAKyqXgluM5cz8Fev/gtt65EeoHnt8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HwnpnERukLwGYg4FMUeOOYbrLpuTfu22s25yn/h94mz3GQlhHT3fh9YCqfNyCPk7VjHqzZX4f8UvHDnC3dBBlrAdTxYfOkdJ96y/fOHSryhDzdSgzn66rYTJp3Nc+LBLCcwzZ+PKavBOx2RGq24YR4fEn8inOP8mL0N29+549mo= 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=oy7lqV36; arc=fail smtp.client-ip=40.107.212.52 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="oy7lqV36" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GSWdKxCDbLbACAoSSdSXDzYrbdyp/qIpk9WagLM/V3mZdLXTcfGc/yf3bGcO1lxnyQpisAGFmxbfHbIMODlJOPQcJrx8xb/ejNiNGmauvcN5OUgsclRVpM12DPUn67UnzebzIZ4oVUllfn8DB5/UpEiqh7gZfngD1cZFv0g3u+K12Gu8gAMZ8nUKo0wxyv1STGJKD+Zbq9J/dyVRMNm4PinVldjGb4g4uFVD3kR/eTcIvrH0FV/ECQ0lNY3WbRus/2gyzn2yHAE7Tl16ijsgcZtFb14Td6y24MWGPkzMjJ8wTIWtNSYNYBmldRx+pk0TLlpd/KW0JF9S6MFLQDMp7A== 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=eM3RbXQpsn0B5ikrQSLkhLs6a25j5zbxsfe8PhyKsac=; b=IdaGthl58915j8ZNgUoglOl2zoM6PTUaKwcYp/K8uC8i4o/Xpttv1aP3+G++d5eEsLpNqrwPaEQCTobHnw4xxxf7nJ0Tw6wU6oHFabtIuFECGWHdmMQ1FfTVHhrc/qMoCfsqvql3YoNQBvkrBMeGWuA5kjXoo8tj0BtTMgyXYfHY70WqMsB5plsB8I8jAT5zhbx6sARDE5kE71+575+Fv91Ogk84rOQVbFvolgNMnWbWsiw76ErOKxHoSMytXr58xwon1aEvGYt1HqBdYYiyTAI5KGGl4zpZY6XJFAu4pwB38PzC+dwQ4IFynnwMUn54fvsiOKOrVRyAR6uT5P/inw== 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=eM3RbXQpsn0B5ikrQSLkhLs6a25j5zbxsfe8PhyKsac=; b=oy7lqV36luqevGfU1P/RPRSv2srZrpM+S0pghr5lvalUIC0zm2IwqTUatF9mYqEo7TjxbZaC8u7bo+UEpWLUeY9cAqV2jluPcZZbwrJTHdxD46kyVXTMydb6I8m24hCMIcBibMwkDaja/PIm1MwYvPkfAv/toJ0LpmwaMvTyEdw= Received: from PH7P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::9) by MW6PR12MB8897.namprd12.prod.outlook.com (2603:10b6:303:24a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.24; Fri, 13 Sep 2024 09:07:16 +0000 Received: from CY4PEPF0000EE34.namprd05.prod.outlook.com (2603:10b6:510:33a:cafe::a9) by PH7P222CA0010.outlook.office365.com (2603:10b6:510:33a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27 via Frontend Transport; Fri, 13 Sep 2024 09:07:16 +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 CY4PEPF0000EE34.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 09:07:15 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) 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; Fri, 13 Sep 2024 04:07:06 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 4/5] ASoC: sdw_utils/intel: move soundwire endpoint parsing helper functions Date: Fri, 13 Sep 2024 14:36:30 +0530 Message-ID: <20240913090631.1834543-5-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> References: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE34:EE_|MW6PR12MB8897:EE_ X-MS-Office365-Filtering-Correlation-Id: 2718fa33-3033-44b7-8308-08dcd3d37692 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|7416014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?F5hKH6ntRz+ishMrbKrrd2EwOROi8qmSbkUX4cFWBk4OkzcyK9eX5ejv93fQ?= =?us-ascii?Q?cTypnSx4zVQwPiERTBUUQJQs1x25U0UD3G+DUofJNWT2yfVj/etGssi/NQGk?= =?us-ascii?Q?93Lw2q+KRDXXxavrjp1p9i33fVhmRm79aWdEKv8XFmFL9WgNk2BA2m5QSehw?= =?us-ascii?Q?/Dv/A6V+cozePUdzoI9GpaitICTChAcYUVQLiDBW5FVpfq4ra9zFbiZkfSiK?= =?us-ascii?Q?+6tUqON1UdkG+wkjkVIiXpPR5KQJY2MtiQ6uNm6IL/Qzp+TTwjJRY3doKNbp?= =?us-ascii?Q?NsqvxLidwP74/IIHfJ4jEZwFiCXupRFQ6Cd0LeLWYTEPqm81vNjrqUEVzzgv?= =?us-ascii?Q?24s+TvK+XA20DWgXNkU/QZYP0AXS1Yxp77/cCtyBjBYLvdekL7oj6x+tQ5bT?= =?us-ascii?Q?XbQXZH1kBT0x9qtH3UmeMWW7OQixVIyK+v9RftVIDycnqqpHjGotjnURzcDo?= =?us-ascii?Q?3sXgbB1wQ5+fEvE06lUhZInWeNONseV7PS+mBDlAnKPOjKZu7Ab80jxhVG2a?= =?us-ascii?Q?fmQlSxo3HPLF0MzYDRL+ZoQ6z4SCLMN2x9zar+iw0LCd2leeonBNwQqAeAvZ?= =?us-ascii?Q?tqBufKuqN99Xjk+UNX+IXse7Mx5Qy/5GrShNLMD+lJFdruPO5LUNNi3VwKKM?= =?us-ascii?Q?kFYxN3Q742JcYfGwDKW9AM0iAW2pREuDA7n1W1th30b//6LEbnYiuPEGRVE+?= =?us-ascii?Q?RH5brJUVGjt6+oPGhAlAaDWd5Wtu0AgB7ZuXLmaUcRqo5RgBEEvosRySFwzH?= =?us-ascii?Q?Hhu1HBi+O+9BiPzhMA/OKAn1ChyQ4tSeMra4/ZJuwNOmrSSUMR+8ON5TM94f?= =?us-ascii?Q?wGeWW27CxrOeq5rqQad5euUdFEjVnx3yclzIdQy801MuZMZaghuOr7yolWEj?= =?us-ascii?Q?gWAkBj+ymsKe5+nYZLMkBLC0+4hgcvBh2JY4Z7oVrLcMfU9NJNYBdxDwq28N?= =?us-ascii?Q?LQv0pYHt1pX48fykkT2gaNDkBf2O7fFPDCDaIOjvAyO2z+7BH2UeDl3wtsxo?= =?us-ascii?Q?4SfvOpjd8yMmKX5mPQvjsnVEJQZNZCje6Y4oDWpOUCu1xX3ZCY+gP6P/UGXp?= =?us-ascii?Q?ohIr2YTUM71BdriJgQL7JRpHaJ0tcNSep/oMy7v+Xqf8oeNPYTvGxN+8LTlI?= =?us-ascii?Q?ncTAJISHVtD3Z4Jhi9xhOohorJ91Th3DfGqDov8TeUvtY1oMFX2L99efsMsT?= =?us-ascii?Q?yaxuCcTn9DwxicsQ7QE2ZZfq6JfktNs9JFVY0BZF/1ws6tDL7DA8P40AqS2D?= =?us-ascii?Q?99f8LW4UJXhf0KUHPPH4hkQTUnWAiBAelL0xysRot/SuUrKRh+98d76y1Xav?= =?us-ascii?Q?wDKJ1qYriO5bEgW6i7dhZ8qLo+P9JMd5C9zhki+iZNqruGKrcOP406LfEfsc?= =?us-ascii?Q?HT5R/0h0u0ZsP220QnjYGsFEd7FLctJjYhORxC8tZpFywy5VCZ6pCdTa7xLa?= =?us-ascii?Q?lyRu7rqI57eejJR7JljgjvijD0GMMlYY?= 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)(376014)(1800799024)(82310400026)(7416014)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 09:07:15.8766 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2718fa33-3033-44b7-8308-08dcd3d37692 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: CY4PEPF0000EE34.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW6PR12MB8897 Content-Type: text/plain; charset="utf-8" Move SoundWire endpoint parsing helper functions to common place holder. These functions will be used by other platform machine driver code. Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao --- include/sound/soc_sdw_utils.h | 10 ++ sound/soc/intel/boards/sof_sdw.c | 158 --------------------------- sound/soc/sdw_utils/soc_sdw_utils.c | 161 ++++++++++++++++++++++++++++ 3 files changed, 171 insertions(+), 158 deletions(-) diff --git a/include/sound/soc_sdw_utils.h b/include/sound/soc_sdw_utils.h index e3482720a3eb..f68c1f193b3b 100644 --- a/include/sound/soc_sdw_utils.h +++ b/include/sound/soc_sdw_utils.h @@ -161,6 +161,16 @@ int asoc_sdw_init_simple_dai_link(struct device *dev, = struct snd_soc_dai_link *d int (*init)(struct snd_soc_pcm_runtime *rtd), const struct snd_soc_ops *ops); =20 +int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs,= int *num_ends); + +struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *da= ilinks, + const struct snd_soc_acpi_endpoint *new); + +int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, + struct asoc_sdw_dailink *soc_dais, + struct asoc_sdw_endpoint *soc_ends, + int *num_devs); + int asoc_sdw_rtd_init(struct snd_soc_pcm_runtime *rtd); =20 /* DMIC support */ diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_= sdw.c index 6b30659f0e25..5196d96f5c0e 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -619,164 +619,6 @@ static const struct snd_soc_ops sdw_ops =3D { =20 static const char * const type_strings[] =3D {"SimpleJack", "SmartAmp", "S= martMic"}; =20 -static int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *nu= m_devs, int *num_ends) -{ - struct device *dev =3D card->dev; - struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); - struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; - const struct snd_soc_acpi_link_adr *adr_link; - int i; - - for (adr_link =3D mach_params->links; adr_link->num_adr; adr_link++) { - *num_devs +=3D adr_link->num_adr; - - for (i =3D 0; i < adr_link->num_adr; i++) - *num_ends +=3D adr_link->adr_d[i].num_endpoints; - } - - dev_dbg(dev, "Found %d devices with %d endpoints\n", *num_devs, *num_ends= ); - - return 0; -} - -static struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dail= ink *dailinks, - const struct snd_soc_acpi_endpoint *new) -{ - while (dailinks->initialised) { - if (new->aggregated && dailinks->group_id =3D=3D new->group_id) - return dailinks; - - dailinks++; - } - - INIT_LIST_HEAD(&dailinks->endpoints); - dailinks->group_id =3D new->group_id; - dailinks->initialised =3D true; - - return dailinks; -} - -static int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, - struct asoc_sdw_dailink *sof_dais, - struct asoc_sdw_endpoint *sof_ends, - int *num_devs) -{ - struct device *dev =3D card->dev; - struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); - struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); - struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; - const struct snd_soc_acpi_link_adr *adr_link; - struct asoc_sdw_endpoint *sof_end =3D sof_ends; - int num_dais =3D 0; - int i, j; - int ret; - - for (adr_link =3D mach_params->links; adr_link->num_adr; adr_link++) { - int num_link_dailinks =3D 0; - - if (!is_power_of_2(adr_link->mask)) { - dev_err(dev, "link with multiple mask bits: 0x%x\n", - adr_link->mask); - return -EINVAL; - } - - for (i =3D 0; i < adr_link->num_adr; i++) { - const struct snd_soc_acpi_adr_device *adr_dev =3D &adr_link->adr_d[i]; - struct asoc_sdw_codec_info *codec_info; - const char *codec_name; - - if (!adr_dev->name_prefix) { - dev_err(dev, "codec 0x%llx does not have a name prefix\n", - adr_dev->adr); - return -EINVAL; - } - - codec_info =3D asoc_sdw_find_codec_info_part(adr_dev->adr); - if (!codec_info) - return -EINVAL; - - ctx->ignore_internal_dmic |=3D codec_info->ignore_internal_dmic; - - codec_name =3D asoc_sdw_get_codec_name(dev, codec_info, adr_link, i); - if (!codec_name) - return -ENOMEM; - - dev_dbg(dev, "Adding prefix %s for %s\n", - adr_dev->name_prefix, codec_name); - - sof_end->name_prefix =3D adr_dev->name_prefix; - - if (codec_info->count_sidecar && codec_info->add_sidecar) { - ret =3D codec_info->count_sidecar(card, &num_dais, num_devs); - if (ret) - return ret; - - sof_end->include_sidecar =3D true; - } - - for (j =3D 0; j < adr_dev->num_endpoints; j++) { - const struct snd_soc_acpi_endpoint *adr_end; - const struct asoc_sdw_dai_info *dai_info; - struct asoc_sdw_dailink *sof_dai; - int stream; - - adr_end =3D &adr_dev->endpoints[j]; - dai_info =3D &codec_info->dais[adr_end->num]; - sof_dai =3D asoc_sdw_find_dailink(sof_dais, adr_end); - - if (dai_info->quirk && !(dai_info->quirk & sof_sdw_quirk)) - continue; - - dev_dbg(dev, - "Add dev: %d, 0x%llx end: %d, %s, %c/%c to %s: %d\n", - ffs(adr_link->mask) - 1, adr_dev->adr, - adr_end->num, type_strings[dai_info->dai_type], - dai_info->direction[SNDRV_PCM_STREAM_PLAYBACK] ? 'P' : '-', - dai_info->direction[SNDRV_PCM_STREAM_CAPTURE] ? 'C' : '-', - adr_end->aggregated ? "group" : "solo", - adr_end->group_id); - - if (adr_end->num >=3D codec_info->dai_num) { - dev_err(dev, - "%d is too many endpoints for codec: 0x%x\n", - adr_end->num, codec_info->part_id); - return -EINVAL; - } - - for_each_pcm_streams(stream) { - if (dai_info->direction[stream] && - dai_info->dailink[stream] < 0) { - dev_err(dev, - "Invalid dailink id %d for codec: 0x%x\n", - dai_info->dailink[stream], - codec_info->part_id); - return -EINVAL; - } - - if (dai_info->direction[stream]) { - num_dais +=3D !sof_dai->num_devs[stream]; - sof_dai->num_devs[stream]++; - sof_dai->link_mask[stream] |=3D adr_link->mask; - } - } - - num_link_dailinks +=3D !!list_empty(&sof_dai->endpoints); - list_add_tail(&sof_end->list, &sof_dai->endpoints); - - sof_end->link_mask =3D adr_link->mask; - sof_end->codec_name =3D codec_name; - sof_end->codec_info =3D codec_info; - sof_end->dai_info =3D dai_info; - sof_end++; - } - } - - ctx->append_dai_type |=3D (num_link_dailinks > 1); - } - - return num_dais; -} - static int create_sdw_dailink(struct snd_soc_card *card, struct asoc_sdw_dailink *sof_dai, struct snd_soc_dai_link **dai_links, diff --git a/sound/soc/sdw_utils/soc_sdw_utils.c b/sound/soc/sdw_utils/soc_= sdw_utils.c index d59ccb56642c..a6070f822eb9 100644 --- a/sound/soc/sdw_utils/soc_sdw_utils.c +++ b/sound/soc/sdw_utils/soc_sdw_utils.c @@ -1005,5 +1005,166 @@ int asoc_sdw_init_simple_dai_link(struct device *de= v, struct snd_soc_dai_link *d } EXPORT_SYMBOL_NS(asoc_sdw_init_simple_dai_link, SND_SOC_SDW_UTILS); =20 +int asoc_sdw_count_sdw_endpoints(struct snd_soc_card *card, int *num_devs,= int *num_ends) +{ + struct device *dev =3D card->dev; + struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); + struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; + const struct snd_soc_acpi_link_adr *adr_link; + int i; + + for (adr_link =3D mach_params->links; adr_link->num_adr; adr_link++) { + *num_devs +=3D adr_link->num_adr; + + for (i =3D 0; i < adr_link->num_adr; i++) + *num_ends +=3D adr_link->adr_d[i].num_endpoints; + } + + dev_dbg(dev, "Found %d devices with %d endpoints\n", *num_devs, *num_ends= ); + + return 0; +} +EXPORT_SYMBOL_NS(asoc_sdw_count_sdw_endpoints, SND_SOC_SDW_UTILS); + +struct asoc_sdw_dailink *asoc_sdw_find_dailink(struct asoc_sdw_dailink *da= ilinks, + const struct snd_soc_acpi_endpoint *new) +{ + while (dailinks->initialised) { + if (new->aggregated && dailinks->group_id =3D=3D new->group_id) + return dailinks; + + dailinks++; + } + + INIT_LIST_HEAD(&dailinks->endpoints); + dailinks->group_id =3D new->group_id; + dailinks->initialised =3D true; + + return dailinks; +} +EXPORT_SYMBOL_NS(asoc_sdw_find_dailink, SND_SOC_SDW_UTILS); + +int asoc_sdw_parse_sdw_endpoints(struct snd_soc_card *card, + struct asoc_sdw_dailink *soc_dais, + struct asoc_sdw_endpoint *soc_ends, + int *num_devs) +{ + struct device *dev =3D card->dev; + struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); + struct snd_soc_acpi_mach *mach =3D dev_get_platdata(dev); + struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; + const struct snd_soc_acpi_link_adr *adr_link; + struct asoc_sdw_endpoint *soc_end =3D soc_ends; + int num_dais =3D 0; + int i, j; + int ret; + + for (adr_link =3D mach_params->links; adr_link->num_adr; adr_link++) { + int num_link_dailinks =3D 0; + + if (!is_power_of_2(adr_link->mask)) { + dev_err(dev, "link with multiple mask bits: 0x%x\n", + adr_link->mask); + return -EINVAL; + } + + for (i =3D 0; i < adr_link->num_adr; i++) { + const struct snd_soc_acpi_adr_device *adr_dev =3D &adr_link->adr_d[i]; + struct asoc_sdw_codec_info *codec_info; + const char *codec_name; + + if (!adr_dev->name_prefix) { + dev_err(dev, "codec 0x%llx does not have a name prefix\n", + adr_dev->adr); + return -EINVAL; + } + + codec_info =3D asoc_sdw_find_codec_info_part(adr_dev->adr); + if (!codec_info) + return -EINVAL; + + ctx->ignore_internal_dmic |=3D codec_info->ignore_internal_dmic; + + codec_name =3D asoc_sdw_get_codec_name(dev, codec_info, adr_link, i); + if (!codec_name) + return -ENOMEM; + + dev_dbg(dev, "Adding prefix %s for %s\n", + adr_dev->name_prefix, codec_name); + + soc_end->name_prefix =3D adr_dev->name_prefix; + + if (codec_info->count_sidecar && codec_info->add_sidecar) { + ret =3D codec_info->count_sidecar(card, &num_dais, num_devs); + if (ret) + return ret; + + soc_end->include_sidecar =3D true; + } + + for (j =3D 0; j < adr_dev->num_endpoints; j++) { + const struct snd_soc_acpi_endpoint *adr_end; + const struct asoc_sdw_dai_info *dai_info; + struct asoc_sdw_dailink *soc_dai; + int stream; + + adr_end =3D &adr_dev->endpoints[j]; + dai_info =3D &codec_info->dais[adr_end->num]; + soc_dai =3D asoc_sdw_find_dailink(soc_dais, adr_end); + + if (dai_info->quirk && !(dai_info->quirk & ctx->mc_quirk)) + continue; + + dev_dbg(dev, + "Add dev: %d, 0x%llx end: %d, dai: %d, %c/%c to %s: %d\n", + ffs(adr_link->mask) - 1, adr_dev->adr, + adr_end->num, dai_info->dai_type, + dai_info->direction[SNDRV_PCM_STREAM_PLAYBACK] ? 'P' : '-', + dai_info->direction[SNDRV_PCM_STREAM_CAPTURE] ? 'C' : '-', + adr_end->aggregated ? "group" : "solo", + adr_end->group_id); + + if (adr_end->num >=3D codec_info->dai_num) { + dev_err(dev, + "%d is too many endpoints for codec: 0x%x\n", + adr_end->num, codec_info->part_id); + return -EINVAL; + } + + for_each_pcm_streams(stream) { + if (dai_info->direction[stream] && + dai_info->dailink[stream] < 0) { + dev_err(dev, + "Invalid dailink id %d for codec: 0x%x\n", + dai_info->dailink[stream], + codec_info->part_id); + return -EINVAL; + } + + if (dai_info->direction[stream]) { + num_dais +=3D !soc_dai->num_devs[stream]; + soc_dai->num_devs[stream]++; + soc_dai->link_mask[stream] |=3D adr_link->mask; + } + } + + num_link_dailinks +=3D !!list_empty(&soc_dai->endpoints); + list_add_tail(&soc_end->list, &soc_dai->endpoints); + + soc_end->link_mask =3D adr_link->mask; + soc_end->codec_name =3D codec_name; + soc_end->codec_info =3D codec_info; + soc_end->dai_info =3D dai_info; + soc_end++; + } + } + + ctx->append_dai_type |=3D (num_link_dailinks > 1); + } + + return num_dais; +} +EXPORT_SYMBOL_NS(asoc_sdw_parse_sdw_endpoints, SND_SOC_SDW_UTILS); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("SoundWire ASoC helpers"); --=20 2.34.1 From nobody Sat Nov 30 00:57:24 2024 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2074.outbound.protection.outlook.com [40.107.93.74]) (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 39F451D7E4F; Fri, 13 Sep 2024 09:07:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218448; cv=fail; b=HZuLHA8IKgK9bl21LP571jha5vAfNLVQQN5szQo3zmdlipWB4FnKKWqIp7DqEuixSwSnyR4S7Ntc7qLgalGJkdmPkbk7lZoYo+SRjI233BTmeOhTxm2BR0RKkRR+jMg3UYMGiZBg9Vpe04yTrNs8LOqg2oFTfOypDUs8qppRG/Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726218448; c=relaxed/simple; bh=8X0aIkHeooPN2xRbL9E65bAn/BprQbpEzSfFWpcwO6k=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KK2XeacloQ7rEVA6552UU4sIVZwYJlkWH/ZIjeiMTDmpA1kuvdVT8BWcIHJCC5kYiABNtcyHe1KRt41ePfhvxSsSUU2mPIPZT70ZISOcoAekIshMR+fXiZwFuNIJS8pwO1Fnt9xtvItbHjknRmuHh9X8zkV3FVzP0Twbl4xxiz0= 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=UKtCONg5; arc=fail smtp.client-ip=40.107.93.74 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="UKtCONg5" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uKmVwCTCOOaepSd5wEb7krGdOAzai3iKiJ6S1Tr4VwLovJ4kN1CPmeoSiaD9Qj57TZSzMBhyAgWV8Zzpix072QFDYTmqMB4pHsp7zNV6cIm0T6Ga/8bCOPlDOAAdiGvyrnplNwVfSJHLRSRUpnIMmd4OEcUPOrhVbMM51Drc/AFgvSPj7ADWtCgN4siJ8muIWCMPR4VT4e8EBLZzXlkwMIFqc7hblB6fuAH7mmHKp09bpJFFwaYrlzve80hAyYh01RlsjzQCa/rICtjRgbpG852BiqkFSNDHTcoQw+JQfYohqG+Fl233z96dE23K+dHQV6CLkhpU4YBk+Fxzm+P1vw== 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=eg9agBLp2CJDujLSJNf1qgNzRtrS1AFfrWUygIPzwPw=; b=uZDcqRAbCVqwkfGrPgVGRb3VpcqqEzHFcbrFBGoc4Hxt1ozbmEP43eBRKPQXVuJINDFnJ35A1qgfNaiCFDu9Imjez2cCIzFCOS8RIrxTDxTeRaNniYlGafelkXVqo6HW661oeIWZGotc2AZ8Ciq31lbVP5t0amPRfTqyqyZuTbK/XUAUyk4ga/tjaFZ/j9WHe4K9AWzl9r76Itz/znC2nXPdTpChma4muHpLN1ZpLB1WSkDthGHd9Aya4Aj+N3Od5aao6WCs6qPBYoQ3TkIrAEfXWIrpwlcolF1h6MRevJythrsazRNYmRm0N2CQgncHcOMS9FCeoeBhh0mvrajrdA== 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=eg9agBLp2CJDujLSJNf1qgNzRtrS1AFfrWUygIPzwPw=; b=UKtCONg5DqDvdEz4xAVFUs54Kugxyv6ljtb+5mpzlMhrBXYRkRD6gFdUx95Ql2sTRCLiRmw1wE2ifh6i6Er1YJDZZYWJDEBNiV9QWyVAHmTJyxZUL8Z4wFwAL34NYWMVMI3u7KObYE08UhnnjnkJYUtz36I5y9QwF8Bu0wEn5J0= Received: from DS7PR06CA0004.namprd06.prod.outlook.com (2603:10b6:8:2a::19) by MW4PR12MB5625.namprd12.prod.outlook.com (2603:10b6:303:168::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.27; Fri, 13 Sep 2024 09:07:19 +0000 Received: from CY4PEPF0000EE31.namprd05.prod.outlook.com (2603:10b6:8:2a:cafe::d3) by DS7PR06CA0004.outlook.office365.com (2603:10b6:8:2a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.26 via Frontend Transport; Fri, 13 Sep 2024 09:07:19 +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 CY4PEPF0000EE31.mail.protection.outlook.com (10.167.242.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Fri, 13 Sep 2024 09:07:18 +0000 Received: from vijendar-X570-GAMING-X.amd.com (10.180.168.240) 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; Fri, 13 Sep 2024 04:07:11 -0500 From: Vijendar Mukunda To: CC: , , , , , , , , , , , , , , Vijendar Mukunda Subject: [PATCH 5/5] ASoC: amd: acp: refactor SoundWire machine driver code Date: Fri, 13 Sep 2024 14:36:31 +0530 Message-ID: <20240913090631.1834543-6-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> References: <20240913090631.1834543-1-Vijendar.Mukunda@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000EE31:EE_|MW4PR12MB5625:EE_ X-MS-Office365-Filtering-Correlation-Id: aca866b1-3bb0-4d8a-d244-08dcd3d37842 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|7416014|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?r661I9huaQx3zWm49JWMNQdlQawbdcBAEb/++KASe1AQNkUPI6LbkX8RH7Aj?= =?us-ascii?Q?04nKVkd+0SsomI8FLltmeDtnravopJEzPixhOtdbsgLfSjIatGfbgAlv+Lgv?= =?us-ascii?Q?BNMvW4PeyAUPzzN1pyRsKo124bogxqC+hKU34+NXLERJrz3XIThHG9uNBwQi?= =?us-ascii?Q?XUJL4MuXm0L5zjKhJ+52JUZrwx2/Ln1iW6yhXRaF6S83qRYXhjnu/YUbbByn?= =?us-ascii?Q?vj42aBirvLvA3UlviW2QD/pkyo/dThUuHkPS+LkQpPnqw38aCdH/PctV3grd?= =?us-ascii?Q?adeIKFQDBzx1Cz7Y1IrX0BVoJPdx82AAPjZJhiSeVJDGuFbeAL6OGIN6ankw?= =?us-ascii?Q?G1rXCTv5nf8u24oQkUuh/ECcfG7enGwHVwbxs96tnKAtjQy3OwXrPcf4P3aB?= =?us-ascii?Q?pA6T7nsusbVrGO1XCxQvbLQJD2DzJMnn/6EeVk/l72GCLNiy44OZ6EPEAJm0?= =?us-ascii?Q?bRphjFvC/b3oKxMJIx853FS2GLJE+5tCY+vCXXSidiVCtU6sUQkRXL/gAGNb?= =?us-ascii?Q?A2XOXraWHmBoPwUKuCFcbGOBW5CBcCqTHg3Rrqzva3uQ+B7N9CKqQPWiuKCH?= =?us-ascii?Q?IvzxBtJWP2zG0JeH5owBVjGPypi1yyzgnrepktoBocv9p+ZY2b0NTSov5xO0?= =?us-ascii?Q?liZdr4HONRD2az0UU7gQkNso2y47nD0YBntO2781POYMBRqpVS/LPhl7ZCxG?= =?us-ascii?Q?oW74NMWv/P3JPhVBPOP94PXXU/TAxkDwGtzWFnsveDAbCmaAVwBKJX9YAiuI?= =?us-ascii?Q?5AMF4/wwhP36JnSqyysgmM2y/n6cdFyuUpuUJVYjkMr/1KC5q3anRrAhY3e7?= =?us-ascii?Q?3IbkpJT5+q3FwF0m7fn3TuTieUxtaXkGwj1ZVZKvxNHlMI9rUsuBS5VtOHXQ?= =?us-ascii?Q?wkWQ8BqAMLqnHezNscUZIfUNKKLP+NHqZq+Yj/pzd0tIl0REIPdiNByTxIAu?= =?us-ascii?Q?3WSG0bHhjpj5Rsse9Q/Z8+uS19iby32+2SX8Eo3+7FGQzsDUSjcK26BJ0Adb?= =?us-ascii?Q?wcvgJIll2FiFgwKmqjTbOxaUMx2DfPLWGh6CYcBtxLS1KoS1TdaNHknQIJ9m?= =?us-ascii?Q?RwF/oYMHWruZf93UVXf9+rahc8G1HwkcgXDRlj7Jfpl8pmTiYKkC0V6ppHOU?= =?us-ascii?Q?rFTT/7JLFYrUT+N5TbRgsG46ymrgAL4yXiKXPFxNdgmn2FefbLw1tGwfkV/4?= =?us-ascii?Q?zMwlKURl3zET/VQHENGL4CCATPRlClJ+qqnvMktiJtmL+PsLFm44evONVJ4d?= =?us-ascii?Q?EBii22inXRD9F3tY+FacuCo0fe43qy3ogbyq6/Vkobd8Ajxrs63IzvTs3ysF?= =?us-ascii?Q?AwfIF+Sjdk2LhUMeNi9mr+qIAJ3TkQ1dWdtU5KpgSh4qCJgACvVf1arSE6+t?= =?us-ascii?Q?tH+P6O2RbJC3MPWNOooEjHmtBVIRU0SsCjbvGkRKXXbMvS/ukNkj3qgQRaqT?= =?us-ascii?Q?AzremGXZuBxJlV2E0ca1Tb5je2Q6k2hN?= 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)(36860700013)(7416014)(1800799024)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2024 09:07:18.7098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aca866b1-3bb0-4d8a-d244-08dcd3d37842 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: CY4PEPF0000EE31.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5625 Content-Type: text/plain; charset="utf-8" Refactor Soundwire machine driver code by using common SoundWire endpoint parsing helper functions. Signed-off-by: Vijendar Mukunda Reviewed-by: Bard Liao --- sound/soc/amd/acp/acp-sdw-sof-mach.c | 540 ++++++++------------------- 1 file changed, 154 insertions(+), 386 deletions(-) diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-s= dw-sof-mach.c index b1cd173f607d..6c50c8276538 100644 --- a/sound/soc/amd/acp/acp-sdw-sof-mach.c +++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c @@ -64,197 +64,6 @@ static const struct snd_soc_ops sdw_ops =3D { .shutdown =3D asoc_sdw_shutdown, }; =20 -/* - * get BE dailink number and CPU DAI number based on sdw link adr. - * Since some sdw slaves may be aggregated, the CPU DAI number - * may be larger than the number of BE dailinks. - */ -static int get_dailink_info(struct device *dev, - const struct snd_soc_acpi_link_adr *adr_link, - int *sdw_be_num, int *codecs_num) -{ - bool group_visited[AMD_SDW_MAX_GROUPS]; - int i; - int j; - - *sdw_be_num =3D 0; - - if (!adr_link) - return -EINVAL; - - for (i =3D 0; i < AMD_SDW_MAX_GROUPS; i++) - group_visited[i] =3D false; - - for (; adr_link->num_adr; adr_link++) { - const struct snd_soc_acpi_endpoint *endpoint; - struct asoc_sdw_codec_info *codec_info; - int stream; - u64 adr; - - /* make sure the link mask has a single bit set */ - if (!is_power_of_2(adr_link->mask)) - return -EINVAL; - - for (i =3D 0; i < adr_link->num_adr; i++) { - adr =3D adr_link->adr_d[i].adr; - codec_info =3D asoc_sdw_find_codec_info_part(adr); - if (!codec_info) - return -EINVAL; - - *codecs_num +=3D codec_info->dai_num; - - if (!adr_link->adr_d[i].name_prefix) { - dev_err(dev, "codec 0x%llx does not have a name prefix\n", - adr_link->adr_d[i].adr); - return -EINVAL; - } - - endpoint =3D adr_link->adr_d[i].endpoints; - if (endpoint->aggregated && !endpoint->group_id) { - dev_err(dev, "invalid group id on link %x\n", - adr_link->mask); - return -EINVAL; - } - - for (j =3D 0; j < codec_info->dai_num; j++) { - /* count DAI number for playback and capture */ - for_each_pcm_streams(stream) { - if (!codec_info->dais[j].direction[stream]) - continue; - - /* count BE for each non-aggregated slave or group */ - if (!endpoint->aggregated || - !group_visited[endpoint->group_id]) - (*sdw_be_num)++; - } - } - - if (endpoint->aggregated) - group_visited[endpoint->group_id] =3D true; - } - } - return 0; -} - -static int fill_sdw_codec_dlc(struct device *dev, - const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_dai_link_component *codec, - int adr_index, int dai_index) -{ - u64 adr =3D adr_link->adr_d[adr_index].adr; - struct asoc_sdw_codec_info *codec_info; - - codec_info =3D asoc_sdw_find_codec_info_part(adr); - if (!codec_info) - return -EINVAL; - - codec->name =3D asoc_sdw_get_codec_name(dev, codec_info, adr_link, adr_in= dex); - if (!codec->name) - return -ENOMEM; - - codec->dai_name =3D codec_info->dais[dai_index].dai_name; - dev_err(dev, "codec->dai_name:%s\n", codec->dai_name); - return 0; -} - -static int set_codec_init_func(struct snd_soc_card *card, - const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_dai_link *dai_links, - bool playback, int group_id, int adr_index, int dai_index) -{ - int i =3D adr_index; - - do { - /* - * Initialize the codec. If codec is part of an aggregated - * group (group_id>0), initialize all codecs belonging to - * same group. - * The first link should start with adr_link->adr_d[adr_index] - * because that is the device that we want to initialize and - * we should end immediately if it is not aggregated (group_id=3D0) - */ - for ( ; i < adr_link->num_adr; i++) { - struct asoc_sdw_codec_info *codec_info; - - codec_info =3D asoc_sdw_find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; - - /* The group_id is > 0 iff the codec is aggregated */ - if (adr_link->adr_d[i].endpoints->group_id !=3D group_id) - continue; - if (codec_info->dais[dai_index].init) - codec_info->dais[dai_index].init(card, - dai_links, - codec_info, - playback); - - if (!group_id) - return 0; - } - - i =3D 0; - adr_link++; - } while (adr_link->mask); - - return 0; -} - -/* - * check endpoint status in slaves and gather link ID for all slaves in - * the same group to generate different CPU DAI. Now only support - * one sdw link with all slaves set with only single group id. - * - * one slave on one sdw link with aggregated =3D 0 - * one sdw BE DAI <---> one-cpu DAI <---> one-codec DAI - * - * two or more slaves on one sdw link with aggregated =3D 1 - * one sdw BE DAI <---> one-cpu DAI <---> multi-codec DAIs - */ -static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, - struct device *dev, int *cpu_dai_id, int *cpu_dai_num, - int *codec_num, unsigned int *group_id, - int adr_index) -{ - int i; - - if (!adr_link->adr_d[adr_index].endpoints->aggregated) { - cpu_dai_id[0] =3D ffs(adr_link->mask) - 1; - *cpu_dai_num =3D 1; - *codec_num =3D 1; - *group_id =3D 0; - return 0; - } - - *codec_num =3D 0; - *cpu_dai_num =3D 0; - *group_id =3D adr_link->adr_d[adr_index].endpoints->group_id; - - /* Count endpoints with the same group_id in the adr_link */ - for (; adr_link && adr_link->num_adr; adr_link++) { - unsigned int link_codecs =3D 0; - - for (i =3D 0; i < adr_link->num_adr; i++) { - if (adr_link->adr_d[i].endpoints->aggregated && - adr_link->adr_d[i].endpoints->group_id =3D=3D *group_id) - link_codecs++; - } - - if (link_codecs) { - *codec_num +=3D link_codecs; - - if (*cpu_dai_num >=3D ACP63_SDW_MAX_CPU_DAIS) { - dev_err(dev, "cpu_dai_id array overflowed\n"); - return -EINVAL; - } - - cpu_dai_id[(*cpu_dai_num)++] =3D ffs(adr_link->mask) - 1; - } - } - - return 0; -} - static int get_acp63_cpu_pin_id(u32 sdw_link_id, int be_id, int *cpu_pin_i= d, struct device *dev) { switch (sdw_link_id) { @@ -306,116 +115,64 @@ static int get_acp63_cpu_pin_id(u32 sdw_link_id, int= be_id, int *cpu_pin_id, str static const char * const type_strings[] =3D {"SimpleJack", "SmartAmp", "S= martMic"}; =20 static int create_sdw_dailink(struct snd_soc_card *card, + struct asoc_sdw_dailink *sof_dai, struct snd_soc_dai_link **dai_links, - const struct snd_soc_acpi_link_adr *adr_link, - struct snd_soc_codec_conf **codec_conf, - int *be_id, int adr_index, int dai_index) + int *be_id, struct snd_soc_codec_conf **codec_conf) { + struct device *dev =3D card->dev; struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); struct amd_mc_ctx *amd_ctx =3D (struct amd_mc_ctx *)ctx->private; - struct device *dev =3D card->dev; - const struct snd_soc_acpi_link_adr *adr_link_next; - struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps; - struct snd_soc_dai_link_component *codecs; - struct snd_soc_dai_link_component *cpus; - struct asoc_sdw_codec_info *codec_info; - int cpu_dai_id[ACP63_SDW_MAX_CPU_DAIS]; - int cpu_dai_num; - unsigned int group_id; - unsigned int sdw_link_id; - int codec_dlc_index =3D 0; - int codec_num; + struct asoc_sdw_endpoint *sof_end; + int cpu_pin_id; int stream; - int i =3D 0; - int j, k; int ret; - int cpu_pin_id; - - ret =3D get_slave_info(adr_link, dev, cpu_dai_id, &cpu_dai_num, &codec_nu= m, - &group_id, adr_index); - if (ret) - return ret; - codecs =3D devm_kcalloc(dev, codec_num, sizeof(*codecs), GFP_KERNEL); - if (!codecs) - return -ENOMEM; =20 - sdw_codec_ch_maps =3D devm_kcalloc(dev, codec_num, - sizeof(*sdw_codec_ch_maps), GFP_KERNEL); - if (!sdw_codec_ch_maps) - return -ENOMEM; - - /* generate codec name on different links in the same group */ - j =3D adr_index; - for (adr_link_next =3D adr_link; adr_link_next && adr_link_next->num_adr = && - i < cpu_dai_num; adr_link_next++) { - /* skip the link excluded by this processed group */ - if (cpu_dai_id[i] !=3D ffs(adr_link_next->mask) - 1) - continue; - - /* j reset after loop, adr_index only applies to first link */ - for (k =3D 0 ; (j < adr_link_next->num_adr) && (k < codec_num) ; j++, k+= +) { - const struct snd_soc_acpi_endpoint *endpoints; - - endpoints =3D adr_link_next->adr_d[j].endpoints; - if (group_id && (!endpoints->aggregated || - endpoints->group_id !=3D group_id)) - continue; - - /* sanity check */ - if (*codec_conf >=3D card->codec_conf + card->num_configs) { - dev_err(dev, "codec_conf array overflowed\n"); - return -EINVAL; - } + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (sof_end->name_prefix) { + (*codec_conf)->dlc.name =3D sof_end->codec_name; + (*codec_conf)->name_prefix =3D sof_end->name_prefix; + (*codec_conf)++; + } =20 - ret =3D fill_sdw_codec_dlc(dev, adr_link_next, - &codecs[codec_dlc_index], - j, dai_index); + if (sof_end->include_sidecar) { + ret =3D sof_end->codec_info->add_sidecar(card, dai_links, codec_conf); if (ret) return ret; - (*codec_conf)->dlc =3D codecs[codec_dlc_index]; - (*codec_conf)->name_prefix =3D adr_link_next->adr_d[j].name_prefix; - - sdw_codec_ch_maps[codec_dlc_index].cpu =3D i; - sdw_codec_ch_maps[codec_dlc_index].codec =3D codec_dlc_index; - - codec_dlc_index++; - (*codec_conf)++; } - j =3D 0; - - /* check next link to create codec dai in the processed group */ - i++; } =20 - /* find codec info to create BE DAI */ - codec_info =3D asoc_sdw_find_codec_info_part(adr_link->adr_d[adr_index].a= dr); - if (!codec_info) - return -EINVAL; - - ctx->ignore_internal_dmic |=3D codec_info->ignore_internal_dmic; - - sdw_link_id =3D (adr_link->adr_d[adr_index].adr) >> 48; for_each_pcm_streams(stream) { - char *name, *cpu_name; - int playback, capture; static const char * const sdw_stream_name[] =3D { "SDW%d-PIN%d-PLAYBACK", "SDW%d-PIN%d-CAPTURE", "SDW%d-PIN%d-PLAYBACK-%s", "SDW%d-PIN%d-CAPTURE-%s", }; + struct snd_soc_dai_link_ch_map *codec_maps; + struct snd_soc_dai_link_component *codecs; + struct snd_soc_dai_link_component *cpus; + int num_cpus =3D hweight32(sof_dai->link_mask[stream]); + int num_codecs =3D sof_dai->num_devs[stream]; + int playback, capture; + int i =3D 0, j =3D 0; + char *name; =20 - if (!codec_info->dais[dai_index].direction[stream]) + if (!sof_dai->num_devs[stream]) continue; =20 - *be_id =3D codec_info->dais[dai_index].dailink[stream]; + sof_end =3D list_first_entry(&sof_dai->endpoints, + struct asoc_sdw_endpoint, list); + + *be_id =3D sof_end->dai_info->dailink[stream]; if (*be_id < 0) { dev_err(dev, "Invalid dailink id %d\n", *be_id); return -EINVAL; } + switch (amd_ctx->acp_rev) { case ACP63_PCI_REV: - ret =3D get_acp63_cpu_pin_id(sdw_link_id, *be_id, &cpu_pin_id, dev); + ret =3D get_acp63_cpu_pin_id(ffs(sof_end->link_mask - 1), + *be_id, &cpu_pin_id, dev); if (ret) return ret; break; @@ -425,55 +182,105 @@ static int create_sdw_dailink(struct snd_soc_card *c= ard, /* create stream name according to first link id */ if (ctx->append_dai_type) { name =3D devm_kasprintf(dev, GFP_KERNEL, - sdw_stream_name[stream + 2], sdw_link_id, cpu_pin_id, - type_strings[codec_info->dais[dai_index].dai_type]); + sdw_stream_name[stream + 2], + ffs(sof_end->link_mask) - 1, + cpu_pin_id, + type_strings[sof_end->dai_info->dai_type]); } else { name =3D devm_kasprintf(dev, GFP_KERNEL, - sdw_stream_name[stream], sdw_link_id, cpu_pin_id); + sdw_stream_name[stream], + ffs(sof_end->link_mask) - 1, + cpu_pin_id); } if (!name) return -ENOMEM; =20 - cpus =3D devm_kcalloc(dev, cpu_dai_num, sizeof(*cpus), GFP_KERNEL); + cpus =3D devm_kcalloc(dev, num_cpus, sizeof(*cpus), GFP_KERNEL); if (!cpus) return -ENOMEM; - /* - * generate CPU DAI name base on the sdw link ID and - * cpu pin id according to sdw dai driver. - */ - for (k =3D 0; k < cpu_dai_num; k++) { - cpu_name =3D devm_kasprintf(dev, GFP_KERNEL, - "SDW%d Pin%d", sdw_link_id, cpu_pin_id); - if (!cpu_name) + + codecs =3D devm_kcalloc(dev, num_codecs, sizeof(*codecs), GFP_KERNEL); + if (!codecs) + return -ENOMEM; + + codec_maps =3D devm_kcalloc(dev, num_codecs, sizeof(*codec_maps), GFP_KE= RNEL); + if (!codec_maps) + return -ENOMEM; + + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (!sof_end->dai_info->direction[stream]) + continue; + + int link_num =3D ffs(sof_end->link_mask) - 1; + + cpus[i].dai_name =3D devm_kasprintf(dev, GFP_KERNEL, + "SDW%d Pin%d", + link_num, cpu_pin_id); + dev_dbg(dev, "cpu[%d].dai_name:%s\n", i, cpus[i].dai_name); + if (!cpus[i].dai_name) return -ENOMEM; =20 - cpus[k].dai_name =3D cpu_name; + codec_maps[j].cpu =3D i; + codec_maps[j].codec =3D j; + + codecs[j].name =3D sof_end->codec_name; + codecs[j].dai_name =3D sof_end->dai_info->dai_name; + j++; } =20 + WARN_ON(j !=3D num_codecs); + playback =3D (stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK); capture =3D (stream =3D=3D SNDRV_PCM_STREAM_CAPTURE); - asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, - playback, capture, - cpus, cpu_dai_num, - platform_component, ARRAY_SIZE(platform_component), - codecs, codec_num, + + asoc_sdw_init_dai_link(dev, *dai_links, be_id, name, playback, capture, + cpus, num_cpus, platform_component, + ARRAY_SIZE(platform_component), codecs, num_codecs, asoc_sdw_rtd_init, &sdw_ops); + /* * SoundWire DAILINKs use 'stream' functions and Bank Switch operations * based on wait_for_completion(), tag them as 'nonatomic'. */ (*dai_links)->nonatomic =3D true; - (*dai_links)->ch_maps =3D sdw_codec_ch_maps; + (*dai_links)->ch_maps =3D codec_maps; =20 - ret =3D set_codec_init_func(card, adr_link, *dai_links, - playback, group_id, adr_index, dai_index); - if (ret < 0) { - dev_err(dev, "failed to init codec 0x%x\n", codec_info->part_id); - return ret; + list_for_each_entry(sof_end, &sof_dai->endpoints, list) { + if (sof_end->dai_info->init) + sof_end->dai_info->init(card, *dai_links, + sof_end->codec_info, + playback); } =20 (*dai_links)++; } + + return 0; +} + +static int create_sdw_dailinks(struct snd_soc_card *card, + struct snd_soc_dai_link **dai_links, int *be_id, + struct asoc_sdw_dailink *sof_dais, + struct snd_soc_codec_conf **codec_conf) +{ + int ret; + + /* generate DAI links by each sdw link */ + while (sof_dais->initialised) { + int current_be_id; + + ret =3D create_sdw_dailink(card, sof_dais, dai_links, + ¤t_be_id, codec_conf); + if (ret) + return ret; + + /* Update the be_id to match the highest ID used for SDW link */ + if (*be_id < current_be_id) + *be_id =3D current_be_id; + + sof_dais++; + } + return 0; } =20 @@ -504,132 +311,93 @@ static int sof_card_dai_links_create(struct snd_soc_= card *card) int sdw_be_num =3D 0, dmic_num =3D 0; struct asoc_sdw_mc_private *ctx =3D snd_soc_card_get_drvdata(card); struct snd_soc_acpi_mach_params *mach_params =3D &mach->mach_params; - const struct snd_soc_acpi_link_adr *adr_link =3D mach_params->links; struct snd_soc_codec_conf *codec_conf; - int codec_conf_num =3D 0; - bool group_generated[AMD_SDW_MAX_GROUPS] =3D { }; + struct asoc_sdw_endpoint *sof_ends; + struct asoc_sdw_dailink *sof_dais; struct snd_soc_dai_link *dai_links; - struct asoc_sdw_codec_info *codec_info; + int num_devs =3D 0; + int num_ends =3D 0; int num_links; - int i, j, be_id =3D 0; + int be_id =3D 0; int ret; =20 - ret =3D get_dailink_info(dev, adr_link, &sdw_be_num, &codec_conf_num); + ret =3D asoc_sdw_count_sdw_endpoints(card, &num_devs, &num_ends); if (ret < 0) { - dev_err(dev, "failed to get sdw link info %d\n", ret); + dev_err(dev, "failed to count devices/endpoints: %d\n", ret); return ret; } =20 + /* One per DAI link, worst case is a DAI link for every endpoint */ + sof_dais =3D kcalloc(num_ends, sizeof(*sof_dais), GFP_KERNEL); + if (!sof_dais) + return -ENOMEM; + + /* One per endpoint, ie. each DAI on each codec/amp */ + sof_ends =3D kcalloc(num_ends, sizeof(*sof_ends), GFP_KERNEL); + if (!sof_ends) { + ret =3D -ENOMEM; + goto err_dai; + } + + ret =3D asoc_sdw_parse_sdw_endpoints(card, sof_dais, sof_ends, &num_devs); + if (ret < 0) + goto err_end; + + sdw_be_num =3D ret; + /* enable dmic */ if (sof_sdw_quirk & ASOC_SDW_ACP_DMIC || mach_params->dmic_num) dmic_num =3D 1; =20 dev_dbg(dev, "sdw %d, dmic %d", sdw_be_num, dmic_num); =20 + codec_conf =3D devm_kcalloc(dev, num_devs, sizeof(*codec_conf), GFP_KERNE= L); + if (!codec_conf) { + ret =3D -ENOMEM; + goto err_end; + } + /* allocate BE dailinks */ num_links =3D sdw_be_num + dmic_num; dai_links =3D devm_kcalloc(dev, num_links, sizeof(*dai_links), GFP_KERNEL= ); - if (!dai_links) - return -ENOMEM; - - /* allocate codec conf, will be populated when dailinks are created */ - codec_conf =3D devm_kcalloc(dev, codec_conf_num, sizeof(*codec_conf), - GFP_KERNEL); - if (!codec_conf) - return -ENOMEM; + if (!dai_links) { + ret =3D -ENOMEM; + goto err_end; + } =20 + card->codec_conf =3D codec_conf; + card->num_configs =3D num_devs; card->dai_link =3D dai_links; card->num_links =3D num_links; - card->codec_conf =3D codec_conf; - card->num_configs =3D codec_conf_num; =20 /* SDW */ - if (!sdw_be_num) - goto DMIC; - - for (; adr_link->num_adr; adr_link++) { - /* - * If there are two or more different devices on the same sdw link, we h= ave to - * append the codec type to the dai link name to prevent duplicated dai = link name. - * The same type devices on the same sdw link will be in the same - * snd_soc_acpi_adr_device array. They won't be described in different a= dr_links. - */ - for (i =3D 0; i < adr_link->num_adr; i++) { - /* find codec info to get dai_num */ - codec_info =3D asoc_sdw_find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; - if (codec_info->dai_num > 1) { - ctx->append_dai_type =3D true; - goto out; - } - for (j =3D 0; j < i; j++) { - if ((SDW_PART_ID(adr_link->adr_d[i].adr) !=3D - SDW_PART_ID(adr_link->adr_d[j].adr)) || - (SDW_MFG_ID(adr_link->adr_d[i].adr) !=3D - SDW_MFG_ID(adr_link->adr_d[j].adr))) { - ctx->append_dai_type =3D true; - goto out; - } - } - } - } -out: - - /* generate DAI links by each sdw link */ - for (adr_link =3D mach_params->links ; adr_link->num_adr; adr_link++) { - for (i =3D 0; i < adr_link->num_adr; i++) { - const struct snd_soc_acpi_endpoint *endpoint; - - endpoint =3D adr_link->adr_d[i].endpoints; - - /* this group has been generated */ - if (endpoint->aggregated && - group_generated[endpoint->group_id]) - continue; - - /* find codec info to get dai_num */ - codec_info =3D asoc_sdw_find_codec_info_part(adr_link->adr_d[i].adr); - if (!codec_info) - return -EINVAL; - - for (j =3D 0; j < codec_info->dai_num ; j++) { - int current_be_id; - - ret =3D create_sdw_dailink(card, &dai_links, adr_link, - &codec_conf, ¤t_be_id, - i, j); - if (ret < 0) { - dev_err(dev, - "failed to create dai link %d on 0x%x\n", - j, codec_info->part_id); - return ret; - } - /* Update the be_id to match the highest ID used for SDW link */ - if (be_id < current_be_id) - be_id =3D current_be_id; - } - - if (endpoint->aggregated) - group_generated[endpoint->group_id] =3D true; - } + if (sdw_be_num) { + ret =3D create_sdw_dailinks(card, &dai_links, &be_id, + sof_dais, &codec_conf); + if (ret) + goto err_end; } =20 -DMIC: /* dmic */ if (dmic_num > 0) { if (ctx->ignore_internal_dmic) { dev_warn(dev, "Ignoring ACP DMIC\n"); } else { - be_id =3D SOC_SDW_DMIC_DAI_ID; ret =3D create_dmic_dailinks(card, &dai_links, &be_id); if (ret) - return ret; + goto err_end; } } =20 + WARN_ON(codec_conf !=3D card->codec_conf + card->num_configs); WARN_ON(dai_links !=3D card->dai_link + card->num_links); - return 0; + +err_end: + kfree(sof_ends); +err_dai: + kfree(sof_dais); + + return ret; } =20 /* SoC card */ --=20 2.34.1