From nobody Wed Sep 10 01:55:24 2025 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 C6D7714884C; Tue, 9 Sep 2025 11:30:48 +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=1757417450; cv=fail; b=jIyFFGsEWvwFF/lcOChu+v13gXFx1lQzEtkHuQW6gqxZwU2V0xMNgf6L1AbUr8QvmNf1+7pCHv2qMY/riM3uYgv4la5hIY8zNUSlXSY9dwQLQgRCXOkktWc7zQTGLNYDC5gsFNvwnJq5Dx7gyGiEQIKcB15xC4xODSfGD11tG24= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417450; c=relaxed/simple; bh=h4asHsCQOd2ufeDF7SvrnC4iax+TSSl8XbpivmHl4CY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=NomD7Bnvhu3qy4gshNaMH7I258bUmhJEkfsI57D3qTT1ipPnK3fVCKaMum3Uqk4uH67Hmi9Et8mI5Z60tHPl4sVST3osSodtzgxhnX56XqFESMSWXhkboyB0KoA/JrXpwoKmT9YK3oE1ui2z8LnRTjyvav0165iPMJilZi4bbls= 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=FBIpmeGu; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=UrQeIS34; 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="FBIpmeGu"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="UrQeIS34" 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 588KSv8w1252531; Tue, 9 Sep 2025 06:30:45 -0500 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=UPXyvMD/Dhb+w7dbOEt9OnP0AsfSESzw2yqkmnbfxyA=; b= FBIpmeGux/3F8f/jwAXVTydsa7jRBgHuyPw4cLAoVbu23h6x+43DcdTwKctsTM4i htHVRfvCMPSIHtABfrgs/yniB7quiaV31WabekEmG6YnB9FlfZP1Fy7UtZUqMN9P Mxenuo91yza4bJ6EK7IgC0cG+QnY23EdhWvc/3ISmUhzBZgzwSa9aAkOnEJ5US45 bSgQHkdN3A8Yc0v2rhqPD6Zndg4052EI9KJsmS8ABKFeUXEdh/w1wVaUhRALRx2b XPSTGOkWENYNeYrwVMMhZJ2PwpG7Zwbf7jqk8eHN4rpCi6gENKOG5gzkZQgGyt/h Ob+bsY4I8DVCM8r6ht0iFg== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2124.outbound.protection.outlook.com [40.107.237.124]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 49227r91wn-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:45 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SxFiLWPAnqP1uPqcbf8zlLGUahyUWo79LtlhoN1fFuSngRPRb93HlLxFt2Tlu/D8XVS2eVbLkL6KVqrOO6sxYBOj1Vlo5XQjHgPYXwf6h58H2lAODyNaE5bsr/zjLqdjqtUmeuw9ifD0zrRzQR/z9NVMPnHoTqh/U6hc45wAMw05lC5nHADq4wOh8kfExdrhXCWVLHnjP9t4NW2IUtzuJxtHXKfYiZwQ/4X9iTlbp9cI+xztK1twHt77BdUMW0zWu/a7jbse4HGgJDLeon9FJKRSVU+/Z5ZO9n4by/wT9yOA80BUyfOmPOdtvKSkoT74CdDy+TRDGVlz7OcARAL0kA== 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=UPXyvMD/Dhb+w7dbOEt9OnP0AsfSESzw2yqkmnbfxyA=; b=CRGtpDqiemAlBzF5z/4O31lP02VuVP81T89p0veFoycz1PPrRCbj2ABrEmZLVnyy4p04RYhdfMWWn4BbUVsYUjRa/W9IGeAZ/B3uoLZs8qVTnIE6tv9srCOE8b/gg7wDQxFKqWy0GMMh5J3ONS47JWFdadG4LFki20VgFSTaOFfSGeHMaVm26xVwcJfFXoQG2RIz3wcRxfQ5YmUnoZFtHuRCADYmSHHgIstVI8DDSZx3+fIWJ9l5zq/CNC6mA3lvfaWSa5c6L6RFQVyaqQ+sEhCfllwe9TFJPSfoRT6hMQwtYuNok164aURwHr+wNyHG+uAJevFwKbwk+qk97UbO5Q== 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=UPXyvMD/Dhb+w7dbOEt9OnP0AsfSESzw2yqkmnbfxyA=; b=UrQeIS34PTmPmUHTP8T6kTYulnNPr0qfWArw/V23HwVJO97l1Jd4BHOd82KChHBOcOro4V7Z8ZQAjzXDsdlQ86LyWg+MWwTruZ5Y3vUBTHD4cr5LwPJGnEJ53RvEJ4LyZ8+oB8Y8R8P9HLSuR1OfF6RWhP6u7wSwaA5GYAvNFQo= Received: from BY5PR17CA0067.namprd17.prod.outlook.com (2603:10b6:a03:167::44) by MW4PR19MB6958.namprd19.prod.outlook.com (2603:10b6:303:220::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:42 +0000 Received: from SJ1PEPF000026C8.namprd04.prod.outlook.com (2603:10b6:a03:167:cafe::b7) by BY5PR17CA0067.outlook.office365.com (2603:10b6:a03:167::44) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9094.17 via Frontend Transport; Tue, 9 Sep 2025 11:30:38 +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 SJ1PEPF000026C8.mail.protection.outlook.com (10.167.244.105) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30:42 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id 2CF9D406541; Tue, 9 Sep 2025 11:30:40 +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 1479582025A; Tue, 9 Sep 2025 11:30:40 +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 v2 1/6] ASoC: cs-amp-lib: Rename defines for Cirrus Logic EFI Date: Tue, 9 Sep 2025 12:30:34 +0100 Message-Id: <20250909113039.922065-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: SJ1PEPF000026C8:EE_|MW4PR19MB6958:EE_ X-MS-Office365-Filtering-Correlation-Id: 14643945-6617-476b-b79c-08ddef944f7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|61400799027|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?AVqN797IgZnmW5U7qAyHlLCk1Ga+WwUt7aWR5Ve51bphjyuTrpLYWtCgiESH?= =?us-ascii?Q?dDGUlrsMpOQO5OMn6KuP/gRfSrqjDAWTZgKx6W0G5KwkZMfpepqBrKSY6mwQ?= =?us-ascii?Q?vWrDlhZbEI9ngXKJr6jiFUPSLd6aKcV2gFherdVgAPZhTedTTGffxhNIw47n?= =?us-ascii?Q?kGVnwRRoWQVFAehs8LRaX+Qw64Fm76pR/XPSMg+9Xxl8KCS3DNC2BfYqC07X?= =?us-ascii?Q?bdpivPtPVpqlDaKsY2Jirap/A2zT7B9o6izR+mDvDzIaPowDGGCsKgQwneVS?= =?us-ascii?Q?r10wXC0K4UJZODJLH5GXtDkd4gjgETyiAwph6dg7Ub3lXFC3BqrXYErj4fXk?= =?us-ascii?Q?Xm5MhjqhpSXqxenp1GErfzBRREQFqYA7pbphNwB/F+fL15Rd+YPE6TQn9DfV?= =?us-ascii?Q?mmVybWW//HFs7KET0B7YwXUULHJl4uoRxJOKdn6NuFY/OKJAocCNUNY8JcjO?= =?us-ascii?Q?EevOIKXlOEZrmg9IbdWysNWzQO8Lz9yaQCdW31PCoPFSRG+TT41FvuX0MGq4?= =?us-ascii?Q?YLVcsBMkAlb4Vdz6ECoE6Bz543FGyKTnM3Lb9zF+OvdayEV6+OnrWhq92Mnb?= =?us-ascii?Q?RL+yAu93mGGwwfYXBqG4c7UvRr7sY5BIBhh+y0/FxlCFjO/N6P9qV5uOCkIM?= =?us-ascii?Q?/q7M4/Mj1niZ1gguYugNgQyN7VV/m9Z7pFcIlKEaFphArdZFNqQ0dMBq1ykC?= =?us-ascii?Q?Y57ZO3POVusqFiO95QGA/ZnyOAqwA0wRIN3hTy+iWxYveF/3MpYajwXnot0g?= =?us-ascii?Q?yCYA+eE0Q8mFFVbGOsNyHsbhCMHo8WXR1APpviY/Dda5vNz6bHljguzumeke?= =?us-ascii?Q?scIm5N3EgxjaqfWmh9K3BnOR8esWKTg48FC4fWb7xVqJx6S074nj23zdUloU?= =?us-ascii?Q?JOlLnNlRDoLjoPKD9S+LZJ181mdEfhSGfDAwJH3iSegDK1GvMtjlPm+Y7aI1?= =?us-ascii?Q?0Rdl8bRILh2Hg3+x3gL+R7qkurgA5tprVXn0Y31vJX8n1ry6weUnCAli/1GG?= =?us-ascii?Q?USn9YC62NuNPj7GmPEZhrkgrp2HPoJf8SzSCCuN5TcGXotpu3zO8jyZDv1uD?= =?us-ascii?Q?c/hD0WPUaKhrvNILjG0+ZIiNYMrbios9j+VGNVRMj3qgP7y2bVDmpX7C+89o?= =?us-ascii?Q?hEJwjhaZyg9IDFiwgbn7MOP1zLdD4FsVXOWUSfhZY72vOPF0DIhXKO1CtX09?= =?us-ascii?Q?0ry0tUfa0EL8W68dWD2MV1qZ1QMlW4NjLwkxy1kz21g5SsmlJ+vkFA+aECJa?= =?us-ascii?Q?tZ2XOxCu/q18o8ELVlbdQDJdxPPSniXnqh3Wu+FVSBi7Pli686nVbv9nnQgQ?= =?us-ascii?Q?kapjZmPa72ntQURcJjv314/KazQld9zUtGILTon4I3EpLsI6cc63AGVWRzbH?= =?us-ascii?Q?awR8BhPJyJEkyHIZoUQahNLe9Dq5xW6Aru6bMo/2xnJ0o9pqNP1f+J+Hfyfh?= =?us-ascii?Q?bM4x04IHDAZqCxtNKiC/ZO0Dbg3YKxDeCkKqdQO6ukPXtkV2GEkezxlFS87i?= =?us-ascii?Q?W2P9SykHu145ByZ43UqTG06z24nKUh1AEd08?= 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)(82310400026)(376014)(61400799027)(36860700013);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:42.1212 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 14643945-6617-476b-b79c-08ddef944f7f 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-SJ1PEPF000026C8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR19MB6958 X-Authority-Analysis: v=2.4 cv=f+FIBPyM c=1 sm=1 tr=0 ts=68c00fe5 cx=c_pps a=Bx4JecnaPChsX23rVfvkjQ==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=uB3EzRcOJay2ftjxBbYA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfX0JOh0nb+0lg0 6qYB/h1N/5PEzH4KxAPZCuBs6RnBONNST1dajoVOP/ficNyQ4YEMFESLIqTDNKAu/DATamL6973 nMW8l9d/jmQXva+itrrBWP9wkQuM4yIt8ADQNZXN5++3nPeEDxTEdsCsuQ6TZuVsrCPmoA1ERHA SZ4mx0aeMFYbz5HaqdFertAI6umywsOMzR3R9FEDbYuAaD/VEYQpFGZJz1jyTBmoYQtd+w9LdVy KyqS/spyq4UzJ2D+3mcch9jvWhs669ahBOotVPuWpsxBjsPBFEEoqJAfVmU021CZDE3tfydRiEQ 1TwaDhTpmR6mW7Mbt4zvKh3zEW2y384WWIGLxBBT786TF8V6ghDfXx+7g/Scgg= X-Proofpoint-GUID: cuNeUkHI6xEpZ5XCf0cCXfoR5xafYykO X-Proofpoint-ORIG-GUID: cuNeUkHI6xEpZ5XCf0cCXfoR5xafYykO X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Rename: CS_AMP_CAL_NAME =3D> CIRRUS_LOGIC_CALIBRATION_EFI_NAME CS_AMP_CAL_GUID =3D> CIRRUS_LOGIC_CALIBRATION_EFI_GUID This is to clarify that these are specific to Cirrus Logic, especially the GUID. As defined by the UEFI specification the GUID is a vendor identifier, not an EFI variable identifier. There has been some misunderstanding of the purpose of these, which has led to the Cirrus Logic GUID value being copied and used for other vendor's EFI variables. It is rather strange to have data from another vendor marked with the vendor GUID for Cirrus Logic. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs-amp-lib.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index 808e67c90f7c..b1530e7c75e8 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -16,11 +16,10 @@ #include #include =20 -#define CS_AMP_CAL_GUID \ +#define CIRRUS_LOGIC_CALIBRATION_EFI_NAME L"CirrusSmartAmpCalibrationData" +#define CIRRUS_LOGIC_CALIBRATION_EFI_GUID \ EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, = 0x5d, 0xb3) =20 -#define CS_AMP_CAL_NAME L"CirrusSmartAmpCalibrationData" - static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, const char *ctl_name, u32 val) @@ -124,7 +123,9 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_b= uffer(struct device *dev) int ret; =20 /* Get real size of UEFI variable */ - status =3D cs_amp_get_efi_variable(CS_AMP_CAL_NAME, &CS_AMP_CAL_GUID, &da= ta_size, NULL); + status =3D cs_amp_get_efi_variable(CIRRUS_LOGIC_CALIBRATION_EFI_NAME, + &CIRRUS_LOGIC_CALIBRATION_EFI_GUID, + &data_size, NULL); if (status !=3D EFI_BUFFER_TOO_SMALL) return ERR_PTR(-ENOENT); =20 @@ -138,7 +139,9 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_b= uffer(struct device *dev) if (!data) return ERR_PTR(-ENOMEM); =20 - status =3D cs_amp_get_efi_variable(CS_AMP_CAL_NAME, &CS_AMP_CAL_GUID, &da= ta_size, data); + status =3D cs_amp_get_efi_variable(CIRRUS_LOGIC_CALIBRATION_EFI_NAME, + &CIRRUS_LOGIC_CALIBRATION_EFI_GUID, + &data_size, data); if (status !=3D EFI_SUCCESS) { ret =3D -EINVAL; goto err; --=20 2.39.5 From nobody Wed Sep 10 01:55:24 2025 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 3B22D31B832; Tue, 9 Sep 2025 11:30:50 +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=1757417454; cv=fail; b=HI+uFy0BeihilpxRBRQ28mct6psUYnhz6/vga15STDN2o9nOQUS1gJxRdyHNBfid23KS5mNanhxtrgjgZl8Aqqdj74PB79Mkard9ArydZyD3ScvfMnDX4YDtPILULo6volv6qQoDosfowS+/Bw9PdLrQeB6kGknD6XEklG+s9NE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417454; c=relaxed/simple; bh=Fk/a1g+io6oCMJJhpgA9T5RQsVgVkoIlfN9T5kxfpP4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=FSAMlocNSkrgqrz2GLk1b5EiwNiNCwIHIq5LqgKsC2/+VeN6vi2JCex+S3enhrmTmz+yyhsD+RqmfRBY2muwc8wR/298VPLLLI4JRyNSSCg6K3dmDN8qUyM0S8/y0jp9ejTBXbVqAp0AnS9f3wxkLCkFadMu1iWcyKV7KLCX1tw= 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=nEHM6SEQ; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=VH2NN3ll; 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="nEHM6SEQ"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="VH2NN3ll" 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 588KT8Pg3358403; Tue, 9 Sep 2025 06:30:47 -0500 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=APpcDRBfdcj4G2DWvBwtmFIgJYnpYz7AKZvkufUY1mI=; b= nEHM6SEQJgLzLXwoCBWWJCgNqaLnLE81wQboXkII0pUzIoORSRlHNIQlhI1Bm1xs /625zy6ci9MM+eGs9CbW6aWTyn9gw5cDM0QNjyt+VRoENyacmqoymzkpNTGqk9rP m5i2CEMukwwMmNmyRVyO9Ms7KJ0cLu3b3/YCHIezqDlcKqp088LbCMsQCKJq2L0d muZ+zZLfm/TtkKdci3jDWuIjDP84WvH/Yab9JoRygeY+VX9LBHOAVCXhE6d9AjzO k+mG+odde3v8ZrgX92mtZpt3g1l3uW8ntTOa7jfISMvMe8/cxAd678rsRkhLBx4A rfjbNDMri/hqF9dq0m2epA== Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10on2110.outbound.protection.outlook.com [40.107.93.110]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 491upq9k40-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:47 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m611tdOZSI1Lh1k0iEFP4K6tflASz6C+gRbrJpA1ypw64LjEO+W0Zvm4rh8z53OAx4W6qH+ZF7oHT45mwLOeMPBS2n8IpdGaEnkVXg/8OsjCiApA4qKIKSS1A2It9CNZVPbKbLewGHjQ86aaqQHdVNzZnuSQ/J2Fk2fP58wnDTuGeuYJ5SuINeSMrVFeesVrYSRthGNmxksTxcLc5rmUQT6WQY5yvXFcD/ZJy4e3hUAMTAC5BYRrZNkt+s0rLi8gz3JAvXHv+Livpos4KWS/8R2n8Ig5I9faoWxQLQBZwPt2H9/pGhWYWPl4ul474hVqhmdTnTAx7lBUTiYlXeecuQ== 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=APpcDRBfdcj4G2DWvBwtmFIgJYnpYz7AKZvkufUY1mI=; b=GAveiGIaFEsmyF5ue8vADrzSES4gPgo5Og39nmraSxeiX6PUQuCo/wNcuWxFOfrj3ptY4hNaP6UqH1GtvnrUd3OYEUYQmncjX7uhdDW0J5P3K8iTtVvbRntrp3Bx2MAV7lA5Jnvetprs9WSAWRMjGiGxPoGK6BBTnW+4vSZIeGqGBo5npuzJ+LXB9nIjFTM7Y6g9vM0Dx34sYrLBMzLIMa4u8menWbdqk3Oi5zdgoK3C34Ta8cnVSTAwgwujIkTWTImUtdILq8NRUrvftUxJGWjYitKifced51CVhuG43lm5Fk8FM5A4sXA/ZvkHe+AFaMipq9lMlqtE0R1nqYKK3w== 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=APpcDRBfdcj4G2DWvBwtmFIgJYnpYz7AKZvkufUY1mI=; b=VH2NN3llD2zuWP3z/9wZTg2HB3SHHJ+hpXxu1yBZ1Jk7xWhJugC82HZwTEvTQQj7m8RM7R5XM883eYTryN0cRCPLayC93rXA3yviAWb6TuRhH0swRA6GO5lD9K5fxWmyrgmAX0NeMrlELA5XnVh7YCNwdXGnCviUtlroVG9r16Q= Received: from SJ0PR13CA0044.namprd13.prod.outlook.com (2603:10b6:a03:2c2::19) by BY5PR19MB4727.namprd19.prod.outlook.com (2603:10b6:a03:1d8::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:44 +0000 Received: from SJ5PEPF000001D2.namprd05.prod.outlook.com (2603:10b6:a03:2c2:cafe::3f) by SJ0PR13CA0044.outlook.office365.com (2603:10b6:a03:2c2::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30:09 +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 SJ5PEPF000001D2.mail.protection.outlook.com (10.167.242.54) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30:42 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id 371EC406545; Tue, 9 Sep 2025 11:30:40 +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 2281782026B; Tue, 9 Sep 2025 11:30:40 +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 v2 2/6] ASoC: cs-amp-lib: Add handling for Lenovo and HP UEFI speaker ID Date: Tue, 9 Sep 2025 12:30:35 +0100 Message-Id: <20250909113039.922065-3-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: SJ5PEPF000001D2:EE_|BY5PR19MB4727:EE_ X-MS-Office365-Filtering-Correlation-Id: 36877050-2ba8-413d-d2e5-08ddef944f7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|61400799027; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tF1HhKdjlFwd3PxIKjvqESUx9klwLJnx4PKODjvkCldcZ+pzPzH4CgvPoHW3?= =?us-ascii?Q?FcM6CekVqCbeUTtzTdfMq7AWp/lBCbNlxEc1dtkD+Rn07iRrj9Fcy8o8mNl1?= =?us-ascii?Q?jroGEJUMC6Bp+Q8F+ZDr3ClmOZ7VIlQcEI2fxDHnvSIeagRZD5LrsXclPNuo?= =?us-ascii?Q?lN4+EPAANCH50pdPHJZJY6Xb/h+9DcZRGzV7wZDeMXKzV3kg4MYPN8tqpnY8?= =?us-ascii?Q?/w4OvyRbWzpXyUOrGhFtlSTDaisSdXK8kdhaycAuw0REQHScGSPawIGNhIKT?= =?us-ascii?Q?ubQra8lhypDlrZQ2kFLVgXlRQ0SkVGDBdWB/CC0lJYg2rRokVI83KdQvPln3?= =?us-ascii?Q?Jpkr+mdWoKkK8vsHyZc8mSNjUScguAGACLqTOxV/QnqbtPBEPigh0tDJuy+O?= =?us-ascii?Q?mgh3ijJX4DG9enPe4bgC7UBlNuDR5VL1lkiwb+32pwHCGj2nABQUddTsLN02?= =?us-ascii?Q?mNQkZXqQw6UxzfAqpu+OggmNJTCNypQXVDf15OnkENi5L633LcRBr4huJ293?= =?us-ascii?Q?KkDysO0oHoBnLFkztxnkNYaJ3HZViaPwpWFukn45Sge8SmbYbZO81VBH1rEg?= =?us-ascii?Q?SomdYvzQownngx/1eZD/dAKNOZmKD4IG9l/arC1nll2ekkeM38SYtGehpd/7?= =?us-ascii?Q?Hj3ewIvvXaINzzhJjNMOeTUbHsZ4EjaWH0k5Q0xpwBo3STR15CFZDQdzjcye?= =?us-ascii?Q?ih3SsbpQqi/3sS+8MAZq/d+nXsvro1t39RSCS7+O5v8BS1DfB/lFShwvSg4H?= =?us-ascii?Q?GdbUgaEwy83sHmGutw9y8anCeQA5HonSOW09CAavEmWSrW/t9DCOE9MntOBm?= =?us-ascii?Q?NV0tt4f9n/FzlfZ1eK4jjwDBlxbnzbXpyC5X+TRACIerzgOGfSzHMP4gw84x?= =?us-ascii?Q?Epfz65Yjz70C3+Rn2GVMEo9qht/XvANLzTCHujNvlNpe0T+dhnjAUYY8ndQv?= =?us-ascii?Q?d2/1s/8RG4/YSHe54lys+vwxc7qwNpaJDElOJf07G3/pff/rgZ9fIeBYfCKp?= =?us-ascii?Q?bRMdFY+XvGs1D5CcBcOn8FLeAZuVj9JJYLvPk0flW4IVzOvdE5M/F5FPAiVm?= =?us-ascii?Q?wD2/XFLUX5I8hfHSZ4jJdFP+Pr8veGBSdX/2Wej+0fGD88UVWYGnzkFVV24E?= =?us-ascii?Q?JboUtVh2BqjFjqv7KC5a61UGdOcm9ircDNH9mYqKOINIJjUciGaOrKDRquXz?= =?us-ascii?Q?TksJR+4QEwDoWW1WdtJ6g3vkXx7mZ++EbiIi2VnHE3V1ejoDfaEgfTWzR0HN?= =?us-ascii?Q?2Mdnc8KgDJQqonz2dGLnA/rP3EyuksflBxInko6mC6JrBZHb4NYT9iF8mZlr?= =?us-ascii?Q?1p0ed7NMXCxUQt3wpnoASZI4ifIVBMqZW9DigPgd9FLPjgNLs7OJbn4RaVYs?= =?us-ascii?Q?unMCMXD4sUhnxlxljEHIE8Yw+LyXtji0GqLCDWJIYqJ/vQhhUe93/6EVCbuZ?= =?us-ascii?Q?EYB9WlD5SL9eWb46MQJig4fUGYy23tsahJ6tjm7JGfjcu5MPFezHIZVMQh8H?= =?us-ascii?Q?N8ndcPrlThZ9VVDy/r6WMoNKOigYfmSUIcex?= 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:ErrorRetry;CAT:NONE;SFS:(13230040)(82310400026)(376014)(36860700013)(61400799027);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:42.0863 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 36877050-2ba8-413d-d2e5-08ddef944f7c 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-SJ5PEPF000001D2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR19MB4727 X-Authority-Analysis: v=2.4 cv=DMuP4zNb c=1 sm=1 tr=0 ts=68c00fe7 cx=c_pps a=U9uK1XeW/XbPQ+xGwlJMPA==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=wKYcr39KdBWZLYmsaBcA:9 X-Proofpoint-GUID: fCzE5SU7C3q6yQfLTIpgvaaz3TF4KNQs X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfX8+m0+EOwgZj8 xZFJOZ2Mbhj6EBrT9tOeljRhk0dUCRHm9deZfpZrYN0RW+9LMHBVqNUEOyS0tjMsA0n+HMY6RZR +/xAd51KyW4kMG+PTiBrUo3+nKmzxn1ndZFmUhaqTVeP5u5ayuApfOMbmwBwHSU4HX+O7iGrJwZ XNkBLMB/GQq77Of4fCIxc4gJAslxxGcqLZCxT0qoKmEjt76xHQ3fKsFHVMRTEHIjVCLX9eZN//Y ZNuoiJ+4MeCGSKJhnXxE54XDFAq1pjDFYj5PrOxRs0EXONeRYXtiCAnzoTu2dBi9ZCoLA0DQKPB yt5BXNW4/BVcVZsKYkmgX97vXQAjrVWnkwy/9L70BrjZHjIeDrjKz5QrzyZWRE= X-Proofpoint-ORIG-GUID: fCzE5SU7C3q6yQfLTIpgvaaz3TF4KNQs X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add handling of the Lenovo-specific and HP-specific EFI variables for speaker ID. Future Lenovo and HP models will not give the codec driver access to the speaker detect GPIO. Instead, the BIOS will read the GPIO and create an EFI variable with a value indicating the state of the GPIO. The Lenovo and HP EFI variables are both defined to have only two valid values. But the variable name, GUID and values are different. This adds a new exported function cs_amp_get_vendor_spkid(). Signed-off-by: Richard Fitzgerald --- include/sound/cs-amp-lib.h | 1 + sound/soc/codecs/cs-amp-lib.c | 101 ++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/include/sound/cs-amp-lib.h b/include/sound/cs-amp-lib.h index 5459c221badf..43a87a39110c 100644 --- a/include/sound/cs-amp-lib.h +++ b/include/sound/cs-amp-lib.h @@ -49,6 +49,7 @@ int cs_amp_write_cal_coeffs(struct cs_dsp *dsp, const struct cirrus_amp_cal_data *data); int cs_amp_get_efi_calibration_data(struct device *dev, u64 target_uid, in= t amp_index, struct cirrus_amp_cal_data *out_data); +int cs_amp_get_vendor_spkid(struct device *dev); =20 struct cs_amp_test_hooks { efi_status_t (*get_efi_variable)(efi_char16_t *name, diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index b1530e7c75e8..9b51d056d863 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -20,6 +20,14 @@ #define CIRRUS_LOGIC_CALIBRATION_EFI_GUID \ EFI_GUID(0x02f9af02, 0x7734, 0x4233, 0xb4, 0x3d, 0x93, 0xfe, 0x5a, 0xa3, = 0x5d, 0xb3) =20 +#define LENOVO_SPEAKER_ID_EFI_NAME L"SdwSpeaker" +#define LENOVO_SPEAKER_ID_EFI_GUID \ + EFI_GUID(0x48df970e, 0xe27f, 0x460a, 0xb5, 0x86, 0x77, 0x19, 0x80, 0x1d, = 0x92, 0x82) + +#define HP_SPEAKER_ID_EFI_NAME L"HPSpeakerID" +#define HP_SPEAKER_ID_EFI_GUID \ + EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, = 0x1d, 0x1e) + static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, const char *ctl_name, u32 val) @@ -114,6 +122,24 @@ static efi_status_t cs_amp_get_efi_variable(efi_char16= _t *name, return EFI_NOT_FOUND; } =20 +static int cs_amp_convert_efi_status(efi_status_t status) +{ + switch (status) { + case EFI_SUCCESS: + return 0; + case EFI_NOT_FOUND: + return -ENOENT; + case EFI_BUFFER_TOO_SMALL: + return -EFBIG; + case EFI_UNSUPPORTED: + case EFI_ACCESS_DENIED: + case EFI_SECURITY_VIOLATION: + return -EACCES; + default: + return -EIO; + } +} + static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_buffer(struct device= *dev) { struct cirrus_amp_efi_data *efi_data; @@ -276,6 +302,81 @@ int cs_amp_get_efi_calibration_data(struct device *dev= , u64 target_uid, int amp_ } EXPORT_SYMBOL_NS_GPL(cs_amp_get_efi_calibration_data, "SND_SOC_CS_AMP_LIB"= ); =20 +struct cs_amp_spkid_efi { + efi_char16_t *name; + efi_guid_t *guid; + u8 values[2]; +}; + +static int cs_amp_get_efi_byte_spkid(struct device *dev, const struct cs_a= mp_spkid_efi *info) +{ + efi_status_t status; + unsigned long size; + u8 spkid; + int i, ret; + + size =3D sizeof(spkid); + status =3D cs_amp_get_efi_variable(info->name, info->guid, &size, &spkid); + ret =3D cs_amp_convert_efi_status(status); + if (ret < 0) + return ret; + + if (size =3D=3D 0) + return -ENOENT; + + for (i =3D 0; i < ARRAY_SIZE(info->values); i++) { + if (info->values[i] =3D=3D spkid) + return i; + } + + dev_err(dev, "EFI speaker ID bad value %#x\n", spkid); + + return -EINVAL; +} + +static const struct cs_amp_spkid_efi cs_amp_spkid_byte_types[] =3D { + { + .name =3D LENOVO_SPEAKER_ID_EFI_NAME, + .guid =3D &LENOVO_SPEAKER_ID_EFI_GUID, + .values =3D { 0xd0, 0xd1 }, + }, + { + .name =3D HP_SPEAKER_ID_EFI_NAME, + .guid =3D &HP_SPEAKER_ID_EFI_GUID, + .values =3D { 0x30, 0x31 }, + }, +}; + +/** + * cs_amp_get_vendor_spkid - get a speaker ID from vendor-specific storage + * @dev: pointer to struct device + * + * Known vendor-specific methods of speaker ID are checked and if one is + * found its speaker ID value is returned. + * + * Return: >=3D0 is a valid speaker ID. -ENOENT if a vendor-specific method + * was not found. -EACCES if the vendor-specific storage could not + * be read. Other error values indicate that the data from the + * vendor-specific storage was found but could not be understood. + */ +int cs_amp_get_vendor_spkid(struct device *dev) +{ + int i, ret; + + if (!efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE) && + !IS_ENABLED(CONFIG_SND_SOC_CS_AMP_LIB_TEST)) + return -ENOENT; + + for (i =3D 0; i < ARRAY_SIZE(cs_amp_spkid_byte_types); i++) { + ret =3D cs_amp_get_efi_byte_spkid(dev, &cs_amp_spkid_byte_types[i]); + if (ret !=3D -ENOENT) + return ret; + } + + return -ENOENT; +} +EXPORT_SYMBOL_NS_GPL(cs_amp_get_vendor_spkid, "SND_SOC_CS_AMP_LIB"); + static const struct cs_amp_test_hooks cs_amp_test_hook_ptrs =3D { .get_efi_variable =3D cs_amp_get_efi_variable, .write_cal_coeff =3D cs_amp_write_cal_coeff, --=20 2.39.5 From nobody Wed Sep 10 01:55:24 2025 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 3E17131B833; Tue, 9 Sep 2025 11:30:50 +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=1757417452; cv=fail; b=ul6PYdlO7ona7Jq/UouKRipwpKLPbKzn+OSDTO4igtsklMCyAqwQuE/RbA1Z1sHbO8/2Q6gs3plY+w0X0Xt1N20Joxu1RuLgsmzgyqxsVwUWygOOWL+8dD2fJZM/hhSILnjOMQvRm5PjxMuCeODIbk+/GEmSxzi6lSddiYifKJY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417452; c=relaxed/simple; bh=dgqUvgurBWL6vstHKCZHHz6jiQsOHyYp9ZPneVqWgog=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=jRkS3d28v/L7BQs6IUmoxvQ1RAIYZeVKqnWWcQv32p8MipM/t03zvaGO374SJBGBk494kGXcjI6pBoH0Pmr0Zx94dkhl1OFVAJ5uzdnMOzOojfMLYlCde3G3HsBAalZdA4Z+jpJW/W1LfKNhExaN5qiTgw4myi620e3dY5IMz6Q= 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=qnnbjDWo; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=F2mOmpTO; 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="qnnbjDWo"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="F2mOmpTO" 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 588KSv911252531; Tue, 9 Sep 2025 06:30:48 -0500 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=x9gRks5JjcsSpCMHUpNR/NWaGqDlrevQD7rqImIrMdQ=; b= qnnbjDWokW64Q7FvKBcpIWhmPiaSd/3ViSvjlMqYyj6qL/9iefD1rrumoVEjd5qZ nuCesqliyoczrsdY/068TeyPYcxMRSVEl+sbp2wmec6uJ3BLTjqsOz/s8LkgrwoH VrN69o3qFSTCXuLQBEYkGaWZjIVKB3wmIWSS95jgAlq35RK6ClBY5sfTC319IWQe ScVtEj3AaD+Hjn+RMKaILjfVuY583gahx7vspB8035RF4hkTQkLKItqpx80m2+Kf u7rl+/fYBRejkc0EdocqWCEx7ctpbV3tZEbm7xi50jyicNtLmqKdQNJ6kROUkG3Z 27kNesBG0JDmzL82ai281w== Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10on2097.outbound.protection.outlook.com [40.107.92.97]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 49227r91ws-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:48 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PzW3gHjjOiPmDqPRSa6OI9ATxuGn5uOx/efvPB3VubyzjQHMUFEXrDd0TA9DXelZ2rFDJMV+X2YY9RoMTSgHvy38ZYOpApKsLCRA4u7tELd9wDEUMtMeSKfCrHVd3RXF7PsxvmNjy2G/AnzV4OZSwJVvEmM4tXpnAtQZYZvrZpOdFydHGT356y4AkuF3zDu5eXHht+14jkMJip8pdNzw/ckDLrtXMBw/2KRkQD0MxK0stXayTxU8TcfIUqahsvfyreBrp3yKSTDcxbNp/Rws+O4668kQHCEDBrxofcd86klv28GjHex1bEdAGlUzJLifz+wV9TfOhux1fiFDLQe2iw== 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=x9gRks5JjcsSpCMHUpNR/NWaGqDlrevQD7rqImIrMdQ=; b=QPoDeo9QdjRYaLRJS9URbZfDmvY4TvGdBOrD+F/IKM75yNq/CZkD9r4gMDM76Xz/gXjXdlV/ij/NBtjbNZrUkOriKNCJFhby9OGcQ1EqcAcgEsplp1D4koIRthQWm8zLwzHDVZNlSCsuBGwpslo+DTxznMelNdZC6PGcxtFCTEDwk9l2eSGM27iOtUZWpUP8RLGRoKPXX+4olKHzAIRTn4sawms8tRKHpkNTX/HbuMxhtgWuFwydhbaRDilaSyng8M5s4fR32WpFrOmuN6VxDZ0BYan0mYapGqYoDhjFSCWgWA4O1nphxddrwMlRaTQi7PZwWfQCC26j+pUozZ8xDw== 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=x9gRks5JjcsSpCMHUpNR/NWaGqDlrevQD7rqImIrMdQ=; b=F2mOmpTOcNa/frQpSM+gavTVOmMVzP614csL5DzBdilOzjKlbQTNcd7ZwKB+JPpuzIp/pR1UUBxQ2HU5rey0oshyiOk5M/q4PTrNGI0GZYgutCcO+p1ujpZMKZplcWn4BpTUNwPyv61cBGclNEfLJyxHvy0JpmbAl4FA4OFjccs= Received: from BYAPR07CA0075.namprd07.prod.outlook.com (2603:10b6:a03:12b::16) by PH0PR19MB4988.namprd19.prod.outlook.com (2603:10b6:510:99::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:44 +0000 Received: from CO1PEPF000044EE.namprd05.prod.outlook.com (2603:10b6:a03:12b:cafe::16) by BYAPR07CA0075.outlook.office365.com (2603:10b6:a03:12b::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9094.22 via Frontend Transport; Tue, 9 Sep 2025 11:30:43 +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 CO1PEPF000044EE.mail.protection.outlook.com (10.167.241.68) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30:41 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id 363B0406542; Tue, 9 Sep 2025 11:30:40 +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 2FA8A820247; Tue, 9 Sep 2025 11:30:40 +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 v2 3/6] ASoC: cs35l56: Check for vendor-specific speaker ID value Date: Tue, 9 Sep 2025 12:30:36 +0100 Message-Id: <20250909113039.922065-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: CO1PEPF000044EE:EE_|PH0PR19MB4988:EE_ X-MS-Office365-Filtering-Correlation-Id: d9694952-c6cd-4a7b-4a62-08ddef944f62 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|61400799027; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?1mDDbyAHsCdsBUFSc7e8mjas9Nb3RuC1MydSOhvhPXaXAzKnWBYftXKxw0h1?= =?us-ascii?Q?p0hZ1/BAN5QPgK/iM5GWGkTrdvCNq+c1p72pUxhImvG9f6kEMJFPNSlRlCa3?= =?us-ascii?Q?r4otyf89zY7mbs05hEINM16/l9Uog/Xcwb3K6rgq7QVoWEb00tz7jwbVEYF/?= =?us-ascii?Q?ct0iys1rbonAlPBDnIieiQqXrLVTuIgwjxLpQwogwvOqKtqilleSTZGTncnd?= =?us-ascii?Q?/yzyR/5OaTBB4TchJ+NScORm7sMblJGUbdZVHSmcLkYWJbuRAX3pa5kNX/3C?= =?us-ascii?Q?SpY/0v5Fh9dLxy1h8DW/4CXRJgJOZNmYN7LApnJzuQF+ZJ9VLmk7Rmfcd2OA?= =?us-ascii?Q?BI7J8NXAf59H0g1AN6FyparrOTYlb4dK19NvPzBTgdq9ZKb8MRzMDQX5OFYs?= =?us-ascii?Q?9n9W77piTsJ1MHhHHBMVXYf9eD0VKNWjIguVMYG7pth1IswnGhd1bP3cqJbf?= =?us-ascii?Q?7VpLN+5pnhj4jFs1KmAdKf/ypKaJ0s5kXVf8NZhUjdFEdtPQVqm//9bDcUAq?= =?us-ascii?Q?MKIz2oyO7xESqdARNtum0STV9bMJq+KqT/h6zY51unBSCOj2kUmxXbACqT3U?= =?us-ascii?Q?R4kzUKnpZy+/0HnwpNYEblLHsNZ/6Slyl2b4d4G/3ChHDKS945idMmTB/gxx?= =?us-ascii?Q?weC0p44DPaCP12r3ZSgaBk3HN2S+H9n2sS8hErLRodXepQ9GbvXpdMl2gFlU?= =?us-ascii?Q?h9P4YJst/70E28aTwMGVVbepmT2UAv7cbSJcW/nJYnMPDThcUG2TG+Dhdn4l?= =?us-ascii?Q?GHyIMUQjrhsinDKiuUVpz6bZfTqu6chVmzwHMxdNkVW4TPlbGiLSDfpw7I8i?= =?us-ascii?Q?sVWT5qR0e6sJVYt/clzWdSUuEo9lkcJ5kIPo9m1OOOcjlfQViudzNQ8TKYQY?= =?us-ascii?Q?An2d/L14DzIGAkyb1+aAc1IyHYM+KaPWIF3/jSck+y2gEQO7JigPZLFLXsAg?= =?us-ascii?Q?zlkdqPayDcyj4mZKrhNOCeSDE4xMIArUxENUnuGpiMRRVuK/EmbRWMmhMPM/?= =?us-ascii?Q?X9ebzvxM7xKEov5OCSkfWw6NALtxLD7DRMekZ5FoLH1szEiWikZ+BhIOq2a0?= =?us-ascii?Q?mm4slknUIC5oO/EL/HD0T1iTwVEjB/bluPG/tHoz2eZzK8DVhIiw3g4t3gpX?= =?us-ascii?Q?sVYyQIZUnyP5dN0djZQQk0SqTWn6qPvbCPlKF91lZYujs0k8484FEM/5XxFN?= =?us-ascii?Q?CE0TasC8pc5iA90oBsZvvMoiIhlGRMe9dSb72NorXfl45fzTmbbDNJr6Voav?= =?us-ascii?Q?vxqRL3zck01Cf6hMhJFj3UYKGIVA7CxmA05Rcj9hyKG8CT/UXTjBUfW9rIVD?= =?us-ascii?Q?XrEDkUp779VQqmv0m9LDhzpLG+Fhq/sKy4p6OeTaXG/QEYyVNso61ggGcEjW?= =?us-ascii?Q?jhz62wA38qt+g1NdYP4PBSJotSfgXILgyz4xvZKCjUuFBVhwr+/8h/gD3XP0?= =?us-ascii?Q?vEsva70A7SbCvm0iR1ifnFbNp+H9nIsKYH9xJ6lMsw/TaiHAr0PBZk1BxXGN?= =?us-ascii?Q?xF0Nel34wE/yFX0oXzo8sE+MC/h7ibLBCyHl?= 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)(36860700013)(82310400026)(61400799027);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:41.9358 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d9694952-c6cd-4a7b-4a62-08ddef944f62 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-CO1PEPF000044EE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR19MB4988 X-Authority-Analysis: v=2.4 cv=f+FIBPyM c=1 sm=1 tr=0 ts=68c00fe8 cx=c_pps a=AtfF7QnjuUZK6qv3K7ssFw==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=9YM_IZES8PAWDyRG2q4A:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfX5KLZFGXhUgjD PIeIwwycfVnb33FPj6vgsEIsrI4+Hr+FZdDXyhAIiQczA6Gr1oCSMO2Ye5lUiYMrr+8g6l3WaG1 UqfNwkIfNpLpkV0kn+mgdCNOeG2dsjfLwOxyKpGhxfmdl0Ak6x57lf9asLdhACbXJ571E59V1SW Dq0SL88cncYKtY5N79LoPgQRPAM/SEhbykLWhSeCxAB3lvFJc4OnDZ/UfCQe2/AfW41MMzniFlm naFoYVW14tyNP6sdbyBZd29nUWIQw6bh8g2R5uHjr9qVhiU8oyZq3z7mqb3bY0iThr6NioKbwq6 Z1dkkv3nuIO6+09q0vQdSfhJeb51lsBZFfgopnHkplN8dlT/NPtabA/ZGMcpBU= X-Proofpoint-GUID: lSUy3tZJ8VxbISRQkBlhuZEiPaCCDbND X-Proofpoint-ORIG-GUID: lSUy3tZJ8VxbISRQkBlhuZEiPaCCDbND X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Call cs_amp_get_vendor_spkid() to get use a vendor-specific speaker ID value, if one exists. The speaker ID is used to load an appropriate set of firmware files for the speakers, and is usually read from a GPIO. Some manufacturers are instead using a custom UEFI variable for the speaker ID. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs35l56-shared.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-s= hared.c index 850fcf385996..95d018ecb953 100644 --- a/sound/soc/codecs/cs35l56-shared.c +++ b/sound/soc/codecs/cs35l56-shared.c @@ -1054,7 +1054,17 @@ int cs35l56_get_speaker_id(struct cs35l56_base *cs35= l56_base) u32 speaker_id; int i, ret; =20 - /* Attempt to read the speaker type from a device property first */ + /* Check for vendor-specific speaker ID method */ + ret =3D cs_amp_get_vendor_spkid(cs35l56_base->dev); + if (ret >=3D 0) { + dev_dbg(cs35l56_base->dev, "Vendor Speaker ID =3D %d\n", ret); + return ret; + } else if (ret !=3D -ENOENT) { + dev_err(cs35l56_base->dev, "Error getting vendor Speaker ID: %d\n", ret); + return ret; + } + + /* Attempt to read the speaker type from a device property */ ret =3D device_property_read_u32(cs35l56_base->dev, "cirrus,speaker-id", = &speaker_id); if (!ret) { dev_dbg(cs35l56_base->dev, "Speaker ID =3D %d\n", speaker_id); --=20 2.39.5 From nobody Wed Sep 10 01:55:24 2025 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 970D6322531; Tue, 9 Sep 2025 11:30:52 +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=1757417454; cv=fail; b=ZR6iyExShmrnz94lAiO7rKZlecpKwgkkcYca6eeSMvgVcF/JlBcy2bxb8hX8eutO/8AZQlJfe/l6SxIoTi4rTmucK2ZqwwdaHlinCXYMARoimP3+ViDmt4RqLiQav99vERkKD08hK+HxMWO11QBJK48qyWFimEGogrvJZWgQwtg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417454; c=relaxed/simple; bh=1CXFuIug/yMLtcH2kEgCQcxzk39tVwXaIoGV0g95s7Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=O0krqU9eT/w0SvZFm+gGu4cFycp5rx0537l6hFeYz9qL7lxBFrQUOOZooPKUmHjVK+5/Kf4F62t3PEOFQ5C4XRh4hBDeqbS+xGpcqEZQjeOp1w07adEGYXW2tIbaJmYrfdWXOj4FxWYdBbumDqLVhqtCkWi/TJZsN76AO1vUwig= 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=pAyB/mtD; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=cxJ1C0Uu; 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="pAyB/mtD"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="cxJ1C0Uu" 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 5894chE14162663; Tue, 9 Sep 2025 06:30:49 -0500 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=CPaObkdmYNBB+lBLl2984mLFb2yavzxJczSJv86UtP0=; b= pAyB/mtD4Kev0ipQc6SCAN6MGuWyiK5sk+/wHkkYJVXJj2RQVSdB6eprB0QISzpW YfzNLgNa7cdE+obTJGilqlgxjT8fvHaWjN5Prrld5/jwg3uzyxx21BuJ9z5GElB4 uIboXxTxEHs11EbujGl0MzKiwkxHD9bPSs5Kf88J87ZBisAOe/XdwvTFp0j6/yEM gzldAJHSFg9soNnTAoon2w2YS5b7T6zABFaUWpj8gV0w3+EcLEjeIPqQwswu4489 70wjBAD9yygsw+FianUlZPs1tYe5Xw5bqVPRQ3CI332WF8KGyXsmfXGZ/BNiVqJy 4Ank89c4l6/8U19B7/JsHw== Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12on2107.outbound.protection.outlook.com [40.107.237.107]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 491upq9k42-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:49 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=itwvrcQIlv+QQ8XzKJ5Y3O9bfBOf7/ePuJZA0k6Y3wAOitB18Ucdmxs7DEKHB578+kv/THbpu1szYzQ/CzEXtfsW4ZwS6x6JCxJMaNxZjq/9TDI3MpeyEtePsHtpRMj85yLrFNliwDeDHByf+1GzRh0jQAG0+v67wpfudvRPIiE3IhmOM1U0SoeQ6c4F8qOZoMNemdMYMezYgGKnsUz17nPcZz76QxtWlQGhPNyekL8YmQducX/tkPwWffOABBQhCXGLKSv77cCqkRfwpwf90pL30iIPW74Nqf6RFMAuRVURM3v5Fl+9athmY4pJNP0VN7NwTGgKUc3jo89oIMGwtA== 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=CPaObkdmYNBB+lBLl2984mLFb2yavzxJczSJv86UtP0=; b=CWDQ2xDY+lmJrlAS8eZn8sItV6MrX/H98ykb4Q3RdhEquYaBkzzWHV41FKWzLBhteDj5bQz0Kei5fprBGBEPTnPDSRWtGCkBT4v2pWX1wkwB3DoqPl6lsW/XsLYwBy4/Rp++fTFLG0AeR/HvrcKXA1maPOqE+XcecBIA+k7ci9mxL23tksyJIMKQVAacN1iMTV3t0GDQlCPO2U1aP2M4Dt6RArA1M8a0KsNRj1ehlhc4kMS0tl2nJTgoVXAXg6oLL7i7FEPdHjS0OdD3gVzy8oQXgcjCO23rhItYKhYCtI7MgtFIYLja1UBFVmDD+FuZZXpli4wKFTVAU9iVycvvew== 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=CPaObkdmYNBB+lBLl2984mLFb2yavzxJczSJv86UtP0=; b=cxJ1C0UuwFpN2NLUWXlSu7sj3xN/gMSNBZ0bQ7jJmTbi/WKtzdTKcooCOxPuipMdqJtgmV1O806y9momcxuInU+2gvjxW2kFp8Uxdxa7kJLIuT5zIOOXS/17dSgysB84bAahjHwalNKsAKFa3Zvp/LGJed/XXRi61NNbNZMDhdA= Received: from BY5PR17CA0026.namprd17.prod.outlook.com (2603:10b6:a03:1b8::39) by IA1PR19MB7964.namprd19.prod.outlook.com (2603:10b6:208:44f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:45 +0000 Received: from SJ5PEPF000001D6.namprd05.prod.outlook.com (2603:10b6:a03:1b8:cafe::be) by BY5PR17CA0026.outlook.office365.com (2603:10b6:a03:1b8::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.15 via Frontend Transport; Tue, 9 Sep 2025 11:30:43 +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 SJ5PEPF000001D6.mail.protection.outlook.com (10.167.242.58) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30:41 +0000 Received: from ediswmail9.ad.cirrus.com (ediswmail9.ad.cirrus.com [198.61.86.93]) by edirelay1.ad.cirrus.com (Postfix) with ESMTPS id 4467840654E; Tue, 9 Sep 2025 11:30:40 +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 329F682025A; Tue, 9 Sep 2025 11:30:40 +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 v2 4/6] ASoC: cs-amp-lib-test: Add tests for cs_amp_get_vendor_spkid() Date: Tue, 9 Sep 2025 12:30:37 +0100 Message-Id: <20250909113039.922065-5-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: SJ5PEPF000001D6:EE_|IA1PR19MB7964:EE_ X-MS-Office365-Filtering-Correlation-Id: 2d4ca1c8-4f0d-488c-acad-08ddef944f39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|61400799027|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?lZ1adSxfhSR1KUe+nDC/qOzqvFNEubYxJWUpD6P6cAM+sYQTBOA5qYxa/Ptf?= =?us-ascii?Q?IM9DfFIedJtaWNWiCuoe9hVDxwKG4444q2rMng8vw3DYMKYG66WpW5vYnfWq?= =?us-ascii?Q?XaVslk/41jfeBKZDjRZt8c1iRHGhmCnH4RC94gIq9NTv09hA1/cL0JOUVYSL?= =?us-ascii?Q?pbJB/4JWJbmU9E5u82orH/kx671wO/TFGDe/outxCg1sfQWyG2dKOf3VE7Hs?= =?us-ascii?Q?qhZcB9jr4I5bpzLSiDKgljBIaiJ6zdNItZ7hb5CvygAjTlYeA1MG0kTAmGto?= =?us-ascii?Q?OOVmBSpww9SYvev3NVlGy2vX1l8Eq2jygLQ2VAx8J4Uosoar+IS2Ip/mT2AI?= =?us-ascii?Q?t1H82VeViucJKGbm7fGGR3TRdY0y8z5OU7rnD0TboBTyhxYzvONgkR26NG1O?= =?us-ascii?Q?sGyHFmMJOe17qtRFLUOgM9BHh7E7KJ/PfkebI6OeI7XkeFv+9wKSmaMZewtu?= =?us-ascii?Q?XDYN6qJ+IRCfzlezu6tkYtjfRI3xoGxiUpvihGp0UQ61DOwAnwpXzXn0sQGh?= =?us-ascii?Q?BTGCX/UmE+cQzQtD/w5THiJauGQzT6sG48iu8+TWLf/NAt+CGftH0U0MeUJt?= =?us-ascii?Q?ARs6hV3ZxAAUuZHMiwB1WZc56EvvhjP4clxxgQnA2H5mol4Umfdgy9vM0sRi?= =?us-ascii?Q?smfwV9166ZLWXhGnwkGHX37QDZmDcMjRtSW9Ap+P2BcQ1EU/ngY/JW6ctN8X?= =?us-ascii?Q?8E2z5Tn7LSQmDPIuKi820A1+7ybZxffpRawLPPx59BwPDMODf0hGdgTuXvEJ?= =?us-ascii?Q?rHps/6etC0Xx3wzyjTAXClDDQ2i7uAf1FRrf93/gUulUP8Ptlere7RdSB/eO?= =?us-ascii?Q?ZJ9hNpiZbP7QXuqzuRneaeFeTy+z5/K20iJ0MoSzPglRUWqimiCKHs5r56yz?= =?us-ascii?Q?sK/TminFjp3VYciU9sCZEcg8MsrogsnHjLGqnY93e15M7b7GQhjnORcNqG5X?= =?us-ascii?Q?7WuZWcQewAwsFaywp7dw/XcTVwvi+Su7XE5nCcQhIMPlIKdaOgrQAuSqNxIj?= =?us-ascii?Q?E6sbysdXynNxtI9mjuiDKBmun0DN4HPD5237I5vABafs02zv57WM5OEUBC1N?= =?us-ascii?Q?VTOiStjx5oPbdKCdFSD+v9HrtX+Cxhvp7wVv60+t8THuMpwL7W1xL4Eq/5a3?= =?us-ascii?Q?oDa144mjvp8/rrXgqwOQ5tJ/00TdqsyjO0x+s4cXkoSzEV9OleG5D/Y2mKjo?= =?us-ascii?Q?8eqAF7HuXIFl7Xg9hmrNFS66ocdln4MaWGeyQVbme6+BBj3sE/PQf+3qUOd3?= =?us-ascii?Q?Cr2mXAOmVZcaQXKuHYOPq8qj12jOuaoHpJhiBMJe2r8RZp7otwaTNiIAA91I?= =?us-ascii?Q?02WiT37/+jgiWo7ZMgawJEHTVN77olysvElQHlAOy1h/dES2syMpwEUeK9bj?= =?us-ascii?Q?AddNCE3a0DJ6A9EYfwklbk9IH25da0iJZ7D1lsouziKbLTtXPIZEFAQr9FSP?= =?us-ascii?Q?AucZMzmXRBltCULvVcDy6eHTKzh4arGZ53JOVhLFLggmpmPC1ubFK4WBMC9T?= =?us-ascii?Q?bCATaCBng6XkWURQSaCA77LrAztaqW8ZASJH?= 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:ErrorRetry;CAT:NONE;SFS:(13230040)(82310400026)(376014)(61400799027)(36860700013);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:41.6507 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d4ca1c8-4f0d-488c-acad-08ddef944f39 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-SJ5PEPF000001D6.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR19MB7964 X-Authority-Analysis: v=2.4 cv=DMuP4zNb c=1 sm=1 tr=0 ts=68c00fe9 cx=c_pps a=uh+8t3r8MFU2BVWJWTlZiQ==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=VFd6b9-Wlax7agovK-8A:9 X-Proofpoint-GUID: gqqzkLOpm0HSHhSnZ_ZDviKPzgGtFQf2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfX0Nbqbql5VZAP tZWN2aP12jDoq6Duz0jLNnhIzdhyd9vGzMx1X9ZbFYPid40ock/1Jv4QlBhNxA8nq6E1bBHitHj 4uhXZBDzZLaPPh/GvTeojK92uiZ4Sn4BXM0UjAiJex+oeBYWQU2hNxlDbpdr7F8+tuXDrN6bwcN aoTUr7n3yalLMk/dIbNgoU3mYErGiqmMF3tPAcWAkPfFFUOSU9ZemCxuNuSlYJvU/OZdDNmYMG4 Jh6HGYxtfLUSaiGMueNgR5QbhD09lsOP9txpfEThEwUDOUYhsc7xeNAB2cW0qoCslgW38mwi58Q +tnUAJ9Rp3bDIQiRbVhBY9aexL3Lyox5BVJ51esBiVuagAQMPPvMe0NESG0AW8= X-Proofpoint-ORIG-GUID: gqqzkLOpm0HSHhSnZ_ZDviKPzgGtFQf2 X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add test cases for cs_amp_get_vendor_spkid() for the Lenovo speaker ID UEFI variable. This is a simple set of cases: - EFI variable is not found - EFI variable size is larger than the expect 1 byte - EFI variable has invalid value 0 - Lenovo UEFI variable valid values are interpreted correctly - HP UEFI variable valid values are interpreted correctly Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs-amp-lib-test.c | 196 +++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/sound/soc/codecs/cs-amp-lib-test.c b/sound/soc/codecs/cs-amp-l= ib-test.c index f53650128fc3..e7492afa041e 100644 --- a/sound/soc/codecs/cs-amp-lib-test.c +++ b/sound/soc/codecs/cs-amp-lib-test.c @@ -19,6 +19,14 @@ #include #include =20 +#define LENOVO_SPEAKER_ID_EFI_NAME L"SdwSpeaker" +#define LENOVO_SPEAKER_ID_EFI_GUID \ + EFI_GUID(0x48df970e, 0xe27f, 0x460a, 0xb5, 0x86, 0x77, 0x19, 0x80, 0x1d, = 0x92, 0x82) + +#define HP_SPEAKER_ID_EFI_NAME L"HPSpeakerID" +#define HP_SPEAKER_ID_EFI_GUID \ + EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, = 0x1d, 0x1e) + KUNIT_DEFINE_ACTION_WRAPPER(faux_device_destroy_wrapper, faux_device_destr= oy, struct faux_device *) =20 @@ -642,6 +650,185 @@ static void cs_amp_lib_test_write_cal_data_test(struc= t kunit *test) KUNIT_EXPECT_EQ(test, entry->value, data.calStatus); } =20 +static void cs_amp_lib_test_spkid_lenovo_not_present(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_none); + + KUNIT_EXPECT_EQ(test, -ENOENT, cs_amp_get_vendor_spkid(dev)); +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d0(efi_char16_= t *name, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + + if (efi_guidcmp(*guid, LENOVO_SPEAKER_ID_EFI_GUID) || + memcmp(name, LENOVO_SPEAKER_ID_EFI_NAME, sizeof(LENOVO_SPEAKER_ID_EFI= _NAME))) + return EFI_NOT_FOUND; + + KUNIT_ASSERT_EQ(test, *size, 1); + *size =3D 1; + *(u8 *)buf =3D 0xd0; + + return EFI_SUCCESS; +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_d1(efi_char16_= t *name, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + + if (efi_guidcmp(*guid, LENOVO_SPEAKER_ID_EFI_GUID) || + memcmp(name, LENOVO_SPEAKER_ID_EFI_NAME, sizeof(LENOVO_SPEAKER_ID_EFI= _NAME))) + return EFI_NOT_FOUND; + + KUNIT_ASSERT_EQ(test, *size, 1); + *size =3D 1; + *(u8 *)buf =3D 0xd1; + + return EFI_SUCCESS; +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_lenovo_00(efi_char16_= t *name, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + + KUNIT_ASSERT_EQ(test, 0, efi_guidcmp(*guid, LENOVO_SPEAKER_ID_EFI_GUID)); + KUNIT_ASSERT_EQ(test, *size, 1); + *size =3D 1; + *(u8 *)buf =3D 0; + + return EFI_SUCCESS; +} + +static void cs_amp_lib_test_spkid_lenovo_d0(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_lenovo_d0); + + KUNIT_EXPECT_EQ(test, 0, cs_amp_get_vendor_spkid(dev)); +} + +static void cs_amp_lib_test_spkid_lenovo_d1(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_lenovo_d1); + + KUNIT_EXPECT_EQ(test, 1, cs_amp_get_vendor_spkid(dev)); +} + +static void cs_amp_lib_test_spkid_lenovo_illegal(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_lenovo_00); + + KUNIT_EXPECT_LT(test, cs_amp_get_vendor_spkid(dev), 0); +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_buf_too_small(efi_cha= r16_t *name, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + return EFI_BUFFER_TOO_SMALL; +} + +static void cs_amp_lib_test_spkid_lenovo_oversize(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_buf_too_small); + + KUNIT_EXPECT_LT(test, cs_amp_get_vendor_spkid(dev), 0); +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_hp_30(efi_char16_t *n= ame, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + + if (efi_guidcmp(*guid, HP_SPEAKER_ID_EFI_GUID) || + memcmp(name, HP_SPEAKER_ID_EFI_NAME, sizeof(HP_SPEAKER_ID_EFI_NAME))) + return EFI_NOT_FOUND; + + KUNIT_ASSERT_EQ(test, *size, 1); + *size =3D 1; + *(u8 *)buf =3D 0x30; + + return EFI_SUCCESS; +} + +static efi_status_t cs_amp_lib_test_get_efi_variable_hp_31(efi_char16_t *n= ame, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + struct kunit *test =3D kunit_get_current_test(); + + if (efi_guidcmp(*guid, HP_SPEAKER_ID_EFI_GUID) || + memcmp(name, HP_SPEAKER_ID_EFI_NAME, sizeof(HP_SPEAKER_ID_EFI_NAME))) + return EFI_NOT_FOUND; + + KUNIT_ASSERT_EQ(test, *size, 1); + *size =3D 1; + *(u8 *)buf =3D 0x31; + + return EFI_SUCCESS; +} + +static void cs_amp_lib_test_spkid_hp_30(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_hp_30); + + KUNIT_EXPECT_EQ(test, 0, cs_amp_get_vendor_spkid(dev)); +} + +static void cs_amp_lib_test_spkid_hp_31(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct device *dev =3D &priv->amp_dev->dev; + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_efi_variable_hp_31); + + KUNIT_EXPECT_EQ(test, 1, cs_amp_get_vendor_spkid(dev)); +} + static int cs_amp_lib_test_case_init(struct kunit *test) { struct cs_amp_lib_test_priv *priv; @@ -737,6 +924,15 @@ static struct kunit_case cs_amp_lib_test_cases[] =3D { /* Tests for writing calibration data */ KUNIT_CASE(cs_amp_lib_test_write_cal_data_test), =20 + /* Test cases for speaker ID */ + KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_not_present), + KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_d0), + KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_d1), + KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_illegal), + KUNIT_CASE(cs_amp_lib_test_spkid_lenovo_oversize), + KUNIT_CASE(cs_amp_lib_test_spkid_hp_30), + KUNIT_CASE(cs_amp_lib_test_spkid_hp_31), + { } /* terminator */ }; =20 --=20 2.39.5 From nobody Wed Sep 10 01:55:24 2025 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 EC654322C8E; Tue, 9 Sep 2025 11:30:56 +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=1757417458; cv=fail; b=NdyQ9S1g9GsWZ4d2oJL80AVze/OUSgFNtpcVTws2TrLbpQZJgHdariSvzhsygKK0l50uQz6Kye5PkyhKvNYXDCRdyOfsdnOCRrVtNwB57XvZ+rVif4gq7o3llCMV75QSdweafEHlOJLEKXk/qa10oq3JAwMbbGCFXy3pv3cu45Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417458; c=relaxed/simple; bh=wJhnQMsUsI9rAjc0BNjA1XOBKL7QbUrGwXxQp9Iz5Lc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=XKfCUe4f/QWz371ZofczBaSmU7vgZdsNTOX/2zCiIlyyCQqikKB76ckF889ZOpzT9r0cx9NUPeGJFzQEN/GvfD5C0nSin+VNto/iNdpXsNGm8rO8SlPVobecxjQS1n5vraPXBjRHGe2e2kocybyAd6rW+g6+W7JtFaMC3R+4Hx0= 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=WGaJ3Qmw; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=d5Z2oeLJ; 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="WGaJ3Qmw"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="d5Z2oeLJ" 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 588KTW2W1253433; Tue, 9 Sep 2025 06:30:54 -0500 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=h4Dfr0hD8yE9FJXgyaN7BRfYnhLiGIoENqRcYFsQiR4=; b= WGaJ3QmwjI/anX0aUGQIYpwQcIVtNdhos+lz5ic+i2F/kCGwhS7J/ke285GjADs+ Fovu+3jfiZQz7TNWupkO7zvDjkk9tm+dAwrUD+uUlcY1Jf0CzgY8SzS3vW6FALD8 Pt7ArYbbYqkitMwgUm4oMVe+5gJplvUQf57VZbAn4WWrXb9iURmJLrDcYBgKOYKU JvukzKv1ZTIzqSY5fSnWMYEblZfFHdjAOHytK4+HoJ333fVLV9pI8t3CnKgxH05m JJtE7GA46D6GoOPr8f6k0S5mJe2wr9jvULd6S6kW7deERVAcozZddfDN+zjZr0ps Dq97OmJOWo/ucq3Rp5GDQw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10on2092.outbound.protection.outlook.com [40.107.94.92]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 49227r91wv-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:54 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o4tiH3l1kshLi5l0sjUkD1a/RchNrTh0BHaLcqjdPNvU4aXxznkgUzBY0+hHomPo5qk7A/xATwLk6W51QJLZr546xf9feJLh+Ar1zx6dsu5E5rS/byHhVUa5ZIhUCjh6iasY3+HLpTIdioBv82OHQTss72jsdBM8HbuwzogLt0RvcbHA0GNyg17SO1bpDjD8HQPBzYJ7m1t1yr/k3o/gX4K0fmWXYqOZerpLNFLO9+8M0LG5NS+Q3pRwYxw6AODs8V2mipTCn4bWvqsuxk707de80V3S3QE+4B7i5f7QFEcdrxFxwU7WRaSwX8qICNrK/RDObhXEXfFDbFyxMV2C2g== 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=h4Dfr0hD8yE9FJXgyaN7BRfYnhLiGIoENqRcYFsQiR4=; b=ILhNnBHVNv3IVMesaBtVvCHS9mOU9ZPqpaeih4p+7XJToFnLUO8tnMkmkfZUC40tEt0qfP+ht47VsNMLEpagaWV6MhXc4dch3tm0ZPt7L7UlQ3h5k+xCykPVz5bXXtMYX9d/DucuBMRXibmajhp56ETPExudtlkKs9LI7f95juymLJk+p/p12YTc8IYKmvn+ZgbgNpLSAnI3TwYEGxz5rf8euV75xnPiMNCtGsFbaClniTTKSxTEPwrOdB3BRPsJ4JjzQoOLbBtv3m8Lew24pRMC8kMEURVCvYHJ5ZUGd1c3ANCfJmIQzS161JCsfTHtydJDu9QCRGxDQFL29exOuw== 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=h4Dfr0hD8yE9FJXgyaN7BRfYnhLiGIoENqRcYFsQiR4=; b=d5Z2oeLJ83w5qetOmuSGHp+yjFKH361hjkI3NRcDRHqk3dnrcn+LtaKkUjYO08ofFkHDHZVmTao0ejKVHAMUpwyF51IvqqCNkorYv93/8cOvalCzh6tIVO3ZjPLfYX+PhMNcSyiqzz/M47xfQ1HrXvAXV9nbSmj6BqLQ4l2j+j0= Received: from MW4PR03CA0304.namprd03.prod.outlook.com (2603:10b6:303:dd::9) by MN0PR19MB5756.namprd19.prod.outlook.com (2603:10b6:208:377::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:46 +0000 Received: from CO1PEPF000066EC.namprd05.prod.outlook.com (2603:10b6:303:dd:cafe::32) by MW4PR03CA0304.outlook.office365.com (2603:10b6:303:dd::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.15 via Frontend Transport; Tue, 9 Sep 2025 11:30: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 CO1PEPF000066EC.mail.protection.outlook.com (10.167.249.8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30: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 465EF40654F; Tue, 9 Sep 2025 11:30:40 +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 40332820247; Tue, 9 Sep 2025 11:30:40 +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 v2 5/6] ASoC: cs-amp-lib: Add HP-specific EFI variable for calibration data Date: Tue, 9 Sep 2025 12:30:38 +0100 Message-Id: <20250909113039.922065-6-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: CO1PEPF000066EC:EE_|MN0PR19MB5756:EE_ X-MS-Office365-Filtering-Correlation-Id: 04317a88-1fc1-4db4-c7e8-08ddef9450fd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|61400799027|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wM4Vuhyn42SW8RI/iC5xc+mFosWrP8kcfxN9XDC8VeY6ID4HKLZwBbEcCuZB?= =?us-ascii?Q?LcMbPk/QtmiuGAjGiyB/Cw7jhj/ttt/W1e4LnDmNz0z6HXFQJSsKrM1UJ8Mk?= =?us-ascii?Q?m70QfgSGd0krE8VxYZRklfxefDwlTPUbNDrcW/Al4X5FW9VdHyi3mSSwLXek?= =?us-ascii?Q?PbaeYXWXtQ5CaY15XntWS1rqWPLZ/BDGR6osxOIGs15eKSu3ahZ7UqGNXrIa?= =?us-ascii?Q?uI7dzd4WRGUIdOTbLEUo3fW4+Vk4bMT4bQgzY8rK6TLbz5qrt5ZzxTmmN9tx?= =?us-ascii?Q?7cQ+CIMUThkEHgxCQxFfDQGZwQM3PX6pCZh7EOsQZGKaBB1pfZ2Z4Lx7OBHD?= =?us-ascii?Q?bDnRy+jBxqijh87wbWUcs+4fMjGl21Sj1nkycik2CdTco6V3JnCNSukO32ui?= =?us-ascii?Q?3czyJJWpf0mnjsKE0gVTqUMpC3FWa3ZerpQQGXglJp/6pHDe/bptPZSFE/J/?= =?us-ascii?Q?+2F5k5HgqvcPlEOC6eXIQh6RzX71jD+6hW7Nhk0fkSPGjJhr1VCFrK4PZ7+V?= =?us-ascii?Q?3I31Bhf4jf2GHixSyrdmC7YPLEFRP0iIazzRqiSN/AEGQHXrrn0HSp/696CZ?= =?us-ascii?Q?/pMLKpMMyUPYSjpikpZErQsZ2l1pr66J+AVP8qkLZRqxknvEAS5pvgF6MDif?= =?us-ascii?Q?0pQ7wr7Z6Np1LiybH2nAXsSrplzO2HhJ2AVoFwff1Rp9mO9kXk13TLjFk3Pb?= =?us-ascii?Q?Jh7/iz0ZcQ1+weAwo8nw2QKBCqwtJq5nTFxG63mLCPVgi2cvh+qwjU6PHBS8?= =?us-ascii?Q?caBR+QJES9UX0RrMR1PLboO7Z8CrxDxdLjF+aeFinHHO8ndNa2uc0ZxghfAz?= =?us-ascii?Q?mktRibDyqHu7UI3kuoQ4kJib7W+mmAdW77WGehPK+IAY671P5huUN/NidBlj?= =?us-ascii?Q?Pe4QM7PDc9bnxckYzpUwPM9wUoXX/YnpP17d+9lDQx8aPO5g7T/aiYEK5QqZ?= =?us-ascii?Q?iXf9uCWXb9bvvjoLFs1MFFJvUGYL5x51RbJBCANLdj/u7fSyKeQwmc7G5dtN?= =?us-ascii?Q?8hqap+f+gY7BDjjCl+MxdR/hoaYNlPQIOAOoy9tgsQlNPY3ak6H56uhMZac1?= =?us-ascii?Q?W6VNif+YlnMhrCqPT+yY0a3ynGGylVbumgKVDrSpnXjzf4+EKZmXue2dy3cL?= =?us-ascii?Q?qjm08V1DwHxLjrxh02bOkFPJCGNgawAmQ0wPmOkXsds2+Tr0JuYXauI1xP6j?= =?us-ascii?Q?rXgQMyIN5KOMrM4Ss/Kishz7mCsrs9WVrEMcj/cENJm7C/e3qy5DlEzd171K?= =?us-ascii?Q?Gncp6Wx6oW5VCO4CGy6mpRI07EeVb7GOtu6X80YpfVFDDLsXCWsqDw1gZnRU?= =?us-ascii?Q?JtWiGLijqqmTFmDGYfTM9e+TVTm7wDuJ4Igq5HaVBMU2ei33vvoYJO7rvPkL?= =?us-ascii?Q?WGQqqpURuIquqKZzeTPozrBxGVQ54itefjWOj/gAZYCDg40REhDpJeTu019S?= =?us-ascii?Q?AjwrO2wkFwOWSBIzdQrVzHDBgS4uqfwnVUHGNIv7KluLR32XFAP56qJMcFjc?= =?us-ascii?Q?HbhcmMBN4QY5GXqVH7Q3MUO0K6fzqGTBX7Dd?= 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:ErrorRetry;CAT:NONE;SFS:(13230040)(82310400026)(61400799027)(376014)(36860700013);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:44.6326 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 04317a88-1fc1-4db4-c7e8-08ddef9450fd 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-CO1PEPF000066EC.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR19MB5756 X-Authority-Analysis: v=2.4 cv=f+FIBPyM c=1 sm=1 tr=0 ts=68c00fee cx=c_pps a=odStxYl4fA30BBTO3gVnUA==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=gujROYcaeV9tRZqipvkA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfXxqhM+72YUPRY F+OR7X+AhJWkIiy2gQ3x/+X23K8KvX5w+2ruEfjcas6+bpFk+7Ql+Y5t8YYo6HoQemIhtTcMcBd IbVDSIhN1pF2gxXZ+qaN45MlUvyPOk7BWd1tUmbQgr8g9aR4upn+9a94Qb+oVWUdCmKodwUXn/X wownFcs+b5smTjJfZpuWHuzuV+PF0YBsI9998j2itvWDuDZXydUZMoyMmKMb9u9vSkzIbbTXpTz HgZcXMkf38gk4VxCEKUeUdw2LVyiiZwcLhp/ARZgVqnmiQMeVzkcgRoEF9I4tlzbkfb788QAg1X YbN+fvp8nTtwK/qExuz8NkyPFwa5ZNfTZuDIDjDQsEAKaSwmu2owOYnzyjiuJM= X-Proofpoint-GUID: -6db9WgYa5wOpHTCQkc7iAlIE4CEH0hc X-Proofpoint-ORIG-GUID: -6db9WgYa5wOpHTCQkc7iAlIE4CEH0hc X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Search for an HP-specific EFI variable for calibration before falling back to the normal Cirrus Logic EFI variable. Future HP models will use an HP-defined EFI variable for storage of amp calibration data. The content is the same as the normal Cirrus Logic EFI variable. The first step in cs_amp_get_cal_efi_buffer() is to get the size of the EFI variable, so this has been made a loop that walks through an array of possible variables. A small change is needed to the KUnit test, which is included in this patch. Originally the cs_amp_lib_test_get_efi_variable() hook function asserted that the passed name and GUID matched the Cirrus Logic EFI variable. Obviously this will fail because the code now tries the HP definition first. The function has been changed to return EFI_NOT_FOUND instead, which emulates the normal behaviour of trying to get the HP variable on a system that has the Cirrus variable. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs-amp-lib-test.c | 5 ++-- sound/soc/codecs/cs-amp-lib.c | 37 ++++++++++++++++++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/sound/soc/codecs/cs-amp-lib-test.c b/sound/soc/codecs/cs-amp-l= ib-test.c index e7492afa041e..c090498cbf78 100644 --- a/sound/soc/codecs/cs-amp-lib-test.c +++ b/sound/soc/codecs/cs-amp-lib-test.c @@ -204,8 +204,9 @@ static efi_status_t cs_amp_lib_test_get_efi_variable(ef= i_char16_t *name, KUNIT_EXPECT_NOT_ERR_OR_NULL(test, guid); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, size); =20 - KUNIT_EXPECT_MEMEQ(test, name, expected_name, sizeof(expected_name)); - KUNIT_EXPECT_MEMEQ(test, guid, &expected_guid, sizeof(expected_guid)); + if (memcmp(name, expected_name, sizeof(expected_name)) || + efi_guidcmp(*guid, expected_guid)) + return -EFI_NOT_FOUND; =20 if (!buf) { *size =3D priv->cal_blob->size; diff --git a/sound/soc/codecs/cs-amp-lib.c b/sound/soc/codecs/cs-amp-lib.c index 9b51d056d863..8434d5196107 100644 --- a/sound/soc/codecs/cs-amp-lib.c +++ b/sound/soc/codecs/cs-amp-lib.c @@ -28,6 +28,24 @@ #define HP_SPEAKER_ID_EFI_GUID \ EFI_GUID(0xc49593a4, 0xd099, 0x419b, 0xa2, 0xc3, 0x67, 0xe9, 0x80, 0xe6, = 0x1d, 0x1e) =20 +#define HP_CALIBRATION_EFI_NAME L"SmartAmpCalibrationData" +#define HP_CALIBRATION_EFI_GUID \ + EFI_GUID(0x53559579, 0x8753, 0x4f5c, 0x91, 0x30, 0xe8, 0x2a, 0xcf, 0xb8, = 0xd8, 0x93) + +static const struct cs_amp_lib_cal_efivar { + efi_char16_t *name; + efi_guid_t *guid; +} cs_amp_lib_cal_efivars[] =3D { + { + .name =3D HP_CALIBRATION_EFI_NAME, + .guid =3D &HP_CALIBRATION_EFI_GUID, + }, + { + .name =3D CIRRUS_LOGIC_CALIBRATION_EFI_NAME, + .guid =3D &CIRRUS_LOGIC_CALIBRATION_EFI_GUID, + }, +}; + static int cs_amp_write_cal_coeff(struct cs_dsp *dsp, const struct cirrus_amp_cal_controls *controls, const char *ctl_name, u32 val) @@ -146,12 +164,17 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi= _buffer(struct device *dev) unsigned long data_size =3D 0; u8 *data; efi_status_t status; - int ret; + int i, ret; + + /* Find EFI variable and get size */ + for (i =3D 0; i < ARRAY_SIZE(cs_amp_lib_cal_efivars); i++) { + status =3D cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, + cs_amp_lib_cal_efivars[i].guid, + &data_size, NULL); + if (status =3D=3D EFI_BUFFER_TOO_SMALL) + break; + } =20 - /* Get real size of UEFI variable */ - status =3D cs_amp_get_efi_variable(CIRRUS_LOGIC_CALIBRATION_EFI_NAME, - &CIRRUS_LOGIC_CALIBRATION_EFI_GUID, - &data_size, NULL); if (status !=3D EFI_BUFFER_TOO_SMALL) return ERR_PTR(-ENOENT); =20 @@ -165,8 +188,8 @@ static struct cirrus_amp_efi_data *cs_amp_get_cal_efi_b= uffer(struct device *dev) if (!data) return ERR_PTR(-ENOMEM); =20 - status =3D cs_amp_get_efi_variable(CIRRUS_LOGIC_CALIBRATION_EFI_NAME, - &CIRRUS_LOGIC_CALIBRATION_EFI_GUID, + status =3D cs_amp_get_efi_variable(cs_amp_lib_cal_efivars[i].name, + cs_amp_lib_cal_efivars[i].guid, &data_size, data); if (status !=3D EFI_SUCCESS) { ret =3D -EINVAL; --=20 2.39.5 From nobody Wed Sep 10 01:55:24 2025 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 AE42424E4B4; Tue, 9 Sep 2025 11:30:49 +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=1757417451; cv=fail; b=JBDmr9JzHmou8gqPtARLM57fhh0cerzALEFzhkfX2Sc7dGyt8utzcFynJK4EnruRVvcFa15QroNtctjIMImRj+95lDrTyQaTKYQw8bmhMwnIElal3xsvpaYLA2kVyZqbdxEhh7GMj3q9T77ynCeCtWNvjJGZ5uxnjdawxl7+4sA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757417451; c=relaxed/simple; bh=UX2a9626cbBsUaao3klneHiVeMOb1jq7djsonZqHt0k=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=DP5hRuAoK/IeS0RQ9i9rcKRvv2DCJ6u4IAE0rM7a3XNTBe2LxT8YbaTdi+hBHGUxihF/E42zS6s+wn1nX+qDNIfKOFbIMXXCG90Jqdq3KDi8cTd6Qqpv5KA1xEZ3uBWPWOU49HrHby0Gyb0/8AP6IIIb1kQt7+hHv0nG1B5sGmc= 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=hoJn6sIU; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b=DWY8YXge; 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="hoJn6sIU"; dkim=pass (1024-bit key) header.d=cirrus4.onmicrosoft.com header.i=@cirrus4.onmicrosoft.com header.b="DWY8YXge" 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 588KSv8x1252531; Tue, 9 Sep 2025 06:30:47 -0500 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=p9kWuGXgOe4/EMRnrtltyKIXbwz9XbTjY/k/R5C8HvE=; b= hoJn6sIUMep4lfzo7gqLS+7oSEeMYcpZ6Kr/bHUy8N7gSdRCL8BAxP6WVFkA8lmI ldadcfKixDeJ4PCZ4oL4Xc/pZn7ieU/Et8RRtav0WoF9F/eET6ttrodDLw3BRmNk CoODBjlLt4eQxOEYMReFCfXPFk0xcjlXZZWqjmn5eGLk8Bj66wEYlAQcfBjkkzRs v1OBYe6wqvolcN5bg8xPcFFN1LCyqsbW8ScJGkF/JgdKrQhiHcjT/6/BH+XnSgf4 0kmPsgAqGxZ3vBEGui1PoYwJ9iAZC3cVPPlG70ULEA3iOkoo87a6cG36yfTYgNs3 /x0LNPSys28znHiwqQ/DfA== Received: from nam04-mw2-obe.outbound.protection.outlook.com (mail-mw2nam04on2133.outbound.protection.outlook.com [40.107.101.133]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 49227r91wp-1 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Tue, 09 Sep 2025 06:30:47 -0500 (CDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n2Qz71yneg9S4Fo12NyWQRgnrbEn/74Fvhoyb1bjZTUSia+G5YqD4KO5a64lYzobV27tbLIYCR2cAn9yk1ZfIO7++0+ZfAoFuKhlsM/GufSeZrLYBAk+pqORfmto9DVCyJ32GMEVVgCC0H8Pql1RYlVtVDoIYc7783TeExLOMMmVrhNNbwtRjN14H+dvatW47Ea1UcgqzRl+KlKZZ/7Ft04pbyzRWWQZ/J0Vew4t+S62aOo9zTMG9ydlWRdmFbpZIOs5fksNobWJAC0+iex+5eTg+jxSC/Sqi/OXGR9mbpFyxi2C1f+uhDpUCI4+Av6juAl5i+NTtmIg6931z6O6hw== 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=p9kWuGXgOe4/EMRnrtltyKIXbwz9XbTjY/k/R5C8HvE=; b=W8TPj2iu1FXlw798LXmhaGouto1ezTOlzzITHDR6B6+xXzxUX7pqWu2Hmm+bZGkKJNDQv7sJhaIIaU5EB4VJIJs4sjm1h3Csf9GKp6NzuKHpvHuzErjquxiWH7lAoz18vnVKAuhWLPrmeCr2d7YEeR76uvqZKWwP2qm7LYZQe3HyMfhZ2HkLhZoCo0gbxB0Ktc7tjwBB5jZV0HK8BQl6HzzZZU1mWtVWol2ov4Clr4syuv86zOAn8h0NR2HAJs7pAAPSSQBtz692MWbeceOudNM2LOEStQCD8vHGF+buZg3QAHmgvMGvfWbyuPk/ZypyDrcxV+cPv5Jlrir3fvofUA== 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=p9kWuGXgOe4/EMRnrtltyKIXbwz9XbTjY/k/R5C8HvE=; b=DWY8YXgebZUsCpJLpOh+uvGfowaIs+j1Xa6zuAREM109kcBrPxya7pTs8e6rV9WUazF5Mny1y9ltgKQwKkeUdmKXjWKB8VxEdhks94Zt8765egyBTk8yugjznfZ97MID/tdBne09fK6M+FI1sjDfwe1Z+OHLrwS0mCtd2NQdOyE= Received: from BLAP220CA0017.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:32c::22) by MN2PR19MB3887.namprd19.prod.outlook.com (2603:10b6:208:1ee::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9094.22; Tue, 9 Sep 2025 11:30:44 +0000 Received: from BL02EPF0002992B.namprd02.prod.outlook.com (2603:10b6:208:32c:cafe::45) by BLAP220CA0017.outlook.office365.com (2603:10b6:208:32c::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9094.22 via Frontend Transport; Tue, 9 Sep 2025 11:30:44 +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 BL02EPF0002992B.mail.protection.outlook.com (10.167.249.56) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9115.13 via Frontend Transport; Tue, 9 Sep 2025 11:30: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 52EDA406558; Tue, 9 Sep 2025 11:30:40 +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 4326982026B; Tue, 9 Sep 2025 11:30:40 +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 v2 6/6] ASoC: cs-amp-lib-test: Add test for getting cal data from HP EFI Date: Tue, 9 Sep 2025 12:30:39 +0100 Message-Id: <20250909113039.922065-7-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250909113039.922065-1-rf@opensource.cirrus.com> References: <20250909113039.922065-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: BL02EPF0002992B:EE_|MN2PR19MB3887:EE_ X-MS-Office365-Filtering-Correlation-Id: d98fa935-f938-427d-6c04-08ddef945091 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|61400799027|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?fL4gp5hcJU0lLDYtc3ZPfi/X0KeNkqhIgEdnFEVLCYv3T4XScar2dJ45MZye?= =?us-ascii?Q?l1s7R+vDA0KdFTPOjumCyr+hcckRYgxPA9QL+8DFcisNVjpMOADFq+Lldegn?= =?us-ascii?Q?M1DVU5/Qt5+6vqBOTZ3dZSj+Ivwc1iOtxottTAQfZSr+optUxvXgfgyYdm3P?= =?us-ascii?Q?VyYmY9RHDXyC2Y9d8EyUR3A9l6yT9BuGb4Q++DK8rR7Zxrtm+ud0htzhqquY?= =?us-ascii?Q?VqReDbUs5Q0YLI1R9Zr3Q6mGfmKApKjZBDOlXTGoUyPXHLo9JGp2UdnSl88J?= =?us-ascii?Q?995sS50iBPgKJLSdrgpDp1Qh+oqkiQC4XZU2maqKuigXS+KEbMV/p3HYOm7B?= =?us-ascii?Q?5HYZimgzJslPDSRn5CwReAmnKgInXNo0OocG56tFo4kn8GOvnyeuTg1c9WGa?= =?us-ascii?Q?FxwtC4g08NG5GonT6JulZoaWa+6Ztd8FlZQy4VBnZabjvL1KnFVtZQbHh1ap?= =?us-ascii?Q?g1bxNQWIFDFvbqV3lDIk8cp+7uSovmfUUcZj0481HRLHQ2/CGIb2NzeNtrrE?= =?us-ascii?Q?/EPIW8V0U7M2OEMzz3EYurAVNALA71d9ik4IInaU30Get0DNtq/Jd3mkB6eB?= =?us-ascii?Q?DFa9/iIZv48+rNrBN16Hzn7W4JJS0NnkkE7CuPi+1UaPk1t47+c0+F1QpC4h?= =?us-ascii?Q?VsXvwIr6TKoab7qJ4aXEwhyjFkAE8biiHp/H0MMhywNGnrOkEau2ds+WnW7y?= =?us-ascii?Q?zk62mpHitWDK7NwMh7IzdSB6SM9IkpK8sWVqnCkvbAZ3uQ91JZZ1+czM78kD?= =?us-ascii?Q?STRVSFIs/DobOfHL7h0PEt2fG0BZLOuQze3MLjAkoIUqztqxTeDXQe8KDAeG?= =?us-ascii?Q?B2i2OxDipv37aZ4fn4Fg1Yzbgk5g2WwLqVkNewzIzljRKir7LK+1Cf4JVJcu?= =?us-ascii?Q?qLC8gKshrlyYCEa/EHERgtZDH1GQqsPyxzQIbZEF4MtzstRu5ADWVL9v538C?= =?us-ascii?Q?FP2D80yqwJAeTt/MTrCbP2SSbQcCE0N++29vgPR4R8GO4U9KM/AqVgJ41hUG?= =?us-ascii?Q?POlsSgHFMtfq4crKJ9I0nHPpbN+xK4StOIDJVyMQilNmo6u6FVk+7yt/inIS?= =?us-ascii?Q?Y+61KT4JTInnc46lxbD0t2cKAIYFBNnCFTZTlmBMtPQZAAtLkcS0coeEzc9u?= =?us-ascii?Q?HzaVpORXGbs49g+EywZGNsKtJn699PmMcu8tDXAdbTnD0vi6lh3K/RMd1zeP?= =?us-ascii?Q?7Hvhg//bocrPvV/0ghiwz7tVgO+pXaQ1UBTjW3BqBMDL68nwLeIcGkf84yw1?= =?us-ascii?Q?gX82movnLKawvelaXVk1I8YnAhRE+kKIY4L0V7uFOYvTECYycGrVZDmfGX4d?= =?us-ascii?Q?IbI5BLCtsrQZAFKMXcDHM7qA1leFoTcjbn4CcO/REAqFW9MJDYSoVqN4PICE?= =?us-ascii?Q?IX7T81BK8X9+9nenU0WWWb415hJA/ojuQthCZI6+GJ3DnidjAy5WhT5dIYLx?= =?us-ascii?Q?rE9EK9+16yT2OIkrwm/RtacrZmQJ8DdecmPVruMVpnmZwNJdu22c8onQmV8K?= =?us-ascii?Q?li2wGcdOQ8PvWAdqB4CTHZW87ptgEcqMDDQw?= 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)(61400799027)(82310400026)(376014);DIR:OUT;SFP:1102; X-OriginatorOrg: opensource.cirrus.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Sep 2025 11:30:44.0250 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d98fa935-f938-427d-6c04-08ddef945091 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-BL02EPF0002992B.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR19MB3887 X-Authority-Analysis: v=2.4 cv=f+FIBPyM c=1 sm=1 tr=0 ts=68c00fe7 cx=c_pps a=dwieEWGYNhQf9SbSAXxshQ==:117 a=h1hSm8JtM9GN1ddwPAif2w==:17 a=6eWqkTHjU83fiwn7nKZWdM+Sl24=:19 a=z/mQ4Ysz8XfWz/Q5cLBRGdckG28=:19 a=wKuvFiaSGQ0qltdbU6+NXLB8nM8=:19 a=Ol13hO9ccFRV9qXi2t6ftBPywas=:19 a=yJojWOMRYYMA:10 a=s63m1ICgrNkA:10 a=RWc_ulEos4gA:10 a=w1d2syhTAAAA:8 a=erahUydJdZyVaCJA8SoA:9 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwOTA5MDExNCBTYWx0ZWRfX+w9qDb42MFR4 zQ31mRNp5qPMNMluLklddfjo2Z/27azXES/rZg7kqbwUX9dYTCQ4BwBt6UZroy7QoYc1T580v7N Jb8OSNshzKF4z+KmS4hGITzVYAffr5Y56nPXSpyUQptFHwIdTnai548xLnC+VN3QrXsDcHRBpXn h6aWJLEn0emgwowwnQMDj2p105Yi9dnCOPexs/JW9FH5DmCgFHbevE19X7GXJshqFX0IcvtFKdv i/1KnOz9xOn9vidK48sAKxt/UCiy3cGCyPmDCqKNwJb4Hn++gakDLPBaGDNeiG5DPDCU5E1GJhd krBeP+ilN73VBCSliLfKY8ViVTo9k+VPtJqeQGzimhxuS3qk8Fi+mx33yQIp28= X-Proofpoint-GUID: wOLYlauBfIUQInqtCGnPe_RKN2ZxB7yx X-Proofpoint-ORIG-GUID: wOLYlauBfIUQInqtCGnPe_RKN2ZxB7yx X-Proofpoint-Spam-Reason: safe Content-Type: text/plain; charset="utf-8" Add a test case that cs_amp_get_efi_calibration_data() returns data when it is in the HP-specific EFI variable. This uses redirected implementation of cs_amp_get_efi_variable() that only returns data if the passes name and GUID match the HP EFI variable. A simple test case installs this function hook and then checks that calibration data is returned. Signed-off-by: Richard Fitzgerald --- Change in v2: Removed unused target_uid variable and code that set it in cs_amp_lib_test_get_hp_efi_cal(). sound/soc/codecs/cs-amp-lib-test.c | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/sound/soc/codecs/cs-amp-lib-test.c b/sound/soc/codecs/cs-amp-l= ib-test.c index c090498cbf78..2fde84309338 100644 --- a/sound/soc/codecs/cs-amp-lib-test.c +++ b/sound/soc/codecs/cs-amp-lib-test.c @@ -220,6 +220,56 @@ static efi_status_t cs_amp_lib_test_get_efi_variable(e= fi_char16_t *name, return EFI_SUCCESS; } =20 +static efi_status_t cs_amp_lib_test_get_hp_cal_efi_variable(efi_char16_t *= name, + efi_guid_t *guid, + unsigned long *size, + void *buf) +{ + static const efi_char16_t expected_name[] =3D L"SmartAmpCalibrationData"; + static const efi_guid_t expected_guid =3D + EFI_GUID(0x53559579, 0x8753, 0x4f5c, 0x91, 0x30, 0xe8, 0x2a, 0xcf, 0xb8,= 0xd8, 0x93); + struct kunit *test =3D kunit_get_current_test(); + struct cs_amp_lib_test_priv *priv =3D test->priv; + + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, name); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, guid); + KUNIT_EXPECT_NOT_ERR_OR_NULL(test, size); + + if (memcmp(name, expected_name, sizeof(expected_name)) || + efi_guidcmp(*guid, expected_guid)) + return -EFI_NOT_FOUND; + + if (!buf) { + *size =3D priv->cal_blob->size; + return EFI_BUFFER_TOO_SMALL; + } + + KUNIT_ASSERT_GE_MSG(test, ksize(buf), priv->cal_blob->size, "Buffer to sm= all"); + + memcpy(buf, priv->cal_blob, priv->cal_blob->size); + + return EFI_SUCCESS; +} + +/* Get cal data block from HP variable. */ +static void cs_amp_lib_test_get_hp_efi_cal(struct kunit *test) +{ + struct cs_amp_lib_test_priv *priv =3D test->priv; + struct cirrus_amp_cal_data result_data; + int ret; + + cs_amp_lib_test_init_dummy_cal_blob(test, 2); + + kunit_activate_static_stub(test, + cs_amp_test_hooks->get_efi_variable, + cs_amp_lib_test_get_hp_cal_efi_variable); + + ret =3D cs_amp_get_efi_calibration_data(&priv->amp_dev->dev, 0, 0, &resul= t_data); + KUNIT_EXPECT_EQ(test, ret, 0); + + KUNIT_EXPECT_MEMEQ(test, &result_data, &priv->cal_blob->data[0], sizeof(r= esult_data)); +} + /* Get cal data block for a given amp, matched by target UID. */ static void cs_amp_lib_test_get_efi_cal_by_uid_test(struct kunit *test) { @@ -910,6 +960,7 @@ static struct kunit_case cs_amp_lib_test_cases[] =3D { KUNIT_CASE(cs_amp_lib_test_get_efi_cal_no_uid_index_not_found_test), KUNIT_CASE(cs_amp_lib_test_get_efi_cal_no_uid_no_index_test), KUNIT_CASE(cs_amp_lib_test_get_efi_cal_zero_not_matched_test), + KUNIT_CASE(cs_amp_lib_test_get_hp_efi_cal), KUNIT_CASE_PARAM(cs_amp_lib_test_get_efi_cal_by_uid_test, cs_amp_lib_test_get_cal_gen_params), KUNIT_CASE_PARAM(cs_amp_lib_test_get_efi_cal_by_index_unchecked_test, --=20 2.39.5