From patchwork Thu Jul 7 15:10:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 12909827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F13B0C43334 for ; Thu, 7 Jul 2022 15:11:48 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 62CC984B; Thu, 7 Jul 2022 17:10:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 62CC984B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1657206706; bh=9abPVIndiZPHCiF770UwSESMYusRoC6N2T5j84YtP0M=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=OziXZ7dtEnsZhVGGtjoI8senek1nOmENFbl7d/d0IHJxDUlBPoYZpxhWkz9T7K+Fz XIyRE7tZtZAQNIWmBxK045SF0KZdsPn/2cGBWt34naxx116wPkPEUWP8/SvQzzZfsU w3BatEWMb/8HAXBYGajm+JpnlQV/TNvipxA7j6ro= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E1DBFF8028D; Thu, 7 Jul 2022 17:10:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B9996F8028D; Thu, 7 Jul 2022 17:10:54 +0200 (CEST) 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 alsa1.perex.cz (Postfix) with ESMTPS id D7D61F80104 for ; Thu, 7 Jul 2022 17:10:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D7D61F80104 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="Q0zLmSEU" Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 267BU6Jh020187; Thu, 7 Jul 2022 10:10:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=kbe+Cs9YYhGN2CUMNc8/yCRLFrEnli9igyLJqvC0TCg=; b=Q0zLmSEUeLSqSW32Tagj909zKr/+dMCz5lTxPrlhLhoKtH1UyEkwK6xTT90rcMFRkA2O piG3/neQ/B4RLeL8Cookhey97u6yI6koT1Gdz1iQK7jKYTnKK/hkjabkPHmVQ0zm3lVK a9K0nBbcOm5H0iOADQYbbv8L2WmjTxLmVuTQ6wxXXTcQeN4q3TG9iK/tvbvhcuOIgl9n fcc5RXjRVEG+7CcQzy9UocoL3W9EwWBL9Uy0MhVAiqBWyBzmSKQual92V8IJnB1eUjU6 dFMzmORPFQeEWGxycyJdHsQvn3LM0P1nqYBeYIJtcHbPFfumkFyRlNTG9H9UTMqNhWyi 7Q== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3h4ucmjr6f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 07 Jul 2022 10:10:46 -0500 Received: from ediex02.ad.cirrus.com (198.61.84.81) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Thu, 7 Jul 2022 16:10:44 +0100 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1118.9; Thu, 7 Jul 2022 10:10:43 -0500 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2375.28 via Frontend Transport; Thu, 7 Jul 2022 16:10:43 +0100 Received: from sbinding-cirrus-dsktp.ad.cirrus.com (NEWBNB750653-PC.ad.cirrus.com [198.90.238.195]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 2076B2A9; Thu, 7 Jul 2022 15:10:43 +0000 (UTC) From: Stefan Binding To: "Rafael J . Wysocki" , Len Brown , Mark Brown , Liam Girdwood Subject: [PATCH v6 0/2] Read _SUB from ACPI to be able to identify firmware Date: Thu, 7 Jul 2022 16:10:35 +0100 Message-ID: <20220707151037.3901050-1-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: OZC9w9_PtZjU2C4sUcXR2oFOOsf6bZ3W X-Proofpoint-ORIG-GUID: OZC9w9_PtZjU2C4sUcXR2oFOOsf6bZ3W X-Proofpoint-Spam-Reason: safe Cc: linux-acpi@vger.kernel.org, alsa-devel@alsa-project.org, Stefan Binding , linux-kernel@vger.kernel.org, patches@opensource.cirrus.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" CS35L41 has a DSP which is able to run firmware, as well as a tuning file. Different systems may want to use different firmwares and tuning files, and some firmwares/tunings may not be compatible with other systems. To allow a system to select the correct fimware/tuning, we can read an _SUB from the ACPI. This _SUB can then be used to uniquely identify the system in the firmware/tuning file name. Add a helper function which reads the _SUB, so this can be used by other parts in the future. Add support inside the CS35L41 ASoC driver to read this _SUB, and save it appropriately. Changes since v5: - Clean up return codes - Refactor length calculation - Allow fallback to existing behaviour when bad ACPI is detected Changes since v4: - Rename function Changes since v3: - Fix 32 bit format string warning Changes since v2: - Fix error in function prototype Changes since v1: - Add length validation for SSID String - Rename API - Allocate memory inside API - Use ACPI_HANDLE macro instead of ACPI_COMPANION - Improve error handling Stefan Binding (2): ACPI: utils: Add api to read _SUB from ACPI ASoC: cs35l41: Read System Name from ACPI _SUB to identify firmware drivers/acpi/utils.c | 38 ++++++++++++++++++++++++++++++++++++++ include/linux/acpi.h | 6 ++++++ sound/soc/codecs/cs35l41.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+)