From nobody Sun Apr 5 13:05:41 2026 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 8246121B191 for ; Sun, 1 Mar 2026 21:34:05 +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=1772400847; cv=none; b=d3+Ag9RAvs4Pkgnog3II67ZAIgUp16pwTxkz1MS8zTWBPXQbnTyRZBZJMzaadcM6s8DSDsnYXS62MaqRyn2Dz/J7ABUUMKWI/9epYSYzxuMxC4KrN6RlTT2AEXc/BhkWcWZ/HAfRbTuwjAwmLXmWKwFETvW6mHjbZO8KBx3gkh8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772400847; c=relaxed/simple; bh=lM8CSz0ZAgw0noIwUoYPin1QYbAEN1swuFeYfH8WiOM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PJ/3QCLmW4R3HFT66+nxjqe935QdG3lZ0lJQXCVlXDDhduKOMIYjnVQSg7uIFfwVjW0PkNqxC8qMSPGCh5YiqPP69jHLucyUVFXz2fMsA2B4129r1J4595UoAArGNr4FzHMBjcQO6WDnhekrX92GxXAzEx4wpOsw8P7kx+9ZtcE= 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=gSp3pcBr; 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="gSp3pcBr" Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-65f71ed7c6cso6560508a12.0 for ; Sun, 01 Mar 2026 13:34:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772400844; x=1773005644; 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=EsG6AI7p1nqWRSx0MJDSqDIjQsSAz68j9rdPzL7TnOQ=; b=gSp3pcBrTYthFKdr+28ysev2KbbT8wC/3BvwYOIKFUkvCqXcJzgEJ3EgaxXNNsGVUE WX71cZcwjSaUCUkj3xgJNsGX+1sZcBya3iT+fj8VKsv1J647DpcaD48ndIjf1Ou0KrQu DjcxhtAlTEhMENy+3/Feha++OgaGgBkr0XHi2fllklwmkO+Ld6vmvYuSeUsh7o61yhum 2XMmawFHV2VSM31pZIhVdceXzqj/F/z+rQHSfWYXEh9emS28P3x7ugXU7/2aFDShvlwP cIv+IJQCjSqFkSRhA56k9jCYStKxl7PqhPxSIYrMpuj0krD0l8WulyfwFOKEaCTHFm9s 3lWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772400844; x=1773005644; 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=EsG6AI7p1nqWRSx0MJDSqDIjQsSAz68j9rdPzL7TnOQ=; b=IzuvAogvMgFdXa9fJzhzH0hidyf/oI3f24cRA0aUJDJ0c/xGv4Pq9CusKaz3ryw+8o jnJXMHFZJXtuIAReJGznmhT1y2ktqOE4lOnH/dj+MgrcblnXJDp7zq7qbYKMkc7QjfND xLjNLvYdwPElGGsJTNrdNNStUzYSDIo2RTSnhx8HEnhE0N/onfFGKjF3RCfmVugd+4iS wC+e1PoOLeZYewIAt+Qxl422AoYMdv7Y0PngUByk8UsaHchX6ub1v0/iMqmFUex84ooS 8xLjaDmHXzoYLHHTEkIkP0fMtxOFxJTYZ7ynKjOTTmGcnefVYCenQmo7LQtiZuk0ZLL2 MGjw== X-Forwarded-Encrypted: i=1; AJvYcCVmiQonHmmuq+BGxQn8hu1clWfrQFqaYdUxn69/Z+AWojieFhyWweU478wEcnNcIQEJ0oZUj38Dc240fuY=@vger.kernel.org X-Gm-Message-State: AOJu0YxGzyn/fvvwghuAvsF/ezVmW4KzH8CC4Epc7Q0u8CFT47q1YCKQ ui7toH349QqUgNYhv6Olm+TeWaQRoAkf9N2NV2jEHuL6ZTMMhPfQzJdJcj85pd7T X-Gm-Gg: ATEYQzzEX6GQShlrbXTwjdaMGb7kNd49CbZpRMou89Jk1Smza+Tus91PvdEccUfj587 Eh3GSz0876swG11j3+XFjksC+aek00HigqZvmxnlY7RoHeLZ9RyeauKhntbVKRi5630FPhgfHpI TxubHw0YdUqCsjWrl0tgRAe1XdqtYrMgfTA4hLdg/8/AfooJYyHNV3v+lt+6BZjbyFPqxA0szTP TtfaAKJsuGQuIaGug59itEkxnhWk1EME7WO4QJSiYGfkb3DdvOKKMmNUs9AwPTa0Q6wGIPYwiVO 85tfjIzP3+Xun8sIKbiHjEIzr4O4LWUNqSrLkWFD33muphkn7tHu91WBQ41afPIBkYolngVVcNN JGEdPXGxM6w3zi1SNDNbq4Qyzaw1yWV/Z38CAz/SwrZ3/k4fwMnqZ1v4ggbDzaGfSFVAXEP6esU f9chO1+I1PAqaLdsoizA== X-Received: by 2002:a05:6402:2755:b0:65f:830b:1034 with SMTP id 4fb4d7f45d1cf-65fdd6bd91bmr6814260a12.6.1772400843423; Sun, 01 Mar 2026 13:34:03 -0800 (PST) Received: from [127.0.1.1] ([46.251.53.180]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-65fabf6cfd9sm2934793a12.22.2026.03.01.13.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2026 13:34:02 -0800 (PST) From: Yauhen Kharuzhy Date: Sun, 01 Mar 2026 23:33:44 +0200 Subject: [PATCH v2 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: quoted-printable Message-Id: <20260301-asoc-yogabook-v2-v2-1-adcc7ed40985@gmail.com> References: <20260301-asoc-yogabook-v2-v2-0-adcc7ed40985@gmail.com> In-Reply-To: <20260301-asoc-yogabook-v2-v2-0-adcc7ed40985@gmail.com> To: Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Pierre-Louis Bossart , Mark Brown 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=1772400841; l=5864; i=jekhor@gmail.com; s=20260301; h=from:subject:message-id; bh=lM8CSz0ZAgw0noIwUoYPin1QYbAEN1swuFeYfH8WiOM=; b=JbfeDRs0yg23M6QPpyUd9mijcWCGHTNQAind0YtJfZwW2pOefIal+eeifYIbbPxb0yp4Siij/ XHH9bCRvrSsAYfvUV4+Z9vUdy+tEYyk/r4pZsPmiR3WFeNc7RWGTenm 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..57097c1d011e 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 =20 -static unsigned long cht_machine_id; - -#define CHT_SURFACE_MACH 1 +static struct snd_soc_acpi_mach cht_surface_mach =3D { + .id =3D "10EC5640", + .drv_name =3D "cht-bsw-rt5645", + .fw_filename =3D "intel/fw_sst_22a8.bin", + .board =3D "cht-bsw", + .sof_tplg_filename =3D "sof-cht-rt5645.tplg", +}; =20 -static int cht_surface_quirk_cb(const struct dmi_system_id *id) -{ - cht_machine_id =3D CHT_SURFACE_MACH; - return 1; -} +static struct snd_soc_acpi_mach cht_lenovo_yoga_tab3_x90_mach =3D { + .id =3D "10WM5102", + .drv_name =3D "bytcr_wm5102", + .fw_filename =3D "intel/fw_sst_22a8.bin", + .board =3D "bytcr_wm5102", + .sof_tplg_filename =3D "sof-cht-wm5102.tplg", +}; =20 static const struct dmi_system_id cht_table[] =3D { { - .callback =3D cht_surface_quirk_cb, + .driver_data =3D (void *)&cht_surface_mach, .matches =3D { 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 =3D (void *)&cht_lenovo_yoga_tab3_x90_mach, + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), + DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"), + }, + }, { } }; =20 -static struct snd_soc_acpi_mach cht_surface_mach =3D { - .id =3D "10EC5640", - .drv_name =3D "cht-bsw-rt5645", - .fw_filename =3D "intel/fw_sst_22a8.bin", - .board =3D "cht-bsw", - .sof_tplg_filename =3D "sof-cht-rt5645.tplg", -}; - static struct snd_soc_acpi_mach *cht_quirk(void *arg) { struct snd_soc_acpi_mach *mach =3D arg; + const struct dmi_system_id *match; =20 - dmi_check_system(cht_table); - - if (cht_machine_id =3D=3D CHT_SURFACE_MACH) - return &cht_surface_mach; + match =3D dmi_first_match(cht_table); + if (match) + return (struct snd_soc_acpi_mach *)match->driver_data; else return mach; } =20 +static struct snd_soc_acpi_mach *cht_quirk_nocodec(void *arg) +{ + struct snd_soc_acpi_mach *mach =3D cht_quirk(arg); + + return mach =3D=3D 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 DS= DTs @@ -75,38 +91,6 @@ static struct snd_soc_acpi_mach *cht_ess8316_quirk(void = *arg) return arg; } =20 -/* - * 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[] =3D { - { - /* Lenovo Yoga Tab 3 Pro YT3-X90, codec missing from DSDT */ - .matches =3D { - 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 =3D { - .id =3D "10WM5102", - .drv_name =3D "bytcr_wm5102", - .fw_filename =3D "intel/fw_sst_22a8.bin", - .board =3D "bytcr_wm5102", - .sof_tplg_filename =3D "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 =3D { .num_codecs =3D 2, .codecs =3D { "10EC5640", "10EC3276" }, @@ -208,14 +192,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cherrytr= ail_machines[] =3D { .sof_tplg_filename =3D "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 =3D "808622A8", - .machine_quirk =3D lenovo_yt3_x90_quirk, + .machine_quirk =3D cht_quirk_nocodec, }, =20 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_BYT_CHT_NOCODEC_MACH) --=20 2.51.0