From nobody Sat Feb 7 15:12:03 2026 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 8758D426696; Wed, 21 Jan 2026 13:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.149.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001776; cv=fail; b=SQvLhVYcgNoJyt4Ab4OVq2gsnsJctOEReq8VW5FLhIpC70F82C2tiU5ZcJXs+SzkNN0mIcZzsbQebHKIDmzWLSd/mRzcQ6VRZz61jlLTb/hz0A4b0BirfdDjJSJ2XWXbvW9n8s/2lMm0JZMP7fLT5Dq/MMVNkxgE2D48psH98o8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001776; c=relaxed/simple; bh=xLPzHvtZzc34zr1dsBe4OrCQPHIxr68D/Gexvk/8HjU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nw8rbLp46nS5JYyg6wFu9T6y7O/OszlacUZE6zLxAJyHdUg9R5zziuRtXV7xNP6f+yu7uekYILAGA6OUaZfPRJ+baSM0atdgw2EjmvjTVIP5VxFvqtDCGQWp1XV+NTgeZKDvE/fr8myzpBowT/B3i4E4IhXvvcEXxxFdJc0pLCM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=l7/7GQ/H; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=dO+cwr39; arc=fail smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="l7/7GQ/H"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="dO+cwr39" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60KHsKBL1381583; Wed, 21 Jan 2026 07:22:51 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=dR/gZcvVkbzM18o6MnxcJhUN6s3AILbVoWibyUy8G5M=; b= l7/7GQ/H+cmerlNCDHgWgA7bWaVPtdLY8O/DYdPeuDhwStLDKxdJfDi5sV7LP3OQ AXXLvEbQD2n6JyGklSNflG2fMlv8BrGu/ZxCKukHR/AzBrwD9QMUT1vm3v3y88j9 5NfFGejDUVKDiLBkT3vZm2GmTnaxy4iS3ADeZQtGImx1JhAwydnj84J9aLxdOVWZ 73sblUusFdS+vZ6v259Rq6ueoHOt59tTETmzWWxdhhR2QcHet1lBh7juObdrEkUZ 3o+u+Z93VrhIvBQ+asDm8z/DGU5xWw0xCuXTbDAik+jBL1Uufa6AcDypuHR/UTxn 4iD4/9puHeactuQHcrkkDQ== Received: from sj2pr03cu001.outbound.protection.outlook.com (mail-westusazon11022097.outbound.protection.outlook.com [52.101.43.97]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 4br8q1vnxw-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jan 2026 07:22:51 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=meBfTNGdkGasl2J/sPd9DbIXvoc8mkmcYUrjNvNYNd4fEBUIAhxhzwbtlarTIOXzWC66DyAG/LP5B1MRcO/C/r1q9EBo5/4dNJ4xhmU7fxfCQiwDTUtKCztaYh6qdlyOPxOOfb8KoLEJaTH177Q9pWLrGhz5Xd72AtsdtCpM4An5ErX8jw0NKnZ9pN8vOOLw+sTKz2bksN1pl8OkjGsPOuSAoSf3rV5aeZy4E4zJBrDsiqUiZlc9HDathOWjbAv4qeHvh3M6dhqK0bIiorREYL3DCKkruHbxVMSLG5vJQKDHwJIsrrVVspAKa6dSgYDXSYEOPnPAis3Vx16MJy2u4Q== 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=dR/gZcvVkbzM18o6MnxcJhUN6s3AILbVoWibyUy8G5M=; b=X2HJ3zaYJuuxkW+/4oLeAjccoD41aXMY5u3sm3bDKNgCmCBO4/Hmw5Mjp0ccH0Q6ILZS6pA7a8BV5YZEPRQSBlk4YKxtAfQZ1d08QL+6lps3ohXyNpFVIZaznspPJpKqO3jtALteIWv9OMb5NOGtFDWH+r0ltVaWgIvqnNC9PQe6yPmB2jsKfK+vomaisMg8c7IQ8ccX7JhWW5f9QslouD3M6o69FqeSiZcI9nli1mNOIUBv5X488yC0zhcOn+d8qWdgkV1x8xoOks9Ppfqki2kb4M26Ar7iu6OFhLczGTIa8SnYYN30540YNhjv5YT6TQFC/i9OAnfaHO1TjenjYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 84.19.233.75) smtp.rcpttodomain=cirrus.com smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=opensource.cirrus.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dR/gZcvVkbzM18o6MnxcJhUN6s3AILbVoWibyUy8G5M=; b=dO+cwr39TeWMKLlU3LaEQj901n748LES6lULNWOyYBvUr0xOleyCYl+v5hdE2rCAlqHKl/YEnEji2EKi+Wf7yJ1BfYwTuFO1yEJqri+bzaci0zSmYEVgyKXVMPGj0YkKgNBMk5SekdxIRpXwYV+I27kMh+5AdYssEizCNedryl4= Received: from CH0PR03CA0226.namprd03.prod.outlook.com (2603:10b6:610:e7::21) by IA1PR19MB7181.namprd19.prod.outlook.com (2603:10b6:208:41b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 13:22:46 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:e7:cafe::a8) by CH0PR03CA0226.outlook.office365.com (2603:10b6:610:e7::21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.10 via Frontend Transport; Wed, 21 Jan 2026 13:22:45 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75) smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com does not designate 84.19.233.75 as permitted sender) receiver=protection.outlook.com; client-ip=84.19.233.75; helo=edirelay1.ad.cirrus.com; Received: from edirelay1.ad.cirrus.com (84.19.233.75) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.4 via Frontend Transport; Wed, 21 Jan 2026 13:22:44 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id CC01D406541; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.24]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id B9C7082024A; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) From: Richard Fitzgerald To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 1/5] ASoC: cs-amp-lib: Support Dell SSIDExV2 UEFI variable Date: Wed, 21 Jan 2026 13:22:39 +0000 Message-ID: <20260121132243.1256019-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121132243.1256019-1-rf@opensource.cirrus.com> References: <20260121132243.1256019-1-rf@opensource.cirrus.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-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|IA1PR19MB7181:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fd59b13-9f3a-47af-ed2b-08de58f029f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|61400799027|376014|82310400026|36860700013|54012099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FpU9+fXtJ1KHV/hSH8v1gQL2HJCLEn/42KIumcd0lkZ0HOxsbij5BquaZYAz?= =?us-ascii?Q?F+rBvgn+oPgROZlE7DK6N7OowznrSt8kT5+LzjgcfAVBOyy79bZLGETvXwK0?= =?us-ascii?Q?Xwkqd0nS9cgO//KjF64CjIgyKr1XC/tYZfX1S17TMkSNS8pE6zGW6XAUgjbT?= =?us-ascii?Q?DK72OfDDYpl7JoYFGkenzE57TpbwNlF0PZNt8NCkGvxAPmQFDoKGlcawbb/a?= =?us-ascii?Q?joIv8EM5rp5nts3y+lQaXWJspR0eo345xYULHnoXIo2SPORiv7ApWVn+kt59?= =?us-ascii?Q?sm3JjpysyQ8D/ObqBzCn0FP6hvYhaRjP3yLl5pGlLmNgoEe9aUULR2c89W7S?= =?us-ascii?Q?7RvTVE5McrfU5MG3xCsNX8hnWe7FaRj+SUIUC2yZaj7/z1Ml/ABqxQKWSD8o?= =?us-ascii?Q?Or4hpaexMk9o9i4w9TCD4LkE9m1c8b5npjwkfm3S7JCr8CG2/bXHIgKWSLco?= =?us-ascii?Q?bqMEAaXcxf6KvEOKD4rg2F9fzBUMuXyTAL55YMNOh+Fxt4x+RfYgcwVOzwWA?= =?us-ascii?Q?vowf/9YL/3/wOuyZTNwI8Ziw0U0uTmA1dWJpCVhxYo85HWNFrEFb+jrI99CT?= =?us-ascii?Q?OsTOy1ebrhRiP6yXZfW59fJq/bmMy/E4D9hj612ich/gQIH3JpfAEyJ/4QDZ?= =?us-ascii?Q?6RXZG8htDhKrU6F9KjGN+6tuS9n/cL/6iY2xQxHmoM3cs1Em4bFPpJGenw8Z?= =?us-ascii?Q?tWgnHGhf8BEDJnw1qEnTlsAqvEbGgFIrz2EjdKPVj5AgvwiOMHF/G88dAlor?= =?us-ascii?Q?OJ6I+H48Sos3AN9xtXDqASwLrGZ9pQl8iCHB8qbvLBDqFKKoDNoAWp0Vd8+o?= =?us-ascii?Q?CXN3kDctc5eooDrSyf3yF8tYqJH/9R8hvLMpg5CK4WmX/ip1/k8jKexlqHZW?= =?us-ascii?Q?fMS5R9zvpSG3Xn4Bgyol/UVWfW9A8XZxEgC9VORxdb966mVEYJOHyUxK8vE8?= =?us-ascii?Q?YoQgNmGYS9LrKwtM6IDTrLrQZD4kVtwoNfNOLwFxoz3OH/wgGLomsHC2uZnj?= =?us-ascii?Q?0O075XfKIw/FPL81lv6YGqHB/cqMEyP9esa8QDjzKXK8xeBwL3FpsLkXlng3?= =?us-ascii?Q?iPNBzCYPlXu07abM2nVA1PUez5amTKUtWNqlo8hKPFniB44RpWyVhqxqdYGe?= =?us-ascii?Q?o/RrESaEqxOeZ7+8hV093d026w+rcjV0qLkpmAr+CfqTIq2S2MFhxmju2hn0?= =?us-ascii?Q?R4WQ2sVe3s11IaUCHyM8p2MuXmkhQxusHYoXs+cC8dDcm0O3Ufbycs332ZTC?= =?us-ascii?Q?MwGRJr32sJIrGjr0Ltu4CBk31bTuvQj4ldFuejfLfHEsVyBmXkAUibAwD/Vg?= =?us-ascii?Q?1e58zrUl8OdWe/9gVF2CXQGZYlmjKKKWJZ1Ue1WXd+wUB+SOWahYKO7G5m9G?= =?us-ascii?Q?6r8/I2iKHAi/GJJZWGyPO4Zrz/QCIC0V/pLgJaocZP2D/WLYLP2JTTL8De4V?= =?us-ascii?Q?EZK1iRr6t655114711aRyIzLvOhyvz5d8H0zBcQ7YJV9jC0t7Gb9IfpI5aUI?= =?us-ascii?Q?cNyD0HqPpC5TWhw/Rje4mdRQhVPKcPZv3+tiTzI88wyMY/6RKnCTjfhL1ZIx?= =?us-ascii?Q?BsIenetpIODPvrB5u7VqTqQCV7hAjUnKyHZONbijPZy7AbM7IL+nXZW+CiZs?= =?us-ascii?Q?zMVe9WrkK5nGF9j2/7EK5rcCHBuPupbELS0p1aLxHrrg/qRHA21DC8gRScJi?= =?us-ascii?Q?fAUVGQ=3D=3D?= X-Forefront-Antispam-Report: CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(61400799027)(376014)(82310400026)(36860700013)(54012099003);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2026 13:22:44.9630 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd59b13-9f3a-47af-ed2b-08de58f029f2 X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB7181 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDExMiBTYWx0ZWRfXysMzRAcd7+HN o8+j7DNqBOyDOdcQw0Jhkt/TICJV+7W31eW7TTM9PhfKzv3d2DC/SukdXThVqxyDdEXIoTSvi34 9kSb9n+TSaIvLzzuIB9nowns09Ky479bSulZRnspFFvqu60PktIKNuwNWIDGh9f/jAT1/rEBTnZ ie6mTxhOSWC+CHKN1LFzp60lKJxSiJdqAdQgvJTrUycxri+3g1/vIoO6b/oo21OAYUxM+VJE9Ng lpJ344crrIq3pq1pRRJMOEJzpcJ1lHgTGC6cTbz3/Mw/K2xAXkKZltIlL/qPKIBGjulda8z0+UC 6rwAkN2B+rBoErBkEexSr23nvJu6RDMVPcPs2Mpniy9UH9X4AfZ+OisnkBRqib+GuHaQOSVhSaf xxB9Qs+87ona/ytv/juhUqhptNZ1ouFle9/I065WpCnC9uxv+89Jt5Eu5KF/Uf0N6DUbS88TRJ0 RW56V01onQmsSVHC4sg== X-Proofpoint-GUID: T5mySIv2dbVDvKY44Ryth5lT3RuTmsmd X-Proofpoint-ORIG-GUID: T5mySIv2dbVDvKY44Ryth5lT3RuTmsmd X-Authority-Analysis: v=2.4 cv=JbmxbEKV c=1 sm=1 tr=0 ts=6970d32b cx=c_pps a=V6sUqnxsgDMRanywjcdTsw==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=vUbySO9Y5rIA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=VkNPw1HP01LnGYTKEx00:22 a=w1d2syhTAAAA:8 a=Ki9jH1-v6WY7DfSfT3IA:9 X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add a function cs_amp_devm_get_vendor_specific_variant_id() to return a vendor-specific hardware identifier string (if there is one) and use it to fetch an identifier from Dell SSIDExV2 UEFI variable content. Dell use the same PCI SSID on multiple products that might have different audio hardware and thus need different firmware for the amplifier DSP. The SSIDExV2 string contains additional system identifiers, and the second field is a 2-character audio hardware identifier. There are older Dell models with Cirrus Logic amplifiers that have the SSIDExV2 UEFI variable but do not have the 2-character audio ID in the second field. The SSIDExV2 is ignored if the second field is not 2 characters. Signed-off-by: Richard Fitzgerald --- include/sound/cs-amp-lib.h | 3 + sound/soc/codecs/cs-amp-lib.c | 111 ++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/include/sound/cs-amp-lib.h b/include/sound/cs-amp-lib.h index 61e00017c9aa..e9aa86d76049 100644 --- a/include/sound/cs-amp-lib.h +++ b/include/sound/cs-amp-lib.h @@ -58,6 +58,9 @@ int cs_amp_get_efi_calibration_data(struct device *dev, u= 64 target_uid, int amp_ int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int= num_amps, const struct cirrus_amp_cal_data *in_data); int cs_amp_get_vendor_spkid(struct device *dev); +const char *cs_amp_devm_get_vendor_specific_variant_id(struct device *dev, + int ssid_vendor, + int ssid_device); struct dentry *cs_amp_create_debugfs(struct device *dev); =20 static inline u64 cs_amp_cal_target_u64(const struct cirrus_amp_cal_data *= data) diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index b4d183e7501d..9f8c99dfb798 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,10 @@ #define HP_CALIBRATION_EFI_GUID \ EFI_GUID(0x53559579, 0x8753, 0x4f5c, 0x91, 0x30, 0xe8, 0x2a, 0xcf, 0xb8, = 0xd8, 0x93) =20 +#define DELL_SSIDEXV2_EFI_NAME L"SSIDexV2Data" +#define DELL_SSIDEXV2_EFI_GUID \ + EFI_GUID(0x6a5f35df, 0x1432, 0x4656, 0x85, 0x97, 0x31, 0x04, 0xd5, 0xbf, = 0x3a, 0xb0) + static const struct cs_amp_lib_cal_efivar { efi_char16_t *name; efi_guid_t *guid; @@ -304,6 +309,29 @@ static int cs_amp_convert_efi_status(efi_status_t stat= us) } } =20 +static void *cs_amp_alloc_get_efi_variable(efi_char16_t *name, + efi_guid_t *guid, + u32 *returned_attr) +{ + efi_status_t status; + unsigned long size =3D 0; + + status =3D cs_amp_get_efi_variable(name, guid, NULL, &size, NULL); + if (status !=3D EFI_BUFFER_TOO_SMALL) + return ERR_PTR(cs_amp_convert_efi_status(status)); + + /* Over-alloc to ensure strings are always NUL-terminated */ + void *buf __free(kfree) =3D kzalloc(size + 1, GFP_KERNEL); + if (!buf) + return ERR_PTR(-ENOMEM); + + status =3D cs_amp_get_efi_variable(name, guid, returned_attr, &size, buf); + if (status !=3D EFI_SUCCESS) + return ERR_PTR(cs_amp_convert_efi_status(status)); + + return_ptr(buf); +} + static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device= *dev, efi_char16_t **name, efi_guid_t **guid, @@ -705,6 +733,89 @@ int cs_amp_get_vendor_spkid(struct device *dev) } EXPORT_SYMBOL_NS_GPL(cs_amp_get_vendor_spkid, "SND_SOC_CS_AMP_LIB"); =20 +static const char *cs_amp_devm_get_dell_ssidex(struct device *dev, + int ssid_vendor, int ssid_device) +{ + unsigned int hex_prefix; + char audio_id[4]; + char delim; + char *p; + int ret; + + if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE) && + !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) + return ERR_PTR(-ENOENT); + + char *ssidex_buf __free(kfree) =3D cs_amp_alloc_get_efi_variable(DELL_SSI= DEXV2_EFI_NAME, + &DELL_SSIDEXV2_EFI_GUID, + NULL); + ret =3D PTR_ERR_OR_ZERO(ssidex_buf); + if (ret =3D=3D -ENOENT) + return ERR_PTR(-ENOENT); + else if (ret < 0) + return ssidex_buf; + + /* + * SSIDExV2 string is a series of underscore delimited fields. + * First field is all or part of the SSID. Second field should be + * a 2-character audio hardware id, followed by other identifiers. + * Older models did not have the 2-character audio id, so reject + * the string if the second field is not 2 characters. + */ + ret =3D sscanf(ssidex_buf, "%8x_%2s%c", &hex_prefix, audio_id, &delim); + if (ret < 2) + return ERR_PTR(-ENOENT); + + if ((ret =3D=3D 3) && (delim !=3D '_')) + return ERR_PTR(-ENOENT); + + if (strlen(audio_id) !=3D 2) + return ERR_PTR(-ENOENT); + + p =3D devm_kstrdup(dev, audio_id, GFP_KERNEL); + if (!p) + return ERR_PTR(-ENOMEM); + + return p; +} + +/** + * cs_amp_devm_get_vendor_specific_variant_id - get variant ID string + * @dev: pointer to struct device + * @ssid_vendor: PCI Subsystem Vendor (-1 if unknown) + * @ssid_device: PCI Subsystem Device (-1 if unknown) + * + * Known vendor-specific hardware identifiers are checked and if one is + * found its content is returned as a NUL-terminated string. The returned + * string is devm-managed. + * + * The returned string is not guaranteed to be globally unique. + * Generally it should be combined with some other qualifier, such as + * PCI SSID, to create a globally unique ID. + * + * If the caller has a PCI SSID it should pass it in @ssid_vendor and + * @ssid_device. If the vendor-spefic ID contains this SSID it will be + * stripped from the returned string to prevent duplication. + * + * If the caller does not have a PCI SSID, pass -1 for @ssid_vendor and + * @ssid_device. + * + * Return: + * * a pointer to a devm-managed string + * * ERR_PTR(-ENOENT) if no vendor-specific qualifier + * * ERR_PTR error value + */ +const char *cs_amp_devm_get_vendor_specific_variant_id(struct device *dev, + int ssid_vendor, + int ssid_device) +{ + if ((ssid_vendor =3D=3D PCI_VENDOR_ID_DELL) || (ssid_vendor < 0)) + return cs_amp_devm_get_dell_ssidex(dev, ssid_vendor, ssid_device); + + return ERR_PTR(-ENOENT); +} +EXPORT_SYMBOL_NS_GPL(cs_amp_devm_get_vendor_specific_variant_id, "SND_SOC_= CS_AMP_LIB"); + /** * cs_amp_create_debugfs - create a debugfs directory for a device * --=20 2.47.3 From nobody Sat Feb 7 15:12:03 2026 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 5A96748C8B7; Wed, 21 Jan 2026 13:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.152.168 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001779; cv=fail; b=kvZnSgHtqVr2NXT1LyuMY9M9pCQZtfkx8Hb366iC2SQoKtQnAzCcV87rgiGOaNzcD6ELmjUZBG2f5Dw2drHSHejiiJEwKQCT657xRyq5xe01chLcw1SbH545DogxWYPLx79WzIDFZHHpV+QqqgFMU8z+9KuItPKlfB+iWEPys7U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001779; c=relaxed/simple; bh=HMN7+a3+3IJCnZgHyrA9jy1qoj3rsKW38HPiu0HHqiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SASQu1uDr/BzK6B1GDmCboHf6U2x/APAj8fFL73KP9sx/Vzz6xSYGzQt9em0zwlER2UIVS4JhksJSZCwhaSpS9hFc3hVJlW+IXbLYu3rvvUGVVCU02dWzmfw32lMQmb36Ht66Oo/fOHZqA+LXZBmKHgiodMWq8O3fcegILvd4yI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=A0/gE/kX; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=PhqveQP0; arc=fail smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="A0/gE/kX"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="PhqveQP0" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60L0mqFd3498261; Wed, 21 Jan 2026 07:22:54 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=bpZY5PW4oOjD91JkZrXHJgFJYyZcKO6Ege5giL5sGyc=; b= A0/gE/kX2x/jBu/jQtP4BF9gkI3UlaqerNtulzOMqYZgbpAt0+QjbQgB6U2i1ZRA 4Hm8GpwgOBfjupp1SReOd5lpugJ3mcBpyEiuD1brigVvNukrqCMUIQS/WvEijLuo LtMPyP9KQNX2LHPYw+yFiphCz5LKEIYNSWg6MAydQCWuPqN/qMyILvq3qequ+67G vKklsItQC2HbquCSzy0Z7HRZAZdoCr+ODnfPdmCyqrAnk7Do4jn9UEbng3yPxthO +IoOdYcP7B4Swu8ltcgedqyt5YhuMQIPgCRNG/yez5m0I8wS20wfqDhhgYfK0wDC g8AX2AflXc0k77tmz2kKJw== Received: from sj2pr03cu001.outbound.protection.outlook.com (mail-westusazon11022112.outbound.protection.outlook.com [52.101.43.112]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 4br7qjvtac-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jan 2026 07:22:54 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QE07oM0Zqjbsp5gm9DGKZN03YSpFdbEt4EaZ8zNJQHue9xl3+1WmA1g/3w/HYxdZ9lo7Vh1mZvRgqSoTjFeaStrOW92ATFgw5fNwWmaiL8Npz5CA3OgclBPFFbvzoCG5nILhicjeQgRWUG1W4rewq0vJYXnYN0A4yat83bmJxnAa4JZs7WavX8Zid0H4gZIXmeMW+eUkpUg++DoPH2a+Edoc39JBqmmexSre/xLL02Ep0oknAeII0LDT/5qYiuuDgb3bakLWH1coqPXWdNKyDQhkiaOSA0PtbTckVsSO95nnJjXnRN4MqfwBASXFXH/w8rmfGcxNKpwJ2OCIZUrubw== 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=bpZY5PW4oOjD91JkZrXHJgFJYyZcKO6Ege5giL5sGyc=; b=txro1PgymVekOAgCM3hGEIO6o2KruphQCzOT4kov7ElaLyDCE+C4zR0RDxdFvhddxVQdYlPsiGrfkABSq53J56ab3D5h3AcdozABzr8HxetZA9wYtHdlhZyWgFQjAe8ZlBEDwgoBb/0+uksj72/mj68ettbaXvwrgf/10YOUNbnbF18/EAOJvfo11CRFRob8JaRd2tmGxDereWKa2R83bnzuhU7+ULTwS4WLcJQiujZSVj0f3iU3180g+/EuKucoO89sKaG8q5Srd3ByQG+MpVmXJjHX75H7r9pLFBXiCt4OPWn6X+6PUui/xTSauIZkjBdh4gnresr8ZymMz7cCEg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 84.19.233.75) smtp.rcpttodomain=cirrus.com smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=opensource.cirrus.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bpZY5PW4oOjD91JkZrXHJgFJYyZcKO6Ege5giL5sGyc=; b=PhqveQP0ZuIJOJI+rnqiyPSldAr2UYWBmU6c06WxxtPHgiwzA8LbBPIreqrrdYUJCbufbc7M8O8r2qCrkBkQ4CrGJa3Q80DsTYpHo28kInYzLqgrpBGdeG7nYrtZGtg2GxblfQasLZQAOIaeCsxgd6yt6GznPNYqorji0WU9QGM= Received: from CH0PR03CA0232.namprd03.prod.outlook.com (2603:10b6:610:e7::27) by LV1PR19MB8872.namprd19.prod.outlook.com (2603:10b6:408:2b5::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 13:22:46 +0000 Received: from DS3PEPF0000C380.namprd04.prod.outlook.com (2603:10b6:610:e7:cafe::d9) by CH0PR03CA0232.outlook.office365.com (2603:10b6:610:e7::27) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.10 via Frontend Transport; Wed, 21 Jan 2026 13:22:45 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75) smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com does not designate 84.19.233.75 as permitted sender) receiver=protection.outlook.com; client-ip=84.19.233.75; helo=edirelay1.ad.cirrus.com; Received: from edirelay1.ad.cirrus.com (84.19.233.75) by DS3PEPF0000C380.mail.protection.outlook.com (10.167.23.10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.4 via Frontend Transport; Wed, 21 Jan 2026 13:22:44 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id DA9D7406542; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.24]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id C6840820249; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) From: Richard Fitzgerald To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 2/5] ASoC: cs35l56: Use vendor-specific qualifier in firmware file search Date: Wed, 21 Jan 2026 13:22:40 +0000 Message-ID: <20260121132243.1256019-3-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121132243.1256019-1-rf@opensource.cirrus.com> References: <20260121132243.1256019-1-rf@opensource.cirrus.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-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF0000C380:EE_|LV1PR19MB8872:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a6f5cf4-8906-41bd-5e1e-08de58f029f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|61400799027|36860700013|54012099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bhKh7KIWhjVlVuPyonZJBKHvAVQLSHdwa2Wam1fME4uMxOL+ERCCQGBSBXXf?= =?us-ascii?Q?ntQZp50w2Obti17C8RndTfKCukoqt8L3fPu+nBYPUrO3XIOy0XPA5zWkbIwK?= =?us-ascii?Q?i3iWXyiDvumt3QavPW0ADux5aUsGkHamIbNhbpSn1yghO5tM9cVCWhD2NQas?= =?us-ascii?Q?c9rCb566w57cfP3mJsuo8h6zp4hCaKEpeoeEfj1i4Y0NiT3plxOXf0Bhd1OL?= =?us-ascii?Q?/I/BrWYbq/hvk5bz3BGRPjcWNsifHD4uHykLIl+SJyPiTqjGxfAwZBFYoEx4?= =?us-ascii?Q?ufcy88MjPJZLy4A4TX9zNbOjmhaorbXKVnO4qoln42fzBM+ixx4ixaBUeLWa?= =?us-ascii?Q?rWHE/Y2J0qsdAhW9P5J6tkf++qJIZovEShSR8/CfsEQ1juTN3A7W1GBBX8gm?= =?us-ascii?Q?6w9ZiMs5FJpkQ6Rwb+s/sXQHbcSTgGVdgkVdbgInTpbpJzHDMGgQsiFf4yVd?= =?us-ascii?Q?Zqa8G4GIpbd37fD5cY6lelXORpIfK277Opc7AB4GQRoETDmyjmHPnZwV0f0E?= =?us-ascii?Q?vaqCcFpdAUvTn0zILsn/6AVyp2TUZICs3N/orQ7Tf4E/ehipHcNrC1dVWDNF?= =?us-ascii?Q?xvOHqiYQpznltK8rAMv8pww4UrQHehaNrNQT+LuymtEv9HO1Y7iWU/QjSe2a?= =?us-ascii?Q?jAazay7KQbBY/eQ3N+ZVeyl1HEnWatPwVXbUuFQ+QoeOur0rxdQdwdAkpwW2?= =?us-ascii?Q?Aj2xf5GPVxB/IMVu1Dgveazfea2xGsakJ6ZJKLrstauXHJ5Ph51B0bcvxGtZ?= =?us-ascii?Q?N/3kmJ3QYbIdIDqR+3FctXHXfUg3jrS1mkfemisiE31pHSfjRqe0uXKmzudP?= =?us-ascii?Q?YPegLZ0T37okKazleFyXZjx6L8qa43LJo7f63PLS4bjGi6EoA6xCrkrVSJzJ?= =?us-ascii?Q?plteZA4PX/nvVGTNpCnpb8n4hPE2t8D41ef/JVernCJugRxDrbSzRWO8I1JV?= =?us-ascii?Q?AveS8t5fRD/bAR9L82hlZkcHPZcS6oiG0TSRsvlr1gfRtxUE+NYiiZVOwxCN?= =?us-ascii?Q?Ku3Uk+MptAb/RxLoLGn52diveLuGacv6mS2pn4QhEGAm4xB6cFQ6QC9fo7xd?= =?us-ascii?Q?gtGh9Rww8cAss01SZfMjXNpO91zFgK+Vuf1aB+pN3yjjGpK0PtovSTO+H6hG?= =?us-ascii?Q?q5YaYnf+A7qEwka0nKA2Ne1jFdBmlOfBeoFwh6GlAfFKIJsRYopEAXi+YcqF?= =?us-ascii?Q?FKQHJJfRmbw9Sud5g5+KftzKcI38kM+TxM13a3ZmIaeZrYKKPRY5iz2twjzd?= =?us-ascii?Q?azNUDNiNRdNT2SLUbv++XC2qJO+ECNlDYlAkC8xRN0JK1Z0mZCuYuB6yp/Ea?= =?us-ascii?Q?z8geeTnrsE8nIrSB2GeS7YAl1oelCu49r4Ug+1f0f6zEiCP3azvgneQDoCAm?= =?us-ascii?Q?4R2VnKJ0y1Kpsax1ymDMHRPZ9zeYK+sHm7rVXoPpoDjo18T5/ez2+P21vQAk?= =?us-ascii?Q?1pP6Cqw7pEq0SkIOYmVFSQT3Ct9Tq2MPgN8MSa/vUT9rPX0rKCUd8+HRnGDC?= =?us-ascii?Q?w9P2HscaDdLnq5XrqiMEFZQJA9bM2QucCW6oOVOMYbHrDxLqlke+Nv0DwKMF?= =?us-ascii?Q?oyksE16P62w3JTGJv/B8xvoDaTz5ugesJbKQJgv2ydwJv5z8vO/UmYDh+OTd?= =?us-ascii?Q?ClQN2bG3WvDd6SQU/qHec40zTjmI1VE/dS7hewojT2kimPyvFwdeP3KOUeFA?= =?us-ascii?Q?cZIfBw=3D=3D?= X-Forefront-Antispam-Report: CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(61400799027)(36860700013)(54012099003);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2026 13:22:44.9674 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a6f5cf4-8906-41bd-5e1e-08de58f029f3 X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-DS3PEPF0000C380.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV1PR19MB8872 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDExMiBTYWx0ZWRfX0U1in2oRoaAn ss94WHFpR/oLW6LpNc2HYAA3Gelor0m4xgieWzX5NbnhM/yoxSZrhaK49T4aEaZ4s+Z2f7op3yL pNLN2zVNULr5HMcClyq4NUU7Cbe3cshbiGKABTnKhPm77MV/LhBugwbPmSs/cH71ZqP8SOnCrbB 1Z7nRnBVLFGG7LKJ0JXlnvalf/BZjTomJf7M87xj8Cz+6Ov6E+PXAMtUgj4oKqmX0nkVU8d3YQ8 oQ3zy6p4QvP/u3+UffEvyK8wLjRVxhW1vLkvrVyCxHqiCo5WuKDGBrgJ6oN7YNR0YWzKb6rRudG gHFwsqJB8jAJrp7ZJvlh0tCr/IcrPW8svcFexG75IhPBLR9D3WPco4J1V1U++Nd7fRi3f96tRiV 71VtN0KlL59t6ZRgcRO0y0VAZMiZbHmunM5e6dw7omtBuATktq6v1OCzjp645tEsge34fguqYT2 EbOvylrGiYhdVke+Z4w== X-Proofpoint-GUID: K6iqJ1CQ5-wz5We9yQZNa3CFoIe1pvn6 X-Authority-Analysis: v=2.4 cv=GrRPO01C c=1 sm=1 tr=0 ts=6970d32e cx=c_pps a=p4c3Up3QyKVVMVBhHExQxQ==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=vUbySO9Y5rIA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=VkNPw1HP01LnGYTKEx00:22 a=w1d2syhTAAAA:8 a=ecnmnmwIhqI2Q9cHpl0A:9 X-Proofpoint-ORIG-GUID: K6iqJ1CQ5-wz5We9yQZNa3CFoIe1pvn6 X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" If cs_amp_devm_get_vendor_specific_variant_id() returns a string, use it as part of the firmware filename. If this firmware isn't found, fall back to the standard firmware name. This re-uses the fwf_suffix fallback mechanism that was introduced in commit e5d5b3aebdc8 ("ASoC: cs35l56: Use SoundWire address as alternate firmware suffix on L56 B0"). This is for handling vendors that use the same PCI SSID on systems with various audio hardware and have a custom vendor-specific way to identify the hardware variant. This is currently used on Dell laptops. Dell create a UEFI variable that indicates varations to the base hardware. This variance can be any part of the hardware (not necessarily affecting the audio). It would be impractical to publish many aliases for the same firmware files to match every possible variance to that base hardware. Hence the fallback to the standard firmware name. This allows alternate firmware files to be published only for variants that need it. For all other variants the fallback will load the firmware for the base SSID. This is not done for CS35L56 B0 because the fallback mechanism is already used for a different purpose for these parts. None of the products with the older L56 B0 silicon revision need the additional vendor-specific descriptor. For SoundWire the resulting firmware searches with a variant descriptor will be: 1. cs35l??-dsp1-misc-SSID-VARIANT-l?u?.wmfw 2. cs35l??-dsp1-misc-SSID-VARIANT.wmfw 3. cs35l??-dsp1-misc-SSID-VARIANT-l?u?.bin 4. cs35l??-dsp1-misc-SSID-VARIANT.bin If this doesn't find a wmfw and bin file it will then fallback to: 5. cs35l??-dsp1-misc-SSID-l?u?.wmfw 6. cs35l??-dsp1-misc-SSID.wmfw 7. cs35l??-dsp1-misc-SSID-l?u?.bin 8. cs35l??-dsp1-misc-SSID.bin With the typical published firmware names and qualifiers (a single wmfw but amp-specific bin file) this will load either: cs35l??-dsp1-misc-SSID-VARIANT.wmfw and cs35l??-dsp1-misc-SSID-VARIANT-l?u?.bin or cs35l??-dsp1-misc-SSID.wmfw and cs35l??-dsp1-misc-SSID-l?u?.bin For non-Soundwire (I2S/TDM) systems the searches and fallbacks are as above except that the "l?u?" component of the name is instead the ALSA name prefix, usually of the form "AMPn". Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs35l56.c | 69 ++++++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index 55b4d0d55712..abea782bcd3f 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -1109,27 +1109,68 @@ static const struct snd_kcontrol_new cs35l56_cal_da= ta_restore_controls[] =3D { =20 static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) { + unsigned short vendor, device; + const char *vendor_id; + int ret; + if (cs35l56->dsp.fwf_suffix) return 0; =20 - if (!cs35l56->sdw_peripheral) - return 0; + if (cs35l56->sdw_peripheral) { + cs35l56->dsp.fwf_suffix =3D devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, + "l%uu%u", + cs35l56->sdw_link_num, + cs35l56->sdw_unique_id); + if (!cs35l56->dsp.fwf_suffix) + return -ENOMEM; =20 - cs35l56->dsp.fwf_suffix =3D devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, - "l%uu%u", - cs35l56->sdw_link_num, - cs35l56->sdw_unique_id); - if (!cs35l56->dsp.fwf_suffix) - return -ENOMEM; + /* + * There are published firmware files for L56 B0 silicon using + * the ALSA prefix as the filename suffix. Default to trying these + * first, with the new SoundWire suffix as a fallback. + * None of these older systems use a vendor-specific ID. + */ + if ((cs35l56->base.type =3D=3D 0x56) && (cs35l56->base.rev =3D=3D 0xb0))= { + cs35l56->fallback_fw_suffix =3D cs35l56->dsp.fwf_suffix; + cs35l56->dsp.fwf_suffix =3D cs35l56->component->name_prefix; + + return 0; + } + } =20 /* - * There are published firmware files for L56 B0 silicon using - * the ALSA prefix as the filename suffix. Default to trying these - * first, with the new name as an alternate. + * Some manufacturers use the same SSID on multiple products and have + * a vendor-specific qualifier to distinguish different models. + * Models with the same SSID but different qualifier might require + * different audio firmware, or they might all have the same audio + * firmware. + * Try searching for a firmware with this qualifier first, else + * fallback to standard naming. */ - if ((cs35l56->base.type =3D=3D 0x56) && (cs35l56->base.rev =3D=3D 0xb0)) { - cs35l56->fallback_fw_suffix =3D cs35l56->dsp.fwf_suffix; - cs35l56->dsp.fwf_suffix =3D cs35l56->component->name_prefix; + if (snd_soc_card_get_pci_ssid(cs35l56->component->card, &vendor, &device)= < 0) { + vendor_id =3D cs_amp_devm_get_vendor_specific_variant_id(cs35l56->base.d= ev, -1, -1); + } else { + vendor_id =3D cs_amp_devm_get_vendor_specific_variant_id(cs35l56->base.d= ev, + vendor, device); + } + ret =3D PTR_ERR_OR_ZERO(vendor_id); + if (ret =3D=3D -ENOENT) + return 0; + else if (ret) + return ret; + + if (vendor_id) { + if (cs35l56->dsp.fwf_suffix) + cs35l56->fallback_fw_suffix =3D cs35l56->dsp.fwf_suffix; + else + cs35l56->fallback_fw_suffix =3D cs35l56->component->name_prefix; + + cs35l56->dsp.fwf_suffix =3D devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, + "%s-%s", + vendor_id, + cs35l56->fallback_fw_suffix); + if (!cs35l56->dsp.fwf_suffix) + return -ENOMEM; } =20 return 0; --=20 2.47.3 From nobody Sat Feb 7 15:12:03 2026 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 B34F340F8ED; Wed, 21 Jan 2026 13:22:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.152.168 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001777; cv=fail; b=TL7JbMN+OzXJSFVt5v6jZZKqQJaxMfBTy9jekz8g7E4zJ8F/TLKRIGTRqFQYAIzg+NEfcs+8e7SEEVJVd24e2ERHkn1HK+ta5o1wP3yojaryPdO/xlwlhaDCtOW8HwXqhZHISia8bMgo9TOfVd1jeHwrue4ZEIv6wTqehhQodpc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001777; c=relaxed/simple; bh=TTi/eJhhqRM9O/DBZpS6w9IoidxswVqP22Uaes22YWY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TrROe8tvNyWu/9Zyb61ehv04ah1iOaFgmTaaaT1bC8a8UFQK9ZT/BuF5N6R/ZE44p+dQWyo4Xfc74bVvRU4A8Ka+RsPFjCxQEEMuCfvRtPiGhdLTC9lD73ji834YbZfo1gu7r0EBzVWsdGQW6SoJbkFDfQy9Ov9fOeuB7OEGX08= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=Xnb0Ny1q; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=OmkKcMv0; arc=fail smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="Xnb0Ny1q"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="OmkKcMv0" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60L6X8544091091; Wed, 21 Jan 2026 07:22:51 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=crlZEpQAwe+o3S2RvbiP0CEoiAwwal0Co53ChPAmDhM=; b= Xnb0Ny1qQE+3pJ0AmS8XuZ+8P6z4L9NB61Sf2SoHx5m+ynHyAQatEyc10GdbsGhW cmGLWGfXrryzV87XQa+WGHTrB0k7god6P/KhmRZAWRo7aOvUGth9MNsmrE1X7l86 7SO/JbSWpLPJ40EgEWBtDiWwtIDoK9kXf4w8VRI3KPJwssRkiCcIvFLdPltOcued KNH/g5fQYwl9/uQjcBg+t00NkLH4HjM8Wwzo/YboRisqkcIAYKfL2HtmPpGM+t2z CCHJ5CbzFrwQL3/3iw95R2ojs1fV1z53N1ppBlNvLqX/OG5L6uROcX9d9q8gGBQc 8kZVW85xOqBAOpCErQ3JHw== Received: from ph8pr06cu001.outbound.protection.outlook.com (mail-westus3azon11022079.outbound.protection.outlook.com [40.107.209.79]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 4br7qjvta8-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jan 2026 07:22:51 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RELlR027nlm4paIl/VSkJIV1YcUs42PpXkR3/h8kNhemUrai9sjwk9CyjrWUJQJuj61+kbNuzXbpFAbZyzwyoNdSRS7V8urYIOktdukJdTrs6bq6/cGItfikniPoRHNB32PkoGk9rS/neXnuEDwKntjCvLJCOmXijLIkyx/43fbte8KsNW5CJlqyhiCN2ceunyQ8mRyFKzqr1xH/hUbx70FcoSYtf1biPsT4S46xpeEKCOxaMOH4Pz8+TYXnwEqqhwjrdoFzjiB216qoYDBc1594MRiNKrCk288Dc4Atnz+ao34mFIxE1I8KLUmBhu48XwjpvDht53+y+aOgW+Q9Fw== 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=crlZEpQAwe+o3S2RvbiP0CEoiAwwal0Co53ChPAmDhM=; b=vyHxvAKRDF4a3xW39oqvxV7f/NhOYKmTme+9lR1ak6VPAyEFYFwC5FhMrTVR8vtdTW+0t4hbjmzJXepRfyZ0H/AejkGN+ru5tkcMaT7H8tyCqHz04W1YqAyAwxGXm8scOZJ7dXQSRDG7fSQqScgahzaz/gMhLnkSNJT4TE8CStIZiZnENvRQt74zhb4dRkriYQCYJEJZ4lsQf9NqSLNhvFCuuvPOfDKZtB3FT5QUaudOYUXI9CH9uN7h3vyiJKcVI13rQtsax2mAkWKhmeStUJ/YIVGcxoSrSXC7syxVPTVdqL/XRW+fmIEPJK5XLXZNIs5bpK3wr9zvWvWgsOz+4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 84.19.233.75) smtp.rcpttodomain=cirrus.com smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=opensource.cirrus.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=crlZEpQAwe+o3S2RvbiP0CEoiAwwal0Co53ChPAmDhM=; b=OmkKcMv03m7JK5TV2TNzo6YeASW828p1v0pxz1Mw/dXEXZbOlQY0RjbV2p6Y/fHQ6/RgreiJyx2AlGC+lDzhR+osFph4C6QbtKkzECodEmrMsBQqr5zFI9XTleGOI7XH43poECszMD3MFIs6PV3DeQrDBj/LkuVnS3ex8/nzSaw= Received: from BL0PR01CA0016.prod.exchangelabs.com (2603:10b6:208:71::29) by CH4PR19MB8657.namprd19.prod.outlook.com (2603:10b6:610:22a::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 13:22:45 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:71:cafe::7b) by BL0PR01CA0016.outlook.office365.com (2603:10b6:208:71::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.10 via Frontend Transport; Wed, 21 Jan 2026 13:20:55 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75) smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com does not designate 84.19.233.75 as permitted sender) receiver=protection.outlook.com; client-ip=84.19.233.75; helo=edirelay1.ad.cirrus.com; Received: from edirelay1.ad.cirrus.com (84.19.233.75) by BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.4 via Frontend Transport; Wed, 21 Jan 2026 13:22:45 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id E7791406543; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.24]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id D3C7382024A; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) From: Richard Fitzgerald To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 3/5] ASoC: cs-amp-lib-test: Tests for reading SSIDExV2 Date: Wed, 21 Jan 2026 13:22:41 +0000 Message-ID: <20260121132243.1256019-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121132243.1256019-1-rf@opensource.cirrus.com> References: <20260121132243.1256019-1-rf@opensource.cirrus.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-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|CH4PR19MB8657:EE_ X-MS-Office365-Filtering-Correlation-Id: 43de1776-48ff-47c5-c658-08de58f02a16 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|61400799027|36860700013|54012099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Jy1r5a6ODgHGl0DqgC83mUdzZWtvdBiAOIEOTGlPq3tXVsS7mI0jmyqUlG4p?= =?us-ascii?Q?kxXct+VGnlrb0SqMnG5+XXZjCIZwgN6Jv+wiKKjAxNS73FXFfNXoKsBg16EQ?= =?us-ascii?Q?nfvWFzXcdfisGh5uu6LCC6PIVrvxODfY8+UsfMPOLYMs3PkYiHE1CMcmUFV1?= =?us-ascii?Q?roCDI1jQAj07BYjq5SRZQ1AqMS6Pyv4ySLAv3uvwFLwxdc7FtUYWwYkk0emm?= =?us-ascii?Q?HLIZxUI9t9IpxJzoAOHT2I0zPAJPm25VVtyXQ/pvvLo7FiJXVK98FBwOJU92?= =?us-ascii?Q?G42jbDKiSXM9OWsnbP+pyvDTJOSM3aU4/Kw549tWEttYuY0tFr0/L7j2LUAp?= =?us-ascii?Q?n2WYE6lIRg5r18UL9ZjPPAy/u4sJIqvWzR9mUGEpAJx/NzWEnaJzwyRDYPFA?= =?us-ascii?Q?+mzFgIO2zPDouhlrRC3GR2ezXlgPhLD5bSSEchPktwVfQk6XdQixuFy8teem?= =?us-ascii?Q?zfhj7zN2cVqhXQFa/HnuTaykODUaC318V/sJTVv1AjWraFZ2Mr6tJwKSNFa2?= =?us-ascii?Q?tCZwybluRXj0ydn+wgQ1iUUvGXRoex+8eQ9bN7ppnpw7HYQtK4t4QdgIjSjT?= =?us-ascii?Q?kqLDyK5dv6DpgHgU2zxGv7q1AEfpvMGrf9I/macdG2x+GZYMuW4+4ss3CcBo?= =?us-ascii?Q?jGfq78xpN1BnUFmzy3/XErxpBom7pfxnXa/ghxxYEtGRo+l207D/oxbMcvRw?= =?us-ascii?Q?z1D+BNJqgqo9orwXVsQMHnZNti9YaEVjxnrWYR/QyyTLr7OazJJpMKfcYA6p?= =?us-ascii?Q?p9+/5mqNkAirwqdu9HmSu2aXLw0Kzuz7EeRKbxImDBDItvIzYmoJTRy6hehO?= =?us-ascii?Q?p2RlzPIaFWaE8cxTv8EXr59DM/V4s8A5WGN9RMS+XkASIagfPPFsiUpr7GQ5?= =?us-ascii?Q?sdANFb7QEd97DLzOO7RGy8aDM1askvc27enVa4KGKYWDdlQjBUKS9fQteTyK?= =?us-ascii?Q?1rXybxhB7ePywkcztFFR2q5C8T8kkBh8UZYoZoqPlP76lu2EVoJASuX0ymir?= =?us-ascii?Q?ShPFXolWNvzXi4LpiAstv9lQ6RO1ibppuHN2XkziJdB7Iw/qncZSTwY8JPSm?= =?us-ascii?Q?3rNZhcka5kxyNj0+I96bxzOi9yUV87NSt/B+By76pMFC6ZORyXIVd06PMObb?= =?us-ascii?Q?TYqLT7k9noJuVciMz0oNvzLEWEYXXkQxzVdYC8ubkkSevY8TJmmyhvuWExeS?= =?us-ascii?Q?mRMTET73xyE7Z2igevVYnyqEfQJzK7MCBv9MC+CYMZ9/dhfpiHaa8IC+RbdF?= =?us-ascii?Q?ebEq1raTgLnxXgd+kEkvQaBpCyGXqH27nWBMAyKkvNIz5jGf5umu6pOrJlO7?= =?us-ascii?Q?LweyUFo0aBc2jXMFzb+r3kQUF0mOilYqfC0KGChTlLgC/xPQWksEnW96VCho?= =?us-ascii?Q?umfPgIfFXIM4VMJnrm1INJ1NoI92NlCmV7Igimj+yZgzB4XuX4BBcz/+Yofn?= =?us-ascii?Q?enV29hKp/Ua0ePFPx3sYQt+KnTNxX7cKVLqQKDWUgCUVjXwO2w4nSlppNb0K?= =?us-ascii?Q?yASHtvZY+mQty+/A+ijv41oO1hbT7exrKnakmBJwX/iTj5x8DDOHl+ZBkt7N?= =?us-ascii?Q?DOVoeZoeg/TIg6UbMJM5cMC/Gb/VqjD9GOursx1l8CvlO1h5zDxeHLUa/XH+?= =?us-ascii?Q?ZjwmwIHyWxUOBUvKcKI+bee/fAa8yX9AuYNUlKxGTR6ubz8XYCnDH7T86Dkf?= =?us-ascii?Q?lttteg=3D=3D?= X-Forefront-Antispam-Report: CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(61400799027)(36860700013)(54012099003);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2026 13:22:45.2573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43de1776-48ff-47c5-c658-08de58f02a16 X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH4PR19MB8657 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDExMiBTYWx0ZWRfX3qQlQUr0f7EE Yoimeeyvexf5JdgRLFhgKi3uYhXKWAu9BR5PTpa+tMfnnGAsLsoUYQq53gjbhcMyNvft8I6Vw/t +J5k9+RFQNA57/9NKtPGmhRzjbeMheNsruqy818+qpvHWMSj22PG8+MNYyQZ//DPEpeATYxtjyt KyXWhcAOjiYFkiVRX1wgL28rFbRyU5dR3sp4CBOZmy2sO9H1oI2IxU/rUuiFyRgSaGRggqWe5uL kAIu2Cip0EWQjyoYoDAUBWjzjEMrLjf6fB0qIVVMuoD2YMeV28XWywvd+J2ITphcBYn7ElkcaK3 ahsdUMwpro8Q6vG8sFh6ilah6cEgKLkZ7+LFuqhja+srxSJCOo1fHqmrBat5DepycwoQ7QwAuMt uY8Fgu8ygjx5aOW+J9e4lVtQWm3X6T+3JIeooylrUF5lFSejJMExBAcosv4cDLNogCP9GpfwVxF C8aGGbXfy63w5fzOVnQ== X-Proofpoint-GUID: eOR-r79QE2ywuoUGrAoZoTGfpbJtDPSl X-Authority-Analysis: v=2.4 cv=GrRPO01C c=1 sm=1 tr=0 ts=6970d32b cx=c_pps a=/ox7Nx15/I3RpRoI+9JZHw==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=vUbySO9Y5rIA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=VkNPw1HP01LnGYTKEx00:22 a=w1d2syhTAAAA:8 a=2FL-I1ABYs5uegM3JscA:9 X-Proofpoint-ORIG-GUID: eOR-r79QE2ywuoUGrAoZoTGfpbJtDPSl X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Adds test cases for getting a Dell SSIDExV2 string by calling cs_amp_devm_get_vendor_specific_variant_id(). This is a fairly simple test harness, the redirected call to cs_amp_get_efi_variable() returns a test string to simulate reading a string from UEFI. The returned string should be the second field in the SSIDExV2 string (if valid). Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs-amp-lib-test.c | 169 +++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/sound/soc/codecs/cs-amp-lib-test.c b/sound/soc/codecs/cs-amp-l= ib-test.c index 923f1857e45b..2b1529343f11 100644 --- a/sound/soc/codecs/cs-amp-lib-test.c +++ b/sound/soc/codecs/cs-amp-lib-test.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -56,6 +57,8 @@ struct cs_amp_lib_test_ctl_write_entry { struct cs_amp_lib_test_param { int num_amps; int amp_index; + char *vendor_sysid; + char *expected_sysid; }; =20 static struct cirrus_amp_efi_data *cs_amp_lib_test_cal_blob_dup(struct kun= it *test) @@ -2305,6 +2308,98 @@ static void cs_amp_lib_test_spkid_hp_31(struct kunit= *test) KUNIT_EXPECT_EQ(test, 1, cs_amp_get_vendor_spkid(dev)); } =20 +static efi_status_t cs_amp_lib_test_get_efi_vendor_sysid(efi_char16_t *nam= e, + efi_guid_t *guid, + u32 *returned_attr, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + const struct cs_amp_lib_test_param *param =3D test->param_value; + unsigned int len; + + KUNIT_ASSERT_NOT_NULL(test, param->vendor_sysid); + len =3D strlen(param->vendor_sysid); + + if (*size < len) { + *size =3D len; + return EFI_BUFFER_TOO_SMALL; + } + + KUNIT_ASSERT_NOT_NULL(test, buf); + memcpy(buf, param->vendor_sysid, len); + + return EFI_SUCCESS; +} + +/* Fetch SSIDExV2 string from UEFI */ +static void cs_amp_lib_test_ssidexv2_fetch(struct kunit *test) +{ + const struct cs_amp_lib_test_param *param =3D test->param_value; + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + const char *got; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_vendor_sysid); + + got =3D cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_DEL= L, 0xabcd); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, got); + KUNIT_EXPECT_STREQ(test, got, param->expected_sysid); +} + +/* Invalid SSIDExV2 string should be ignored */ +static void cs_amp_lib_test_ssidexv2_fetch_invalid(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + const char *got; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_vendor_sysid); + + got =3D cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_DEL= L, 0xabcd); + KUNIT_EXPECT_NOT_NULL(test, got); + KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT); +} + +static void cs_amp_lib_test_ssidexv2_not_dell(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + const char *got; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_vendor_sysid); + + /* Not returned if SSID vendor is not Dell */ + got =3D cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_CIR= RUS, 0xabcd); + KUNIT_EXPECT_NOT_NULL(test, got); + KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT); +} + +static void cs_amp_lib_test_vendor_variant_id_not_found(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + const char *got; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_none); + + got =3D cs_amp_devm_get_vendor_specific_variant_id(dev, PCI_VENDOR_ID_DEL= L, 0xabcd); + KUNIT_EXPECT_NOT_NULL(test, got); + KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT); + + got =3D cs_amp_devm_get_vendor_specific_variant_id(dev, -1, -1); + KUNIT_EXPECT_NOT_NULL(test, got); + KUNIT_EXPECT_EQ(test, PTR_ERR_OR_ZERO(got), -ENOENT); +} + static int cs_amp_lib_test_case_init(struct kunit *test) { struct cs_amp_lib_test_priv *priv; @@ -2375,6 +2470,71 @@ static void cs_amp_lib_test_get_cal_param_desc(const= struct cs_amp_lib_test_para KUNIT_ARRAY_PARAM(cs_amp_lib_test_get_cal, cs_amp_lib_test_get_cal_param_c= ases, cs_amp_lib_test_get_cal_param_desc); =20 +static const struct cs_amp_lib_test_param cs_amp_lib_test_ssidexv2_param_c= ases[] =3D { + { .vendor_sysid =3D "abcd_00", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "abcd_01", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "abcd_XY", .expected_sysid =3D "XY" }, + + { .vendor_sysid =3D "1028abcd_00", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "1028abcd_01", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "1028abcd_XY", .expected_sysid =3D "XY" }, + + { .vendor_sysid =3D "abcd_00_WF", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "abcd_01_WF", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "abcd_XY_WF", .expected_sysid =3D "XY" }, + + { .vendor_sysid =3D "1028abcd_00_WF", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "1028abcd_01_WF", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "1028abcd_XY_WF", .expected_sysid =3D "XY" }, + + { .vendor_sysid =3D "abcd_00_AA_BB", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "abcd_01_AA_BB", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "abcd_XY_AA_BB", .expected_sysid =3D "XY" }, + + { .vendor_sysid =3D "1028abcd_00_AA_BB", .expected_sysid =3D "00" }, + { .vendor_sysid =3D "1028abcd_01_AA_BB", .expected_sysid =3D "01" }, + { .vendor_sysid =3D "1028abcd_XY_A_BB", .expected_sysid =3D "XY" }, +}; + +static void cs_amp_lib_test_ssidexv2_param_desc(const struct cs_amp_lib_te= st_param *param, + char *desc) +{ + snprintf(desc, KUNIT_PARAM_DESC_SIZE, "vendor_sysid:'%s' expected_sysid:'= %s'", + param->vendor_sysid, param->expected_sysid); +} + +KUNIT_ARRAY_PARAM(cs_amp_lib_test_ssidexv2, cs_amp_lib_test_ssidexv2_param= _cases, + cs_amp_lib_test_ssidexv2_param_desc); + +static const struct cs_amp_lib_test_param cs_amp_lib_test_ssidexv2_invalid= _param_cases[] =3D { + { .vendor_sysid =3D "abcd" }, + { .vendor_sysid =3D "abcd_0" }, + { .vendor_sysid =3D "abcd_1" }, + { .vendor_sysid =3D "abcd_0_1" }, + { .vendor_sysid =3D "abcd_1_1" }, + { .vendor_sysid =3D "abcd_1_X" }, + { .vendor_sysid =3D "abcd_1_X" }, + { .vendor_sysid =3D "abcd_000" }, + { .vendor_sysid =3D "abcd_010" }, + { .vendor_sysid =3D "abcd_000_01" }, + { .vendor_sysid =3D "abcd_000_01" }, + + { .vendor_sysid =3D "1234abcd" }, + { .vendor_sysid =3D "1234abcd_0" }, + { .vendor_sysid =3D "1234abcd_1" }, + { .vendor_sysid =3D "1234abcd_0_1" }, + { .vendor_sysid =3D "1234abcd_1_1" }, + { .vendor_sysid =3D "1234abcd_1_X" }, + { .vendor_sysid =3D "1234abcd_1_X" }, + { .vendor_sysid =3D "1234abcd_000" }, + { .vendor_sysid =3D "1234abcd_010" }, + { .vendor_sysid =3D "1234abcd_000_01" }, + { .vendor_sysid =3D "1234abcd_000_01" }, +}; + +KUNIT_ARRAY_PARAM(cs_amp_lib_test_ssidexv2_invalid, cs_amp_lib_test_ssidex= v2_invalid_param_cases, + cs_amp_lib_test_ssidexv2_param_desc); + static struct kunit_case cs_amp_lib_test_cases[] =3D { /* Tests for getting calibration data from EFI */ KUNIT_CASE(cs_amp_lib_test_cal_data_too_short_test), @@ -2434,6 +2594,15 @@ static struct kunit_case cs_amp_lib_test_cases[] =3D= { KUNIT_CASE(cs_amp_lib_test_spkid_hp_30), KUNIT_CASE(cs_amp_lib_test_spkid_hp_31), =20 + /* Test cases for SSIDExV2 */ + KUNIT_CASE_PARAM(cs_amp_lib_test_ssidexv2_fetch, + cs_amp_lib_test_ssidexv2_gen_params), + KUNIT_CASE_PARAM(cs_amp_lib_test_ssidexv2_fetch_invalid, + cs_amp_lib_test_ssidexv2_invalid_gen_params), + KUNIT_CASE_PARAM(cs_amp_lib_test_ssidexv2_not_dell, + cs_amp_lib_test_ssidexv2_gen_params), + KUNIT_CASE(cs_amp_lib_test_vendor_variant_id_not_found), + { } /* terminator */ }; =20 --=20 2.47.3 From nobody Sat Feb 7 15:12:03 2026 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (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 8761D43E483; Wed, 21 Jan 2026 13:22:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.149.25 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001776; cv=fail; b=D8DETwAnk2Vbxy58FcSSIfN7h301cTA36uV6mvbaleqqQqLMiAPKXHnUCJLXHYlamAYCxPFepGZU/+idwlIBF4AHEVPIZuegyAVDtxo7/l1Kw5nvByZfPTDxl/vtTGiem/zbyi6VIVs8H+YpvHbPeyBYEBeJR+NmMzuyH+eFr2M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001776; c=relaxed/simple; bh=dlsAFUs037/DAjSygpkh/tbUBK5nGY8y/7IJUoHtg/I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wexd9/manQjmDp7CWEuDY1rLWKW6imr4uM8Yv/QgZvwRjIVAIb+VEpiWWwMHRcG7xTB0renpQzA38ZeOrCqB0p22qtbJJRYWIvvTwrPk81OBnj63z17i+6LoiDy2SP1b3snMgbDubLrkWjBaObKeDIs7OjBJrf5eYffqDJUAjWE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=A2KNk9FV; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=eXE640eu; arc=fail smtp.client-ip=67.231.149.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="A2KNk9FV"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="eXE640eu" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60L3px5H2708810; Wed, 21 Jan 2026 07:22:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=FjQSC+4fZwRVVZW69Tv/ceyg43PtXyPhV1v7oCPlz1U=; b= A2KNk9FVHhwjF6sAACcSlQL3d49tQ+dY40lM6K0zpaKTYKnA4ci9K1/frYYq29yG pU6XuUs6axARW7FR0I51iDbDzwbiQwqME5fe515SMeOPpFMjcN1lswrW5rWF/3di q3OBUQjBzPUtSqmVIXrghAtCkTrAOmuQm4xW35OB4Wqbv9MmRZufe8rPtsSFFIbK 0WZZIhL8Lipl12CD5oDx27UNnz+uZfvQ2+UNIArcmAPtdYExcZCZks0DwgfmVwW2 POYTfAJQ1J5YuzV4thmbcSjsyNVIiw56XmEthYx0hTQbZzf1r7GsR3OLEnTwrPf/ rtO706yDW5pnl/OwPTTvRg== Received: from bn1pr04cu002.outbound.protection.outlook.com (mail-eastus2azon11020089.outbound.protection.outlook.com [52.101.56.89]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 4br8q1vnxv-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jan 2026 07:22:51 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=anFuZSDto3B6WVMNb2VEmowKBfPwiJgkO+3Lu46XX1uxmkIByhdlzwcqkdgfuvlhs0W2LBx/Z1KFXpQBPZi+KtJ6Wc0qsyavoXW5N530h1ZFe8gkMnTAvoQCVN0Gs4wk5gLjapYM4iqG1oiOWO/EiL9KPraaHg7BVmefCxwxC3YpD438tB6IPZy1OQGBt5IeX4PEtMh94NY5WMxjEedQi9vqKX6DEljZJKT0ur6BHXBv//05vy9mZyy62K7PqtfQ5x+ADD4itf1VBObsU+aoQvo2g3nY6x61qG1Qk+dqBJK+9CLlaAFmZUX2nh1qYqapC8JTyDnO38nHgrdyfLjpHQ== 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=FjQSC+4fZwRVVZW69Tv/ceyg43PtXyPhV1v7oCPlz1U=; b=MX59B0BY5f8zy9z0+/dxu1IQW6toFrYNVBOT6BpvVPAUHzJL0eqgejRHGbT8JhETgN9yFmvGRarZSGqkAexjAXYq4SOV7xy15npMvBfXpsrVftLlUuAa9xXb90X7/SjQPhUsRPbkwewYHfPNDre94nUj3k1jlD9wPC7U0PicZgZ6VrGy75EsTCfkQ2Kp6cVDTpXUj1P+USaKCVEeGTvf4bhCb3BzPPKR/T+3XVUKyISBqwXT34Ck4cgZGbTquBnlZl6VYE3W4XOr63/9LhJ1Im7/USZg7zvdwlJmKfYzYGxCpD+mJAs8wLVEWzRfH7xQJHLerCERV8LOtvn651ObgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 84.19.233.75) smtp.rcpttodomain=cirrus.com smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=opensource.cirrus.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FjQSC+4fZwRVVZW69Tv/ceyg43PtXyPhV1v7oCPlz1U=; b=eXE640euO43TjtZXKl6Dwewu6b6iAcbp+4+5ODWzWvvRPqcwCJIkKskT97JfM/byNRLgJNGIAlSXhgJOrGFI9dEHbbAsTMyQYN+A3z4NJycVqrCQPvplQlSDGCVgNxxMoZ8M2yc/xZ+iL5CVppX/MpgAN05CEHxTBauqCRLvffQ= Received: from MN2PR20CA0049.namprd20.prod.outlook.com (2603:10b6:208:235::18) by IA0PR19MB7677.namprd19.prod.outlook.com (2603:10b6:208:406::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.10; Wed, 21 Jan 2026 13:22:47 +0000 Received: from BL6PEPF0001AB73.namprd02.prod.outlook.com (2603:10b6:208:235:cafe::46) by MN2PR20CA0049.outlook.office365.com (2603:10b6:208:235::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.10 via Frontend Transport; Wed, 21 Jan 2026 13:22:40 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75) smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com does not designate 84.19.233.75 as permitted sender) receiver=protection.outlook.com; client-ip=84.19.233.75; helo=edirelay1.ad.cirrus.com; Received: from edirelay1.ad.cirrus.com (84.19.233.75) by BL6PEPF0001AB73.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.4 via Frontend Transport; Wed, 21 Jan 2026 13:22:46 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id EC68A406545; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.24]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id D979882024B; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) From: Richard Fitzgerald To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 4/5] ASoC: cs-amp-lib: Add a Kconfig symbol for enabling test hooks Date: Wed, 21 Jan 2026 13:22:42 +0000 Message-ID: <20260121132243.1256019-5-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121132243.1256019-1-rf@opensource.cirrus.com> References: <20260121132243.1256019-1-rf@opensource.cirrus.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-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB73:EE_|IA0PR19MB7677:EE_ X-MS-Office365-Filtering-Correlation-Id: 20bd8243-1522-4cd5-0111-08de58f02ad7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|61400799027|82310400026|54012099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZXhA/fJI6kRPatGmsCxwelJ8M8cajUNH9ebJqhEy2rdPqMavHIQcWQXLpzqc?= =?us-ascii?Q?qZH3eSglGG7qfMqOaLIHNrGdh2j8hCIdcql6EgrBid4YPH4muw+2EYBIa1y9?= =?us-ascii?Q?K0mDYG7wxeMQhFH2aQXnTcTrk7LGhqI1VqXzVt+QzSWk8i8ZeFRKUeJnxNLY?= =?us-ascii?Q?mWgLnhqZ2Daz45Q/6DYGD32DNUCSHxFr/9GMCZIRrm5T+IT2Q+cIMD5UHOuW?= =?us-ascii?Q?PXeemYPMkQqmMC8zk8SoBqN2Ii1JtwP/eask/ulgpoU0HNiD4FvPPHRcd3ny?= =?us-ascii?Q?KhKg13ZadbcuiAPHYNnvm+7dy/Q5N6SstqmlRqKSiS0oVlv93QkOCcqsd/75?= =?us-ascii?Q?dXPVvVwS3ygpw2xzHW1/U+K82ux0B6uMPM9oTCU+GCIIzJnPScw/6Znzdept?= =?us-ascii?Q?iml884jIYD9ieeeHhllqgkScfyKT/gxbBd3wEJc77hzMGrjYfg9gjh5bU8Iu?= =?us-ascii?Q?JfRpaCMnGFwcU0S7oUPHBSm/kdVmLA3LKTQGQtlGJFwLZf6EU+AR7kowuygQ?= =?us-ascii?Q?mKk2vlp7BTQKO0f2ZLCyAUjOF+POr0NKNMV2uj/W2QGzgCc9/scGmEDP1uhQ?= =?us-ascii?Q?aygrrVGw63bQXm6iVzF8edDu9WEyiLICyaYw64VzNlbxleydvL5Tz+8yWLwU?= =?us-ascii?Q?bzagNqLb8esSPvynGbzr49o9kJVbsxs9PP5KN8iVI0tMSWyxgk/nmWYw5yvm?= =?us-ascii?Q?v44qeXWFIJL3zOs+TcTCeoaX4AVtWH9CVkMSG1meRA/lDCRe7d2CpYIB5HVt?= =?us-ascii?Q?De5bRzA4TRc/Rl+E0Jdo7N/XzEs9GP6+hq9P+r5cgMuVtyyOnbHKkJ7/XgQV?= =?us-ascii?Q?Ilroh7Ad308S0wBkAtcgXxRELXmDPRg0mUYjvitQ5tbb3YCNg23T/xD7FRqD?= =?us-ascii?Q?AmlyfVfIQBt4aAqs5dg8nmx6/QpnGFZ9fj9svK3TrHvTL8noRbkxJRoD9WxQ?= =?us-ascii?Q?VYpjcYEU3v8kVQoGeLsxtEMlsT1iB8zlgOgxgd8/OH/j9m36J4sUIFSu8IK/?= =?us-ascii?Q?Usjholthpi45DxUyVaHO+J3d0n5NtOZzTlGG1DmgkH1YJHpSQhbIZVGnluKm?= =?us-ascii?Q?6EOA44BPyy+pH8d36NCyGF8i607VLJxDgs9BKAEz0cB9CBqJMfNmdh9yKS4h?= =?us-ascii?Q?8whhTWHuLLcVy1H4zE63c9QLy4zXPtya+KZTAaZ4NSpcDN75BnIIN5pqwbEX?= =?us-ascii?Q?TDEtsUBRt/OGDJutCrAr7XmizIQp271T6bqGLOkJBFSdjEFniH8OHHP3lQHQ?= =?us-ascii?Q?hOHrNkBCWaqnwqnt2te4vRk9Ah0f4Z8x865KmK1BrTvM3Dmpu0DYN40FTA7A?= =?us-ascii?Q?CxKzxm/2ubTZclSx0BdE5i63RSpOel34uPj7L3kV6Y3tm8zg56czBXG9V85H?= =?us-ascii?Q?sGFnVSW5ia7GtacPNxUhAw9X25edNWNAQtMCPh4tSUjer5/S1K+d5nwbYfJS?= =?us-ascii?Q?EP7Ob7Icx3w23L64HK3UrtVm1Mfcgj5hXprp463kaPnYQ8czaoKxUA9yRbS1?= =?us-ascii?Q?+RyRvo0I1N484z7GojHxCu/LcKhkanpFrjzeCaxzchIrQbu6EPJN1aRIH9AG?= =?us-ascii?Q?VXw9uuMnxYCPPYOirKgRYm+p0eTM4zTcea5CRv+OIjvKbE+Zp8uzGhydKsaf?= =?us-ascii?Q?/gV/8GcjPndhGIGMKBKTvHHauAjhp1tvGAW28idLm0wBHykpWw1LoxKc9sNr?= =?us-ascii?Q?WqUMMw=3D=3D?= X-Forefront-Antispam-Report: CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(376014)(61400799027)(82310400026)(54012099003);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2026 13:22:46.5144 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20bd8243-1522-4cd5-0111-08de58f02ad7 X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BL6PEPF0001AB73.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR19MB7677 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDExMiBTYWx0ZWRfXxsvndpq9Ui5c Dk2xurbXfhEWsUM9xVZr8zSLU6/Bq1WB3/MjBc7xcsc29rWrFyV3ILTlO2HqmXUl9VD/tuR7EV5 U/vX+uGxm7m/Q++QTuacpzNuojIZ7R/5EHb+zJ6qZ/zAEXuMgcnOoN26UNdhuR93gheclw4n2XQ o7cFJBUx40RJOxExLSJb4pCpGpEQrewPZXUv07+4+lwEkWNjRAZhJXFm2L87ykHyfICsufQlxmX sZbq4/VnlCwdNN2i4jSIYrdx7IENVf2tZufMfMaq+8eq5OtuwdR7+hhNzGQTuyHCAgmAoyf9zWy 8pxQBh2lycoEfr5+YqKS9ROKDUCDuNZWBx1ub4KhYtFR7hQGPwWgroyzndxeDBE4Le9mwBO+su0 jGWWBDTstjVmQkeOEiDvwn7KhdmDHNhkNWvUVBVj7zE9LAFuupt4M/xrJTrslll0lQ+TIKytk3g WO7gD9r4DlsiT24Epyg== X-Proofpoint-GUID: hP6PQIyX0DLfe6mPOxuDjfEPC_6sNsf0 X-Proofpoint-ORIG-GUID: hP6PQIyX0DLfe6mPOxuDjfEPC_6sNsf0 X-Authority-Analysis: v=2.4 cv=JbmxbEKV c=1 sm=1 tr=0 ts=6970d32b cx=c_pps a=BKqWZN8aUWREUN+CsN3l9A==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=vUbySO9Y5rIA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=VkNPw1HP01LnGYTKEx00:22 a=w1d2syhTAAAA:8 a=1eBEuZX1URBboTtWnAsA:9 X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add Kconfig symbol CONFIG_SND_SOC_CS_AMP_LIB_TEST_HOOKS to enable calling into functions that would normally abort because of missing EFI functionality. Before this the code paths were only enabled if the KUnit test for cs-amp-lib was enabled. This change allows KUnit tests for clients of cs-amp-lib to install redirection hooks in cs-amp-lib. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/Kconfig | 5 +++++ sound/soc/codecs/cs-amp-lib.c | 19 ++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 90f09d4bdf8e..21d5b79f079d 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -786,9 +786,14 @@ config SND_SOC_CROS_EC_CODEC config SND_SOC_CS_AMP_LIB tristate =20 +config SND_SOC_CS_AMP_LIB_TEST_HOOKS + bool + depends on SND_SOC_CS_AMP_LIB + config SND_SOC_CS_AMP_LIB_TEST tristate "KUnit test for Cirrus Logic cs-amp-lib" if !KUNIT_ALL_TESTS depends on SND_SOC_CS_AMP_LIB && KUNIT + select SND_SOC_CS_AMP_LIB_TEST_HOOKS default KUNIT_ALL_TESTS help This builds KUnit tests for the Cirrus Logic common diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index 9f8c99dfb798..f8c7f594d54a 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -211,7 +211,7 @@ int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, const struct cirrus_amp_cal_data *data) { - if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LI= B_TEST)) + if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LI= B_TEST_HOOKS)) return _cs_amp_write_cal_coeffs(dsp, controls, data); else return -ENODEV; @@ -230,7 +230,7 @@ int cs_amp_read_cal_coeffs(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, struct cirrus_amp_cal_data *data) { - if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LI= B_TEST)) + if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LI= B_TEST_HOOKS)) return _cs_amp_read_cal_coeffs(dsp, controls, data); else return -ENODEV; @@ -249,10 +249,7 @@ int cs_amp_write_ambient_temp(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, u32 temp) { - if (IS_REACHABLE(CONFIG_FW_CS_DSP) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LI= B_TEST)) - return cs_amp_write_cal_coeff(dsp, controls, controls->ambient, temp); - else - return -ENODEV; + return cs_amp_write_cal_coeff(dsp, controls, controls->ambient, temp); } EXPORT_SYMBOL_NS_GPL(cs_amp_write_ambient_temp, "SND_SOC_CS_AMP_LIB"); =20 @@ -611,7 +608,7 @@ static int _cs_amp_set_efi_calibration_data(struct devi= ce *dev, int amp_index, i int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, in= t amp_index, struct cirrus_amp_cal_data *out_data) { - if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) + if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST_H= OOKS)) return _cs_amp_get_efi_calibration_data(dev, target_uid, amp_index, out_= data); else return -ENOENT; @@ -647,7 +644,7 @@ EXPORT_SYMBOL_NS_GPL(cs_amp_get_efi_calibration_data, "= SND_SOC_CS_AMP_LIB"); int cs_amp_set_efi_calibration_data(struct device *dev, int amp_index, int= num_amps, const struct cirrus_amp_cal_data *in_data) { - if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST))= { + if (IS_ENABLED(CONFIG_EFI) || IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST_H= OOKS)) { scoped_guard(mutex, &cs_amp_efi_cal_write_lock) { return _cs_amp_set_efi_calibration_data(dev, amp_index, num_amps, in_data); @@ -720,7 +717,7 @@ int cs_amp_get_vendor_spkid(struct device *dev) int i, ret; =20 if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE) && - !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) + !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST_HOOKS)) return -ENOENT; =20 for (i =3D 0; i < ARRAY_SIZE(cs_amp_spkid_byte_types); i++) { @@ -743,7 +740,7 @@ static const char *cs_amp_devm_get_dell_ssidex(struct d= evice *dev, int ret; =20 if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE) && - !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) + !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST_HOOKS)) return ERR_PTR(-ENOENT); =20 char *ssidex_buf __free(kfree) =3D cs_amp_alloc_get_efi_variable(DELL_SSI= DEXV2_EFI_NAME, @@ -849,7 +846,7 @@ static const struct cs_amp_test_hooks cs_amp_test_hook_= ptrs =3D { }; =20 const struct cs_amp_test_hooks * const cs_amp_test_hooks =3D - PTR_IF(IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST), &cs_amp_test_hook_ptrs= ); + PTR_IF(IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST_HOOKS), &cs_amp_test_hoo= k_ptrs); EXPORT_SYMBOL_NS_GPL(cs_amp_test_hooks, "SND_SOC_CS_AMP_LIB"); =20 MODULE_DESCRIPTION("Cirrus Logic amplifier library"); --=20 2.47.3 From nobody Sat Feb 7 15:12:03 2026 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 89C51481FD4; Wed, 21 Jan 2026 13:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=67.231.152.168 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001779; cv=fail; b=Wm+Dpdd/RNT561MOw0vj5/sR+7XkqO/eNWAtAwuYa95rmtt+zDyMmMalpgnCsvLh6Ys+WAiM7LsgdIoi05nAwwtWTlTsaX/LyyfbeDbSTTli3mCp6wGnMwh3wa3Y2EWunurFoYa4paJBN890QgCAatdy9aaCspt9YfQRSoKPuMg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769001779; c=relaxed/simple; bh=f/fmvvngQnXTL1huwvsEZiSA3px+wfxdXudbmXON69k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aDoTbQBZgyG49o6KRTj6ErNLa0rwk6EtA4xN2G4lqYRScTAh3pSqzjZ2N2bgFgZ/jKyqxZSBSZyeSCZd3UQPP17T24ngzMPWdCEAYqD/7jHIWo42oYLyEEYsEOlyDjbC0K2B5Ej4HSmHAB6YCP5szXhzTidgBzGMMzNpwcP0OXY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com; spf=pass smtp.mailfrom=opensource.cirrus.com; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b=qCPrb/Ho; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=holwKwHT; arc=fail smtp.client-ip=67.231.152.168 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="qCPrb/Ho"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="holwKwHT" Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60LBTHqN391249; Wed, 21 Jan 2026 07:22:52 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= PODMain02222019; bh=5nHJf41RXT1tMCL6gQ3XhSzg2p56fwDdBHMlyWmoLfw=; b= qCPrb/Hok7fwSsmEU3lShucjO9uFeBdPkEwnVLZr1Q3CwWscFsxPb7qLX+vMjzXM RMhZrYBTgm/CN0WNs0PlK1MavXg1nZWP7keyBSkemNiKILDBNa8IIKk4q5v0Yn4N Uc9cMQ1HzLEE8915/ujPtLOnF2ociI0/qPoqkwZvrZLsxfFrvp4YYEPUTjahXLr7 B50eTx5R0P2N4MXslpPJWdGntjqpLdEZ1VtgeU+h+Puh7gJfJAK9wFT6jJz0GCZF oR3Y2aILhKtdeG3jaGN2BMBi4J0cCVoTgx09Qnj6/5DK27P41wt2WvboDmMNb80n UZTU2VG5c0nsD/XFMJAYoA== Received: from ph8pr06cu001.outbound.protection.outlook.com (mail-westus3azon11022073.outbound.protection.outlook.com [40.107.209.73]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 4br7qjvta9-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 21 Jan 2026 07:22:51 -0600 (CST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OUzhWXM3k/NkQbnVkN0CvN4Pnp/fL0QDgdCJH2xz7O6T9ypfhrKXzB1YfCmxdqvvwbG1WDXD2suumS7hFvFXg4jmMVDrCzNdj/felQ2vJNsQ/S63rVWQnxB48G0CJ0YB2jwDucrIDL9c+gq782Dl1pyta7VZ7c5fdDvqtFi06ZiAcQ5o7Z19IJYZAPGPXQNDoCmPmrqcKMQBUJtZIqaAQ/jfCiZ7kII4lLE1NLG0kvGGLqKSJh1OdZ1l24BGsZrqTHdQ7hpF/8cKTWrEL7bcFvdUml+4wt8AldIUq8tyD01hnon7ctWLHvlt0x5o6c/QzTE4wcFXErP0pXC2i+BdpQ== 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=5nHJf41RXT1tMCL6gQ3XhSzg2p56fwDdBHMlyWmoLfw=; b=ZRylKl1uq2O+8s8s4UUMn+QaaXTNaFE9ojz9PEvPNBqJh3ejEifK2sBokczCvkIKXPgaO8MZY+0G9FZwzNyHHcm2nPfx2FDJYLGVBsT31OfLPDBkix5Wbq+CVgJxUC09LKxInLhm8TTY4mYW9QmrSSH1b3mfEYIGcMzjdtdvj1hOM2h6mC4mj6fu1y6RsSUNvsTWqrlYIxQOGEOOMlt5BAjhH+6MAxn96Jlt+WSiNfIIfItxV+Y5IAPou53OtuPt+pfafX9bkh2NMgdQS9H9TkE8ogDEyRNLxNl8lzQiEPvDo7lNULqbfrGrLcgyctdJf38LC+9A6DUs5Uyiw0X5ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 84.19.233.75) smtp.rcpttodomain=cirrus.com smtp.mailfrom=opensource.cirrus.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=opensource.cirrus.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus4.onmicrosoft.com; s=selector2-cirrus4-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5nHJf41RXT1tMCL6gQ3XhSzg2p56fwDdBHMlyWmoLfw=; b=holwKwHTc8DTB+Yq5wTbILRHWaoLieBivyVI8FsXaMlF8/ZHmV481rN/N+edxBFqQGIEgApC5NojXJslmuduyHyr6ynOeeyfe2gWdqA+pzrbYwi/RkZwc2KRd9Qwk71EFnbrejYnDc5qx0fOMgKfzsM7S7LLJTBxJNJH5GJra1A= Received: from BL0PR01CA0035.prod.exchangelabs.com (2603:10b6:208:71::48) by SJ4PPFFBADB5175.namprd19.prod.outlook.com (2603:10b6:a0f:fc02::a63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9542.9; Wed, 21 Jan 2026 13:22:46 +0000 Received: from BL6PEPF0001AB71.namprd02.prod.outlook.com (2603:10b6:208:71:cafe::40) by BL0PR01CA0035.outlook.office365.com (2603:10b6:208:71::48) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.10 via Frontend Transport; Wed, 21 Jan 2026 13:20:37 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 84.19.233.75) smtp.mailfrom=opensource.cirrus.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=opensource.cirrus.com; Received-SPF: Fail (protection.outlook.com: domain of opensource.cirrus.com does not designate 84.19.233.75 as permitted sender) receiver=protection.outlook.com; client-ip=84.19.233.75; helo=edirelay1.ad.cirrus.com; Received: from edirelay1.ad.cirrus.com (84.19.233.75) by BL6PEPF0001AB71.mail.protection.outlook.com (10.167.242.164) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9542.4 via Frontend Transport; Wed, 21 Jan 2026 13:22:45 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id EC416406544; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) Received: from ediswws06.ad.cirrus.com (ediswws06.ad.cirrus.com [198.90.208.24]) by ediswmail9.ad.cirrus.com (Postfix) with ESMTPSA id DBE8A820257; Wed, 21 Jan 2026 13:22:43 +0000 (UTC) From: Richard Fitzgerald To: broonie@kernel.org Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH 5/5] ASoC: cs35l56: Add KUnit testing of cs35l56_set_fw_suffix() Date: Wed, 21 Jan 2026 13:22:43 +0000 Message-ID: <20260121132243.1256019-6-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260121132243.1256019-1-rf@opensource.cirrus.com> References: <20260121132243.1256019-1-rf@opensource.cirrus.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-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB71:EE_|SJ4PPFFBADB5175:EE_ X-MS-Office365-Filtering-Correlation-Id: c8f773dc-2d65-4d56-6129-08de58f02a1b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|61400799027|36860700013|54012099003; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KjYsSIRFgsj+BG/6ishIHT4uvgJL3bnv4WLF89FtaQG+eOvn0ZS3QNZjgLjB?= =?us-ascii?Q?wH6FwzTMP9GW03IndaDOgZ0IgYQ5SpI3iH9wY9Pz93rTmQVL/LKJFp1k6ggB?= =?us-ascii?Q?IscRU4lqAFIT4d8FQwMn76eVZdjrzx8ZX/H1m7qWf0f/1BeDQ8GrwmkZIaT0?= =?us-ascii?Q?Q0ji6ukWom7DPnV/dm3p27FXDwvlyDDf+w99okf8JAx+DwIbmqjvFrSdfi1+?= =?us-ascii?Q?y9MxiuDI51HuwbNMeFHII7y7x6S3GxIynzZMGujq4RzNQRpCN0CKgywkkQAM?= =?us-ascii?Q?oiT4xNywgCDOkPj0k53TbiZY7/rlBCsWElbsBcBUAEWVNMR7wgLOtiBLApXP?= =?us-ascii?Q?1gfdJLVHy/TK0Cazi7WrnG58ai5+VbJc9CAcg+ufGtkl0ZpD3s1e+z3JV6VN?= =?us-ascii?Q?aI1zWEbfJfTsNwUIC2oKgkQ1jLgR1fo+fGFeDyQsd3FCb+Ow+7z3YbCwqTQY?= =?us-ascii?Q?0h/vhP6T171zFfTuhJMqDJi6iLJVrRMKgfdrYm5MzyPJbE9Q4qKxIu3u400n?= =?us-ascii?Q?Urni7CrrNjK+PVYpltVqVi1tP2QLp8vr6Xw5JPt0mSlgbl4Is7hMhX0e820H?= =?us-ascii?Q?Kdnr68HB0r3OYLxPMoe6MH7SIIJXxksqVc7gWCgVOI1GuuNjcTlGXUCSbZ7s?= =?us-ascii?Q?47VDS8OCkgnw4RFbSI1HWOmNi7LsakZ7Pa2NwGlYHB5NWpQOtonP+m781mP4?= =?us-ascii?Q?lq/8LuygCfmQsSw8QLCeoaJ6l4qDcjlJLGUGI7f7TtH0UY/HuvsTNphR6li7?= =?us-ascii?Q?hXGl+Ez9J0O9nyfh8PkhphTmsJGXqC0RaTjWPi/wpusFnldkZ6iTOLvKxevB?= =?us-ascii?Q?Mma2p08X9wDLMf49CD9T4O0VC1oUkywNyAA9TNTcI+EcZX0cFDxNi7rpsqjb?= =?us-ascii?Q?NsQEyQjWpAtmzFPdQ2nJmGCWKQRBXFzqSJEYNkcCKi78DpW/qB5m+rsXWFs8?= =?us-ascii?Q?KBnDWaCt765R4MCUlpf8TYbRUn6zcRxMEgSJagzUsOv8l7Pajr8J17xX/0Sm?= =?us-ascii?Q?1gLNH1ULGRGnRgxl7xhpyePtBqRYTVzWCTpnrWjUWYIemMjzdz9wKbMsvBFJ?= =?us-ascii?Q?j/0uMgI9Mc2UmAUZY6qV0SW7B1V5tmseqGKHHZuchft7fFazkUU4o6eCJdVX?= =?us-ascii?Q?lyTKM8sPft7kw2x6iHcKsOI8ZknJLMO8+F5wJflGsmZ0xqhaBsXQHEqRjgAk?= =?us-ascii?Q?GLf5GtunhZd5hlGTy+V9sigcMQlof6P5SjcfZd1Jo+8xLBvcU18gYOJ8jgG9?= =?us-ascii?Q?unsTbevlRPfg5KRcANrcpn7RCXbNMTE3LoUeSQqaLrZMGOX6j9rlvd48rcS8?= =?us-ascii?Q?/A+3X5xhL6G3TumYFrILhbSBXDAQv63ye8OAa3LmM2FGzOyjgSx/UFkR6wEk?= =?us-ascii?Q?wK/nisGRedms3RN6VEbVp7v9dxBXWt/bysuNaVLbz3p1aL+xrk9l1Wun9pJ8?= =?us-ascii?Q?+I63klTJITACHY4lWG8xVPYDWD1h01feE04CjINA0VJoNZxlLFY4sOx/MI6r?= =?us-ascii?Q?jyW0nqKg3Kpf7E5+s2yUlLXyvmLEP//xPPzB5+iTWYIIKua9j0Cf1YmdmqD9?= =?us-ascii?Q?AghUKdbfM+DGIaQaz7uyIAlfpGmvzbg7Prl6AgPa5e18IMwFRoxup7tm33u1?= =?us-ascii?Q?3EvlsCq7cegiNLenuPduIy6mJrM9fCTTg9lTBGTlCtI3FEg1qg7oF2R/s0eI?= =?us-ascii?Q?DhtpPA=3D=3D?= X-Forefront-Antispam-Report: CIP:84.19.233.75;CTRY:GB;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edirelay1.ad.cirrus.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(82310400026)(61400799027)(36860700013)(54012099003);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2026 13:22:45.2961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8f773dc-2d65-4d56-6129-08de58f02a1b X-MS-Exchange-CrossTenant-Id: bec09025-e5bc-40d1-a355-8e955c307de8 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=bec09025-e5bc-40d1-a355-8e955c307de8;Ip=[84.19.233.75];Helo=[edirelay1.ad.cirrus.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-BL6PEPF0001AB71.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ4PPFFBADB5175 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTIxMDExMiBTYWx0ZWRfXw637ZpcRt0nK +OTgLRP2NEnLdqWRfV3yP202i0IFYIghnRJjG0gBg3wAvF3YeoN543hkKmJmexDwk7ZRf34VzeF LImLBFjd6zLqM3bpVg7tbgDSp0o1z9dyq81J1KrX0hYBX5FKCiy8H/79B5N6YbKuGWc6EQxAJTn r/XWGUyCBYSGoPbevT3OvgJ3i3VtFbBVsS1lXlFBq4+V/9z78rEurXHfsbfD7R0y5m6XXp6njwC /ILOVq5uJv8nnh4AzBm2ouzQnPe0WGlUDFIN8wRe1n8uQ8oE9SxyH5xokDmxHqJRbFBzWMMgrmc f1aq+Z2cCz0BLV/VNubwkfjqCemgi2vIr4RIl/3GLSf3p2kRL/zLugQxL0MirG+EqFWvrftYBfY S9Aeyzn84OG7mlbqzUBK18IUNELDfJa27oU40Zs6m2Ji9cOEXNYSzA97z/3d6nqQGfM3LyjTtdk RlI9FJ53m6pY3hzKGaA== X-Proofpoint-GUID: 0iSEJYWxAhMiIVYTbBHa1_906BfKxmgZ X-Authority-Analysis: v=2.4 cv=GrRPO01C c=1 sm=1 tr=0 ts=6970d32b cx=c_pps a=nTv9GYKPVLLC6uM4GBPpxQ==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=vUbySO9Y5rIA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=VkNPw1HP01LnGYTKEx00:22 a=w1d2syhTAAAA:8 a=wJ923TbUvRZeHHswlswA:9 X-Proofpoint-ORIG-GUID: 0iSEJYWxAhMiIVYTbBHa1_906BfKxmgZ X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add a new KUnit test for testing the creation of firmware name qualifiers in the cs35l56 driver. The initial set of test cases are for cs35l56_set_fw_suffix(). Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/Kconfig | 13 ++ sound/soc/codecs/Makefile | 2 + sound/soc/codecs/cs-amp-lib.c | 3 + sound/soc/codecs/cs35l56-test.c | 365 ++++++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.c | 5 +- sound/soc/codecs/cs35l56.h | 4 + 6 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 sound/soc/codecs/cs35l56-test.c diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index 21d5b79f079d..d09de0ff5f22 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -933,6 +933,19 @@ config SND_SOC_CS35L56_CAL_SET_CTRL On most platforms this is not needed. =20 If unsure select "N". + +config SND_SOC_CS35L56_TEST + tristate "KUnit test for Cirrus Logic cs35l56 driver" if !KUNIT_ALL_TESTS + depends on SND_SOC_CS35L56 && KUNIT + default KUNIT_ALL_TESTS + select SND_SOC_CS_AMP_LIB_TEST_HOOKS + help + This builds KUnit tests for the Cirrus Logic cs35l56 + codec driver. + For more information on KUnit and unit tests in general, + please refer to the KUnit documentation in + Documentation/dev-tools/kunit/. + If in doubt, say "N". endmenu =20 config SND_SOC_CS40L50 diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index a6406bc907a9..c3568de5e0c9 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile @@ -81,6 +81,7 @@ snd-soc-cs35l56-shared-y :=3D cs35l56-shared.o snd-soc-cs35l56-i2c-y :=3D cs35l56-i2c.o snd-soc-cs35l56-spi-y :=3D cs35l56-spi.o snd-soc-cs35l56-sdw-y :=3D cs35l56-sdw.o +snd-soc-cs35l56-test-y :=3D cs35l56-test.o snd-soc-cs40l50-y :=3D cs40l50-codec.o snd-soc-cs42l42-y :=3D cs42l42.o snd-soc-cs42l42-i2c-y :=3D cs42l42-i2c.o @@ -516,6 +517,7 @@ obj-$(CONFIG_SND_SOC_CS35L56_SHARED) +=3D snd-soc-cs35l= 56-shared.o obj-$(CONFIG_SND_SOC_CS35L56_I2C) +=3D snd-soc-cs35l56-i2c.o obj-$(CONFIG_SND_SOC_CS35L56_SPI) +=3D snd-soc-cs35l56-spi.o obj-$(CONFIG_SND_SOC_CS35L56_SDW) +=3D snd-soc-cs35l56-sdw.o +obj-$(CONFIG_SND_SOC_CS35L56_TEST) +=3D snd-soc-cs35l56-test.o obj-$(CONFIG_SND_SOC_CS40L50) +=3D snd-soc-cs40l50.o obj-$(CONFIG_SND_SOC_CS42L42_CORE) +=3D snd-soc-cs42l42.o obj-$(CONFIG_SND_SOC_CS42L42) +=3D snd-soc-cs42l42-i2c.o diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index f8c7f594d54a..8b131975143d 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -806,6 +806,9 @@ const char *cs_amp_devm_get_vendor_specific_variant_id(= struct device *dev, int ssid_vendor, int ssid_device) { + KUNIT_STATIC_STUB_REDIRECT(cs_amp_devm_get_vendor_specific_variant_id, + dev, ssid_vendor, ssid_device); + if ((ssid_vendor =3D=3D PCI_VENDOR_ID_DELL) || (ssid_vendor < 0)) return cs_amp_devm_get_dell_ssidex(dev, ssid_vendor, ssid_device); =20 diff --git a/sound/soc/codecs/cs35l56-test.c b/sound/soc/codecs/cs35l56-tes= t.c new file mode 100644 index 000000000000..66d772d7b982 --- /dev/null +++ b/sound/soc/codecs/cs35l56-test.c @@ -0,0 +1,365 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// KUnit test for the Cirrus Logic cs35l56 driver. +// +// Copyright (C) 2026 Cirrus Logic, Inc. and +// Cirrus Logic International Semiconductor Ltd. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "cs35l56.h" + +KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destr= oy, + struct faux_device *) + +struct cs35l56_test_priv { + struct faux_device *amp_dev; + struct cs35l56_private *cs35l56_priv; + + const char *ssidexv2; +}; + +struct cs35l56_test_param { + u8 type; + u8 rev; +}; + +static const char *cs35l56_test_devm_get_vendor_specific_variant_id_none(s= truct device *dev, + int ssid_vendor, + int ssid_device) +{ + return ERR_PTR(-ENOENT); +} + +static void cs35l56_test_l56_b0_suffix_sdw(struct kunit *test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set device type info */ + cs35l56->base.type =3D 0x56; + cs35l56->base.rev =3D 0xb0; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + /* Set SoundWire link and UID number */ + cs35l56->sdw_link_num =3D 1; + cs35l56->sdw_unique_id =3D 5; + + kunit_activate_static_stub(test, + cs35l56_test_devm_get_vendor_specific_variant_id_none, + cs_amp_devm_get_vendor_specific_variant_id); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Priority suffix should be the legacy ALSA prefix */ + KUNIT_EXPECT_STREQ(test, cs35l56->dsp.fwf_suffix, "AMP1"); + + /* Fallback suffix should be the new SoundWire ID */ + KUNIT_EXPECT_STREQ(test, cs35l56->fallback_fw_suffix, "l1u5"); +} + +static void cs35l56_test_suffix_sdw(struct kunit *test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + /* Set SoundWire link and UID number */ + cs35l56->sdw_link_num =3D 1; + cs35l56->sdw_unique_id =3D 5; + + kunit_activate_static_stub(test, + cs35l56_test_devm_get_vendor_specific_variant_id_none, + cs_amp_devm_get_vendor_specific_variant_id); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Suffix should be the SoundWire ID without a fallback */ + KUNIT_EXPECT_STREQ(test, cs35l56->dsp.fwf_suffix, "l1u5"); + KUNIT_EXPECT_NULL(test, cs35l56->fallback_fw_suffix); +} + +static void cs35l56_test_suffix_i2cspi(struct kunit *test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + kunit_activate_static_stub(test, + cs35l56_test_devm_get_vendor_specific_variant_id_none, + cs_amp_devm_get_vendor_specific_variant_id); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Suffix strings should not be set: use default wm_adsp suffixing */ + KUNIT_EXPECT_NULL(test, cs35l56->dsp.fwf_suffix); + KUNIT_EXPECT_NULL(test, cs35l56->fallback_fw_suffix); +} + +static efi_status_t cs35l56_test_get_efi_ssidexv2(efi_char16_t *name, + efi_guid_t *guid, + u32 *returned_attr, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + struct cs35l56_test_priv *priv =3D test->priv; + unsigned int len; + + KUNIT_ASSERT_NOT_NULL(test, priv->ssidexv2); + len =3D strlen(priv->ssidexv2); + + if (*size < len) { + *size =3D len; + return EFI_BUFFER_TOO_SMALL; + } + + KUNIT_ASSERT_NOT_NULL(test, buf); + memcpy(buf, priv->ssidexv2, len); + + return EFI_SUCCESS; +} + +static void cs35l56_test_ssidexv2_suffix_sdw(struct kunit *test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + /* Set SoundWire link and UID number */ + cs35l56->sdw_link_num =3D 1; + cs35l56->sdw_unique_id =3D 5; + + /* Set a SSID to enable lookup of SSIDExV2 */ + snd_soc_card_set_pci_ssid(cs35l56->component->card, PCI_VENDOR_ID_DELL, 0= x1234); + + priv->ssidexv2 =3D "10281234_01_BB_CC"; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs35l56_test_get_efi_ssidexv2); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Priority suffix should be the SSIDExV2 string with SoundWire ID */ + KUNIT_EXPECT_STREQ(test, cs35l56->dsp.fwf_suffix, "01-l1u5"); + + /* Fallback suffix should be the SoundWireID */ + KUNIT_EXPECT_STREQ(test, cs35l56->fallback_fw_suffix, "l1u5"); +} + +static void cs35l56_test_ssidexv2_suffix_i2cspi(struct kunit *test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + /* Set a SSID to enable lookup of SSIDExV2 */ + snd_soc_card_set_pci_ssid(cs35l56->component->card, PCI_VENDOR_ID_DELL, 0= x1234); + + priv->ssidexv2 =3D "10281234_01_BB_CC"; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs35l56_test_get_efi_ssidexv2); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Priority suffix should be the SSIDExV2 string with ALSA name prefix */ + KUNIT_EXPECT_STREQ(test, cs35l56->dsp.fwf_suffix, "01-AMP1"); + + /* Fallback suffix should be the ALSA name prefix */ + KUNIT_EXPECT_STREQ(test, cs35l56->fallback_fw_suffix, "AMP1"); +} + +/* + * CS35L56 B0 SoundWire should ignore any SSIDExV2 suffix. It isn't needed + * on any products with B0 silicon and would interfere with the fallback + * to legacy naming convention for early B0-based laptops. + */ +static void cs35l56_test_l56_b0_ssidexv2_ignored_suffix_sdw(struct kunit *= test) +{ + struct cs35l56_test_priv *priv =3D test->priv; + struct cs35l56_private *cs35l56 =3D priv->cs35l56_priv; + + /* Set device type info */ + cs35l56->base.type =3D 0x56; + cs35l56->base.rev =3D 0xb0; + + /* Set the ALSA name prefix */ + cs35l56->component->name_prefix =3D "AMP1"; + + /* Set SoundWire link and UID number */ + cs35l56->sdw_link_num =3D 1; + cs35l56->sdw_unique_id =3D 5; + + /* Set a SSID to enable lookup of SSIDExV2 */ + snd_soc_card_set_pci_ssid(cs35l56->component->card, PCI_VENDOR_ID_DELL, 0= x1234); + + priv->ssidexv2 =3D "10281234_01_BB_CC"; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs35l56_test_get_efi_ssidexv2); + + KUNIT_EXPECT_EQ(test, 0, cs35l56_set_fw_suffix(cs35l56)); + + /* Priority suffix should be the legacy ALSA prefix */ + KUNIT_EXPECT_STREQ(test, cs35l56->dsp.fwf_suffix, "AMP1"); + + /* Fallback suffix should be the new SoundWire ID */ + KUNIT_EXPECT_STREQ(test, cs35l56->fallback_fw_suffix, "l1u5"); +} + +static int cs35l56_test_case_init_common(struct kunit *test) +{ + struct cs35l56_test_priv *priv; + const struct cs35l56_test_param *param =3D test->param_value; + struct cs35l56_private *cs35l56; + + KUNIT_ASSERT_NOT_NULL(test, cs_amp_test_hooks); + + priv =3D kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + test->priv =3D priv; + + /* Create dummy amp driver dev */ + priv->amp_dev =3D faux_device_create("cs35l56_test_drv", NULL, NULL); + KUNIT_ASSERT_NOT_NULL(test, priv->amp_dev); + KUNIT_ASSERT_EQ(test, 0, + kunit_add_action_or_reset(test, + faux_device_destroy_wrapper, + priv->amp_dev)); + + /* Construct minimal set of driver structs */ + priv->cs35l56_priv =3D kunit_kzalloc(test, sizeof(*priv->cs35l56_priv), G= FP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, priv->cs35l56_priv); + cs35l56 =3D priv->cs35l56_priv; + cs35l56->base.dev =3D &priv->amp_dev->dev; + + cs35l56->component =3D kunit_kzalloc(test, sizeof(*cs35l56->component), G= FP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, cs35l56->component); + cs35l56->component->dev =3D cs35l56->base.dev; + + cs35l56->component->card =3D kunit_kzalloc(test, sizeof(*cs35l56->compone= nt->card), + GFP_KERNEL); + KUNIT_ASSERT_NOT_NULL(test, cs35l56->component->card); + + if (param) { + cs35l56->base.type =3D param->type; + cs35l56->base.rev =3D param->rev; + } + + return 0; +} + +static int cs35l56_test_case_init_soundwire(struct kunit *test) +{ + struct cs35l56_test_priv *priv; + struct cs35l56_private *cs35l56; + int ret; + + ret =3D cs35l56_test_case_init_common(test); + if (ret) + return ret; + + priv =3D test->priv; + cs35l56 =3D priv->cs35l56_priv; + + /* Dummy to indicate this is Soundwire */ + cs35l56->sdw_peripheral =3D kunit_kzalloc(test, sizeof(*cs35l56->sdw_peri= pheral), + GFP_KERNEL); + if (!cs35l56->sdw_peripheral) + return -ENOMEM; + + + return 0; +} + +static void cs35l56_test_type_rev_param_desc(const struct cs35l56_test_par= am *param, + char *desc) +{ + snprintf(desc, KUNIT_PARAM_DESC_SIZE, "type: %02x rev: %02x", + param->type, param->rev); +} + +static const struct cs35l56_test_param cs35l56_test_type_rev_ex_b0_param_c= ases[] =3D { + { .type =3D 0x56, .rev =3D 0xb2 }, + { .type =3D 0x57, .rev =3D 0xb2 }, + { .type =3D 0x63, .rev =3D 0xa1 }, +}; +KUNIT_ARRAY_PARAM(cs35l56_test_type_rev_ex_b0, cs35l56_test_type_rev_ex_b0= _param_cases, + cs35l56_test_type_rev_param_desc); + + +static const struct cs35l56_test_param cs35l56_test_type_rev_all_param_cas= es[] =3D { + { .type =3D 0x56, .rev =3D 0xb0 }, + { .type =3D 0x56, .rev =3D 0xb2 }, + { .type =3D 0x57, .rev =3D 0xb2 }, + { .type =3D 0x63, .rev =3D 0xa1 }, +}; +KUNIT_ARRAY_PARAM(cs35l56_test_type_rev_all, cs35l56_test_type_rev_all_par= am_cases, + cs35l56_test_type_rev_param_desc); + +static struct kunit_case cs35l56_test_cases_soundwire[] =3D { + KUNIT_CASE(cs35l56_test_l56_b0_suffix_sdw), + KUNIT_CASE_PARAM(cs35l56_test_suffix_sdw, cs35l56_test_type_rev_ex_b0_gen= _params), + KUNIT_CASE_PARAM(cs35l56_test_ssidexv2_suffix_sdw, + cs35l56_test_type_rev_ex_b0_gen_params), + KUNIT_CASE(cs35l56_test_l56_b0_ssidexv2_ignored_suffix_sdw), + + { } /* terminator */ +}; + +static struct kunit_case cs35l56_test_cases_not_soundwire[] =3D { + KUNIT_CASE_PARAM(cs35l56_test_suffix_i2cspi, cs35l56_test_type_rev_all_ge= n_params), + KUNIT_CASE_PARAM(cs35l56_test_ssidexv2_suffix_i2cspi, + cs35l56_test_type_rev_all_gen_params), + + { } /* terminator */ +}; + +static struct kunit_suite cs35l56_test_suite_soundwire =3D { + .name =3D "snd-soc-cs35l56-test-soundwire", + .init =3D cs35l56_test_case_init_soundwire, + .test_cases =3D cs35l56_test_cases_soundwire, +}; + +static struct kunit_suite cs35l56_test_suite_not_soundwire =3D { + .name =3D "snd-soc-cs35l56-test-not-soundwire", + .init =3D cs35l56_test_case_init_common, + .test_cases =3D cs35l56_test_cases_not_soundwire, +}; + +kunit_test_suites( + &cs35l56_test_suite_soundwire, + &cs35l56_test_suite_not_soundwire, +); + +MODULE_IMPORT_NS("SND_SOC_CS_AMP_LIB"); +MODULE_DESCRIPTION("KUnit test for Cirrus Logic cs35l56 codec driver"); +MODULE_AUTHOR("Richard Fitzgerald "); +MODULE_LICENSE("GPL"); diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index abea782bcd3f..31dd2f7b2858 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -5,6 +5,8 @@ // Copyright (C) 2023 Cirrus Logic, Inc. and // Cirrus Logic International Semiconductor Ltd. =20 +#include +#include #include #include #include @@ -1107,7 +1109,7 @@ static const struct snd_kcontrol_new cs35l56_cal_data= _restore_controls[] =3D { SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE), }; =20 -static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) +VISIBLE_IF_KUNIT int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56) { unsigned short vendor, device; const char *vendor_id; @@ -1175,6 +1177,7 @@ static int cs35l56_set_fw_suffix(struct cs35l56_priva= te *cs35l56) =20 return 0; } +EXPORT_SYMBOL_IF_KUNIT(cs35l56_set_fw_suffix); =20 static int cs35l56_component_probe(struct snd_soc_component *component) { diff --git a/sound/soc/codecs/cs35l56.h b/sound/soc/codecs/cs35l56.h index 4c59f92f3206..7187885a13c1 100644 --- a/sound/soc/codecs/cs35l56.h +++ b/sound/soc/codecs/cs35l56.h @@ -74,4 +74,8 @@ int cs35l56_common_probe(struct cs35l56_private *cs35l56); int cs35l56_init(struct cs35l56_private *cs35l56); void cs35l56_remove(struct cs35l56_private *cs35l56); =20 +#if IS_ENABLED(CONFIG_KUNIT) +int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56); +#endif + #endif /* ifndef CS35L56_H */ --=20 2.47.3