From patchwork Tue Jul 5 02:09:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1652212 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=exX9x/1o; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LcR1w4bGjz9sGg for ; Tue, 5 Jul 2022 12:09:23 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1o8Y02-0000MN-2q; Tue, 05 Jul 2022 02:09:14 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1o8Y00-0000MB-6Q for kernel-team@lists.ubuntu.com; Tue, 05 Jul 2022 02:09:12 +0000 Received: from localhost.localdomain (unknown [112.103.143.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 74B203F382 for ; Tue, 5 Jul 2022 02:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656986951; bh=Ia/WnHyUcGP0aG4tIaE0mTAyqaKUeuGEdE8HE6HFpuE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=exX9x/1oINelYaw2l4eLgbukjU9YM/QD65DyGSr/PmNjYBQeIij3Ovr6EFFU9DlZN bwoWKAQ9JQq/9P0eP7KE2u5Zj7dkVKSRZ2gtEKh60YnBHk2zL83QUi9mSg+Hwo773+ ogTk1W7C2XHLBrgEpMaw4XnAvT2lCYOa/5n9snz35OjDGOap5OyRvtD8XBWyZ3JZEa jmMXQtvM78t6GwP2DzhpLKL6gXq3seKFsfDx+RRKiDJ7YuF6q7rkiAXaUjZcs9C47W 0JqlLzaMw0lhnjjvUH2K2/itswboZgXJZweykliYEj8rTQjSQ1y5qBbFhfIYdNCZZy R2HPklsqkTppw== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.14/OEM-5.17][PATCH 1/2] ASoC: amd: Add driver data to acp6x machine driver Date: Tue, 5 Jul 2022 10:09:00 +0800 Message-Id: <20220705020901.11868-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220705020901.11868-1-hui.wang@canonical.com> References: <20220705020901.11868-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mario Limonciello BugLink: https://bugs.launchpad.net/bugs/1980700 Currently all of the quirked systems use the same card and so the DMI quirk list doesn't contain driver data. Add driver data to these quirks and then check the data was present or not. This will allow potentially setting quirks for systems with faulty firmware that claims to have a DMIC but doesn't really. Signed-off-by: Mario Limonciello Link: https://lore.kernel.org/r/20220411134532.13538-2-mario.limonciello@amd.com Signed-off-by: Mark Brown (cherry picked from commit e521f087780d07731e8c950f2f34d08358c86bc9) Signed-off-by: Hui Wang --- sound/soc/amd/yc/acp6x-mach.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c index 9a767f47b89f..959b70e8baf2 100644 --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -45,108 +45,126 @@ static struct snd_soc_card acp6x_card = { static const struct dmi_system_id yc_acp_quirk_table[] = { { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D2"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D3"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D4"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D5"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CF"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CG"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CQ"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CR"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21AW"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21AX"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21BN"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21BQ"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CH"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CJ"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CK"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21CL"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D8"), } }, { + .driver_data = &acp6x_card, .matches = { DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "21D9"), @@ -157,18 +175,21 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { static int acp6x_probe(struct platform_device *pdev) { + const struct dmi_system_id *dmi_id; struct acp6x_pdm *machine = NULL; struct snd_soc_card *card; int ret; - const struct dmi_system_id *dmi_id; + /* check for any DMI overrides */ dmi_id = dmi_first_match(yc_acp_quirk_table); - if (!dmi_id) + if (dmi_id) + platform_set_drvdata(pdev, dmi_id->driver_data); + + card = platform_get_drvdata(pdev); + if (!card) return -ENODEV; - card = &acp6x_card; acp6x_card.dev = &pdev->dev; - platform_set_drvdata(pdev, card); snd_soc_card_set_drvdata(card, machine); ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) { From patchwork Tue Jul 5 02:09:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1652214 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=MeUzpszy; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LcR1w6XCsz9sGv for ; Tue, 5 Jul 2022 12:09:24 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1o8Y06-0000OB-8C; Tue, 05 Jul 2022 02:09:18 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1o8Y04-0000Mf-Bs for kernel-team@lists.ubuntu.com; Tue, 05 Jul 2022 02:09:16 +0000 Received: from localhost.localdomain (unknown [112.103.143.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id B337F3F382 for ; Tue, 5 Jul 2022 02:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1656986953; bh=QQ3hMDwQRPlTI9r7x9CuqmRfdP2u2ZDAmAgMv/sydCE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MeUzpszymWllb6KrP8JNS9NqITMLudErgShI4af1Z++rwdGQ85hriqxwFn+TjJ2vv 7V+pyVXpeVspzFipr18EBMNA3+KgID7ImjvlYydTjSsOiXhDKcPSdVsvTi+DboCpZq 6k0uk3HIpK+/KJhtENYi7Fw9POcMH2EpOZ/8yQxRjzWxz29OvD4eqRFm/mDO25yZXg MnZE33YvMge6hOmKd2DtpoS4fbR6TKSgti6HPs5r14FumXbgbi/4inapcohlYZTwbU wPq8Gx19vsFPV91XYlINsZCRVp+60Hg/ci2bYsbvpFxjAoidxXtkpO9J/lHwal/zoN WE0/S6gokjcfQ== From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][OEM-5.14/OEM-5.17][PATCH 2/2] ASoC: amd: Add support for enabling DMIC on acp6x via _DSD Date: Tue, 5 Jul 2022 10:09:01 +0800 Message-Id: <20220705020901.11868-3-hui.wang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220705020901.11868-1-hui.wang@canonical.com> References: <20220705020901.11868-1-hui.wang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Mario Limonciello BugLink: https://bugs.launchpad.net/bugs/1980700 Currently the acp6x machine driver requires a hardcoded list of systems that physically have DMIC connected. To avoid having to continually add to an evergrowing list of systems add support for a _DSD that can advertise this. OEMs can add this _DSD to their BIOS under the ACP device to automatically add the device to this driver without requiring any driver modifications. Signed-off-by: Mario Limonciello Link: https://lore.kernel.org/r/20220411134532.13538-3-mario.limonciello@amd.com Signed-off-by: Mark Brown (cherry picked from commit 5426f506b58424f8ab2cd741bacf4b18b5fe578e) Signed-off-by: Hui Wang --- sound/soc/amd/yc/acp6x-mach.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c index 959b70e8baf2..f06e6c1a7799 100644 --- a/sound/soc/amd/yc/acp6x-mach.c +++ b/sound/soc/amd/yc/acp6x-mach.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "acp6x.h" @@ -178,8 +179,19 @@ static int acp6x_probe(struct platform_device *pdev) const struct dmi_system_id *dmi_id; struct acp6x_pdm *machine = NULL; struct snd_soc_card *card; + struct acpi_device *adev; int ret; + /* check the parent device's firmware node has _DSD or not */ + adev = ACPI_COMPANION(pdev->dev.parent); + if (adev) { + const union acpi_object *obj; + + if (!acpi_dev_get_property(adev, "AcpDmicConnected", ACPI_TYPE_INTEGER, &obj) && + obj->integer.value == 1) + platform_set_drvdata(pdev, &acp6x_card); + } + /* check for any DMI overrides */ dmi_id = dmi_first_match(yc_acp_quirk_table); if (dmi_id) @@ -188,6 +200,7 @@ static int acp6x_probe(struct platform_device *pdev) card = platform_get_drvdata(pdev); if (!card) return -ENODEV; + dev_info(&pdev->dev, "Enabling ACP DMIC support via %s", dmi_id ? "DMI" : "ACPI"); acp6x_card.dev = &pdev->dev; snd_soc_card_set_drvdata(card, machine);