From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87C693BB69D for ; Wed, 10 Jun 2026 23:52:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781135536; cv=none; b=rXV/zupbRCza4qtAsj0qGvlb/5nL+akEfp2NNjM/29mTjzGPjzkatZ1VsR/9NmrolbNcLx/VM28Vc1h3YdN2WTNQGrNOCSMW/SDvZKvsLY+U/nFUF4+ORgHXuFmGk0M+mUf+Wvuc8Y/+Nh2sRGntvDuGmfYS1jI3teYuVhaz4nw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781135536; c=relaxed/simple; bh=KCapcH04GnQHTviEX00pHFF1ryFIL2Xzijj8JcWrcA8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WFlicJXjVSG9ny6Cl8opKM+advgGi8PgfE7llw599yyI1aTgcYuRLL371UKzdys9f/Sg1ujgEDPztiOlRgU9AZvAS3uWOw+OCNIE4psLPY4Bat2W4qwgy7qMgnFu3wtDFmKDMrOKSO4nhVNBwHG9+30nwt0wAsy0rOzCp8K/D+0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=KgBjv6At; arc=none smtp.client-ip=209.85.208.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KgBjv6At" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-68f36e1663cso13218714a12.3 for ; Wed, 10 Jun 2026 16:52:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781135531; x=1781740331; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=E6H99sHoIWKNuVB0cS6tuVXAWbJCFFw3FoZpbc6aip4=; b=KgBjv6AtA/UYA5rej+CIsAMcWeTGQAKYO2k/ktqSCfnqdnzgbmFVlU8mYEq2OPSzbk 6CZG7z5BlzpwEfJjljvtjzTunFDn4YyXp8sVrcNZdE+JwxAIZSG3P+DfyWtWFSw3ZPQs zMtEYTneSQ2wegPJB+4jcM+2AUMMPyzSl2hbHB0ypioE0+RD9LHcG5bpwiWgkXz8ANTO ZrrJLg7hEE7W+LXvPsyOEloEelY/U2M0qYf4PmBNSnCpa9Ir+YIJsyx1HImXRfho8qSD 87xYJ1zrziIUoHa56lFm/xE/Vertnua+4rldiov4B6vvkSS8Cg0Ij6hjddAUqhISJ+Lu 4lPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781135531; x=1781740331; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=E6H99sHoIWKNuVB0cS6tuVXAWbJCFFw3FoZpbc6aip4=; b=mFhWinKAFMRq6EUct41h25nizOZiMAdWp+D33V7aeBZU00cuR8e6lWJ4meZpCA8Syl /ENqXYpBJCcacQ7scRK0BinnCMDakiuD/tRVp6dvJTIBpTmB6hf3J7EchORNSZttQeLq /mmoOOFHMH96LNfKGQX1aR3eJJ0tmD98XU5xnLMLFnSuJYcis1kjWA3QEj07NAeo/uNZ TNlBMceFB6A+yJTvnnoTV793g4pzQWJ3+rlsYrggD7VM/6eRYW4EnckoW2J2H+ZBv7YB JnBMs9E/1EQXU/ITjocGD0Hs5xLWc12cmrCSCCXjUydvp8FgDXX9sas30gxs6oljaa6T QrzQ== X-Forwarded-Encrypted: i=1; AFNElJ8sOAvV9c/a+fFCDqTwFpuD7tlEP+6VoRJRZkO5mnUDcNhDSsGb/oZ71+27a3upkPmz1NC+QKStdP6rINM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8VmFH4G9dYSIWNy5AVh3joMpKnAPJ7NqUVWUPI+Ht5a6QBYgn OcKtWp+4h9j40jYxBzCN1i94R+xZqlw7P9i7v0XHKmxrBJ6Xobdj+/gD X-Gm-Gg: Acq92OFmuRBvw5SPu51P7L+ODie+TWDNrajRwaRgPgnfP/bcXYBOHCgTzBVX9gWn8ne +Bddxpp7y7LTCsq/s+2NkwhMSYrX7JZYopdwmWIG0d/uwY94bEdNHgLOmAJqQhXXJBZjYT472oy K7MAWPpkTXrfZmRh3Wx76ckP0zdYPTr3n4WB/S0dREt76kazmwbZ/8xLvS0sy1lb+I2whtejGlu mGqz9qhc1uBjdl1OUmIqLz//YHHBSi4aL3s3c+B8kFW+6wsza/PJATIzNsi8DZ4STRLzoLg1Rdd L96biCEnevnmflwcHQqpjfOlyfb6LrBml6jcApNbnU1PPRY8gNz+4U3copGlbbOsJLg1so8J2AO eKnzzH0GhtO/bccqK5N7qyxeMWUzn5G58zno2saaus+SgCV6O4NEOJk+Q3+4+5ZGmy0P7DxdsHe K/RBSwc2PQQFVKodv443gwG39UwsBq X-Received: by 2002:a17:907:9702:b0:bed:4f1f:bf9f with SMTP id a640c23a62f3a-bfc855337d8mr2716766b.5.1781135530677; Wed, 10 Jun 2026 16:52:10 -0700 (PDT) Received: from [127.0.1.1] ([46.251.53.180]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bf054e03716sm1225741366b.34.2026.06.10.16.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2026 16:52:10 -0700 (PDT) From: Yauhen Kharuzhy Date: Thu, 11 Jun 2026 02:51:55 +0300 Subject: [PATCH v3 1/3] ASoC: Intel: soc-acpi-cht: Unify device quirks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260611-asoc-yogabook-v2-v3-1-3128447b67b6@gmail.com> References: <20260611-asoc-yogabook-v2-v3-0-3128447b67b6@gmail.com> In-Reply-To: <20260611-asoc-yogabook-v2-v3-0-3128447b67b6@gmail.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede , Yauhen Kharuzhy X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781135528; l=5862; i=jekhor@gmail.com; s=20260301; h=from:subject:message-id; bh=KCapcH04GnQHTviEX00pHFF1ryFIL2Xzijj8JcWrcA8=; b=Yo4qIXbPba2P7yyvuj8ifINTPJcCkc75oiJmm/mCr5Jr8yFiV/SKp26JqK220FTDUUgOlkhBV VT3a+EfT/k/DhydkK4RMPoMIpgOE8bLydoJem0PKjHYNzSqqGECQG1e X-Developer-Key: i=jekhor@gmail.com; a=ed25519; pk=C/csaZJs7UBNDgeJcUAmPu4ntqNeaZ3BKfBQiH8tuGc= This file contains two types of quirks, both checking DMI for machine-specific strings and returning machine data for a matching entry. The first one, `cht_quirk`, is used to override the default entry for an existing ACPI codec node if the node's info is invalid. It returns either the matched machine data or the default entry if no match is found. The second one, `cht_yt3_quirk_cb`, is used for devices (originally the Lenovo Yoga Tab 3 Pro) without a valid codec DSDT entry. It is bound to the SST ACPI node and returns either the matched machine data or NULL if no match is found. To allow adding new machine entries to the second case and to use a single DMI match entry for both cases (for example, if two variants of one device exist: one with a valid ACPI entry and one without, like the Lenovo Yoga Book YB1-X91 and YB1-X90 - Windows and Android versions), reorganize these quirks functions to use the same approach: machine data is set in the matched dmi_system_id entry as driver_data field. Signed-off-by: Yauhen Kharuzhy --- sound/soc/intel/common/soc-acpi-intel-cht-match.c | 100 +++++++++------------- 1 file changed, 42 insertions(+), 58 deletions(-) diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c index e4c3492a0c28..28f600171f9d 100644 --- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c +++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c @@ -9,47 +9,63 @@ #include #include -static unsigned long cht_machine_id; - -#define CHT_SURFACE_MACH 1 +static struct snd_soc_acpi_mach cht_surface_mach = { + .id = "10EC5640", + .drv_name = "cht-bsw-rt5645", + .fw_filename = "intel/fw_sst_22a8.bin", + .board = "cht-bsw", + .sof_tplg_filename = "sof-cht-rt5645.tplg", +}; -static int cht_surface_quirk_cb(const struct dmi_system_id *id) -{ - cht_machine_id = CHT_SURFACE_MACH; - return 1; -} +static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = { + .id = "10WM5102", + .drv_name = "bytcr_wm5102", + .fw_filename = "intel/fw_sst_22a8.bin", + .board = "bytcr_wm5102", + .sof_tplg_filename = "sof-cht-wm5102.tplg", +}; static const struct dmi_system_id cht_table[] = { { - .callback = cht_surface_quirk_cb, + .driver_data = (void *)&cht_surface_mach, .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), }, }, + { + /* + * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS + * has a buggy DSDT with the codec not being listed at all. + */ + .driver_data = (void *)&cht_lenovo_yoga_tab3_x90_mach, + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"), + }, + }, { } }; -static struct snd_soc_acpi_mach cht_surface_mach = { - .id = "10EC5640", - .drv_name = "cht-bsw-rt5645", - .fw_filename = "intel/fw_sst_22a8.bin", - .board = "cht-bsw", - .sof_tplg_filename = "sof-cht-rt5645.tplg", -}; - static struct snd_soc_acpi_mach *cht_quirk(void *arg) { struct snd_soc_acpi_mach *mach = arg; + const struct dmi_system_id *match; - dmi_check_system(cht_table); - - if (cht_machine_id == CHT_SURFACE_MACH) - return &cht_surface_mach; + match = dmi_first_match(cht_table); + if (match) + return (struct snd_soc_acpi_mach *)match->driver_data; else return mach; } +static struct snd_soc_acpi_mach *cht_quirk_strict(void *arg) +{ + struct snd_soc_acpi_mach *mach = cht_quirk(arg); + + return mach == arg ? NULL : mach; +} + /* * Some tablets with Android factory OS have buggy DSDTs with an ESSX8316 device * in the ACPI tables. While they are not using an ESS8316 codec. These DSDTs @@ -75,38 +91,6 @@ static struct snd_soc_acpi_mach *cht_ess8316_quirk(void *arg) return arg; } -/* - * The Lenovo Yoga Tab 3 Pro YT3-X90, with Android factory OS has a buggy DSDT - * with the coded not being listed at all. - */ -static const struct dmi_system_id lenovo_yoga_tab3_x90[] = { - { - /* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */ - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), - DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"), - }, - }, - { } -}; - -static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach = { - .id = "10WM5102", - .drv_name = "bytcr_wm5102", - .fw_filename = "intel/fw_sst_22a8.bin", - .board = "bytcr_wm5102", - .sof_tplg_filename = "sof-cht-wm5102.tplg", -}; - -static struct snd_soc_acpi_mach *lenovo_yt3_x90_quirk(void *arg) -{ - if (dmi_check_system(lenovo_yoga_tab3_x90)) - return &cht_lenovo_yoga_tab3_x90_mach; - - /* Skip wildcard match snd_soc_acpi_intel_cherrytrail_machines[] entry */ - return NULL; -} - static const struct snd_soc_acpi_codecs rt5640_comp_ids = { .num_codecs = 2, .codecs = { "10EC5640", "10EC3276" }, @@ -208,14 +192,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytrail_machines[] = { .sof_tplg_filename = "sof-cht-src-50khz-pcm512x.tplg", }, /* - * Special case for the Lenovo Yoga Tab 3 Pro YT3-X90 where the DSDT - * misses the codec. Match on the SST id instead, lenovo_yt3_x90_quirk() - * will return a YT3 specific mach or NULL when called on other hw, - * skipping this entry. + * Special case for devices where the DSDT misses the codec. Match on + * the SST id instead, cht_quirk_nocodec() will return a + * device-specific mach for matched device or NULL when called on other + * hw, skipping this entry. */ { .id = "808622A8", - .machine_quirk = lenovo_yt3_x90_quirk, + .machine_quirk = cht_quirk_strict, }, #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) -- 2.53.0