From patchwork Tue Sep 12 16:32:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 138699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp938818vqx; Wed, 13 Sep 2023 01:41:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+UqN2t0RSwk+qtv6aIcmgRQNhzonMCgyPXywiKvxsG6qJ4S4+GWOUnwfE3SdKwlFPCJxP X-Received: by 2002:a05:6a20:748d:b0:14b:f78e:d061 with SMTP id p13-20020a056a20748d00b0014bf78ed061mr2662942pzd.19.1694594504552; Wed, 13 Sep 2023 01:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694594504; cv=none; d=google.com; s=arc-20160816; b=wOo9SwJ1Cu/qaFN1f9CG7L6gYf0MByByy0W8XGJxquUwbW79/QOf3AjoTgz9AHsVZf kHlerYBgfgfw/9/1gdluCyAlwzi/cfqExUJv9Y+HzN8rjEbsO2vzGGtxO+JrLCYyJNUA F4/IC0OmUNq2x/HSSzT5UtKSVJbFSI2ojIJfKR+VJUj5KlUiyf2643CUinLKe4qk/hqZ Yr+TfiHS7iwn9+Rkx6jPcqJREmZtOut7Tk/uCAEYXFkd5r9W1+chmA5gxcnw54VV9K1y 9rW875Rt13jH+Ui1zNNN11/j6POLmEXZv2zh4IeSgKCbBtM3ht5Nzm5HD81axQHXFr3p T/2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LxwutN87p/YTQslmoL4H29D/NJFBnq596ExIrTGFS10=; fh=BVyRkeWQgbLHHjD2wsZRKNYbtMse/+APTjljLzZQ3qo=; b=uvaD74TgRjMcoqUB5iPcCNuAhdSyMXO8Gijq1jU+fpNvkbyXo4ZUoiqslZt1Z1IGA1 +uQtH40B9GT8pNxXNt/upn/PWll7v9I6JtZ8Idl9zAFWJjsxqdAca0Uoee+6N6ab2hHT Fa+DY9UwGTjC86Fh7oPwUzLxzmkmcnzXjbSLQ68U6DVZWMmIwkQ2w8WH+FwklndyRL+M N6CzLwehL9iHs5RLt3zpyfV1JqpVM3yx2lz4T8zTukJqmba9fRmjTTXgRgc7zJMMR+9C co+f2Z6AvF08klg/cKHB47FoDvY7OP7K4/o0elSvUznkQVz3/OLUi1RQOo5aVkElGs8+ oPAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=M7KUyZ+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id z16-20020a656650000000b0057767f224d8si5830664pgv.700.2023.09.13.01.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 01:41:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=M7KUyZ+A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 997738032010; Tue, 12 Sep 2023 09:32:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236859AbjILQce (ORCPT + 37 others); Tue, 12 Sep 2023 12:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233207AbjILQc2 (ORCPT ); Tue, 12 Sep 2023 12:32:28 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696A6E7A for ; Tue, 12 Sep 2023 09:32:24 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 38CFSmvA002448; Tue, 12 Sep 2023 11:32:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=LxwutN87p/YTQslmoL4H29D/NJFBnq596ExIrTGFS10=; b= M7KUyZ+A/t/8DvJ88xBq9vcEM2SRiOSueIhTThShHAU8bDeiJYYdyMH3q1BEwlQm R9DLhTtPvF6V002hIhDsaYNnY+3pfmpBeTab7FyX5wRYiIeXQeHQEt8lObcycyiR wcILIwPhPbSquFTQ46SnGRr7iauADdLWyv79Ff8C/VqOc5SxpTungMs/OgV+Ss3c Oyf4xheuiTF0nabtCcNCDppfSNB4slGTQPEc6W0e6T7KFIB4isXOmibQlVpAI9FN EludVnzedB/sNyEwfO77eHBylmAxyTta7IeXz6U/WUVBrAxsK1H6LGm9+EJ/JWtY Q7YrtWQ1IZ3x+gvb3N8dmQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3t0p3xkxda-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 11:32:11 -0500 (CDT) 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_256_GCM_SHA384) id 15.2.1118.37; Tue, 12 Sep 2023 17:32:08 +0100 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.2.1118.37 via Frontend Transport; Tue, 12 Sep 2023 17:32:08 +0100 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.125]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id EA94F3563; Tue, 12 Sep 2023 16:32:07 +0000 (UTC) From: Richard Fitzgerald To: , , , , CC: , , , Richard Fitzgerald Subject: [PATCH 1/4] ASoC: soc-card: Add storage for PCI SSID Date: Tue, 12 Sep 2023 17:32:04 +0100 Message-ID: <20230912163207.3498161-2-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230912163207.3498161-1-rf@opensource.cirrus.com> References: <20230912163207.3498161-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 1Myw40n5eyviP4fUwG9rRQjvdJVbi8Xh X-Proofpoint-GUID: 1Myw40n5eyviP4fUwG9rRQjvdJVbi8Xh X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 12 Sep 2023 09:32:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776911127252710379 X-GMAIL-MSGID: 1776911127252710379 Add members to struct snd_soc_card to store the PCI subsystem ID (SSID) of the soundcard. The PCI specification provides two registers to store a vendor-specific SSID that can be read by drivers to uniquely identify a particular "soundcard". This is defined in the PCI specification to distinguish products that use the same silicon (and therefore have the same silicon ID) so that product-specific differences can be applied. PCI only defines 0xFFFF as an invalid value. 0x0000 is not defined as invalid. So the usual pattern of zero-filling the struct and then assuming a zero value unset will not work. A flag is included to indicate when the SSID information has been filled in. Unlike DMI information, which has a free-format entirely up to the vendor, the PCI SSID has a strictly defined format and a registry of vendor IDs. It is usual in Windows drivers that the SSID is used as the sole identifier of the specific end-product and the Windows driver contains tables mapping that to information about the hardware setup, rather than using ACPI properties. This SSID is important information for ASoC components that need to apply hardware-specific configuration on PCI-based systems. As the SSID is a generic part of the PCI specification and is treated as identifying the "soundcard", it is reasonable to include this information in struct snd_soc_card, instead of components inventing their own custom ways to pass this information around. Signed-off-by: Richard Fitzgerald --- include/sound/soc-card.h | 37 +++++++++++++++++++++++++++++++++++++ include/sound/soc.h | 11 +++++++++++ 2 files changed, 48 insertions(+) diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h index fc94dfb0021f..e8ff2e089cd0 100644 --- a/include/sound/soc-card.h +++ b/include/sound/soc-card.h @@ -59,6 +59,43 @@ int snd_soc_card_add_dai_link(struct snd_soc_card *card, void snd_soc_card_remove_dai_link(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link); +#ifdef CONFIG_PCI +static inline void snd_soc_card_set_pci_ssid(struct snd_soc_card *card, + unsigned short vendor, + unsigned short device) +{ + card->pci_subsystem_vendor = vendor; + card->pci_subsystem_device = device; + card->pci_subsystem_set = true; +} + +static inline int snd_soc_card_get_pci_ssid(struct snd_soc_card *card, + unsigned short *vendor, + unsigned short *device) +{ + if (!card->pci_subsystem_set) + return -ENOENT; + + *vendor = card->pci_subsystem_vendor; + *device = card->pci_subsystem_device; + + return 0; +} +#else /* !CONFIG_PCI */ +static inline void snd_soc_card_set_pci_ssid(struct snd_soc_card *card, + unsigned short vendor, + unsigned short device) +{ +} + +static inline int snd_soc_card_get_pci_ssid(struct snd_soc_card *card, + unsigned short *vendor, + unsigned short *device) +{ + return -ENOENT; +} +#endif /* CONFIG_PCI */ + /* device driver data */ static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card, void *data) diff --git a/include/sound/soc.h b/include/sound/soc.h index 509386ff5212..81ed08c5c67d 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -929,6 +929,17 @@ struct snd_soc_card { #ifdef CONFIG_DMI char dmi_longname[80]; #endif /* CONFIG_DMI */ + +#ifdef CONFIG_PCI + /* + * PCI does not define 0 as invalid, so pci_subsystem_set indicates + * whether a value has been written to these fields. + */ + unsigned short pci_subsystem_vendor; + unsigned short pci_subsystem_device; + bool pci_subsystem_set; +#endif /* CONFIG_PCI */ + char topology_shortname[32]; struct device *dev; From patchwork Tue Sep 12 16:32:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 138374 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp610226vqx; Tue, 12 Sep 2023 11:46:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGCAx2u0x3kG701nquXp3z0ur76e5uwAsAsBXtk+3Sgfzvj/aP5MsePRK8lnjKvuJBHlMX X-Received: by 2002:a17:902:eccd:b0:1b8:5aba:509d with SMTP id a13-20020a170902eccd00b001b85aba509dmr557567plh.21.1694544391000; Tue, 12 Sep 2023 11:46:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694544390; cv=none; d=google.com; s=arc-20160816; b=i2lo7uLSpNCf7MdJJGpNZIn38OlHKOX903xioRygRDxdTEd5h812G1SXiNg1xkj9pe tRrOGW/uyhbTaJtNRYUTxIf2gJnJt6ldyK5hBxV8NLM7ESNKNy2G+AiVsFAvOZd8sd30 J3vF9iBr+gyz/MOwibG3YoN4CkxlWm73UmYrcTmNfUKyAMIaS0ySzXhhyYMht307sN6J dVxCbz3FPqz/GDP7QeHK1RJLFP9ZB5iojplBLsC8Leh5FFg1DRWUdS27Oi6mhU42kHPR GLl0klkJNpmApkm8cV5XEuIAbsqOaBNXa0QHRbyPkqsCjsWGwjGPFLZcMObWPT6HPp7l AmqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Rr6lXL3LtOXOlIrtorpBwjgzzvf6AwbEgVb5NSht5y8=; fh=BVyRkeWQgbLHHjD2wsZRKNYbtMse/+APTjljLzZQ3qo=; b=nCrNmsIWfZHFtueTH/LoWw3I28qjbI20kUbhq+FV7XxcaQpoJBY3X9bVXnKra5QWkx bytRSzixcdjq6hh0Hsol9kITc4+ilY+AZ6gRxZD64vv6kg0CrBSzOdsbVlaSClo9Ukq4 aDeEee9Br6Tqq+kKBwCBFcRRgA6+lfV0EthG9UeDQXsvWGhTDBH+tpH0y3pMakS1QQKZ gzNTcRfkwdQ/MTC5g/Kzh3MrnZw+0xJ+kuscPBEufFsyQw4UBKVhELje3q1fTeQp9dEc yPz4lc8BcYXCvPrlF1kZYYP0TIob77tdHynONIP8JTl41owCYm91p+Q+/0i32epUcH9Y os7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=qpYV6TEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id s12-20020a170903200c00b001b886d36bf6si8014082pla.226.2023.09.12.11.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 11:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=qpYV6TEQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5B7C18246855; Tue, 12 Sep 2023 09:32:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236802AbjILQc2 (ORCPT + 37 others); Tue, 12 Sep 2023 12:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbjILQc1 (ORCPT ); Tue, 12 Sep 2023 12:32:27 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39783115 for ; Tue, 12 Sep 2023 09:32:24 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 38CFSmv8002448; Tue, 12 Sep 2023 11:32:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=Rr6lXL3LtOXOlIrtorpBwjgzzvf6AwbEgVb5NSht5y8=; b= qpYV6TEQfr6faHaHkgmQTJjwRPvahx6fYNeJKX7slRj77mlE3KRbszsZYn40ubX8 1cekwg7OzWdzk5HcCDWCB1tHQHOdI7UU4kmVAEhE7Kqur8y/yEMyUo3lUOCx5Txo G6/TtZQ6jjReC5TnP4ERCa0l/ixOglmpqC87fa6UCxLVST9tPw+fT9SivFWG6WeL 2++WHo5BCqgvL+J9AI8qfFEe/ponJQph9AQFzbIJVDO5G6YPbpsx6ErAf5k9+MJK Y5Om0MnuL/61atGkBOvEYg8v1L35i4vIc+vjw61dAarVZbJzHrVBZi2hXXhSdzUV KGyFNsh9qAm52p4242wWsA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3t0p3xkxdb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 11:32:10 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Tue, 12 Sep 2023 17:32:08 +0100 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.2.1118.37 via Frontend Transport; Tue, 12 Sep 2023 17:32:08 +0100 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.125]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id F19A115B6; Tue, 12 Sep 2023 16:32:07 +0000 (UTC) From: Richard Fitzgerald To: , , , , CC: , , , Richard Fitzgerald Subject: [PATCH 2/4] ASoC: SOF: Pass PCI SSID to machine driver Date: Tue, 12 Sep 2023 17:32:05 +0100 Message-ID: <20230912163207.3498161-3-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230912163207.3498161-1-rf@opensource.cirrus.com> References: <20230912163207.3498161-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: OfR6-QC06i1vuM7mxdr9uE_5p7vc3GuM X-Proofpoint-GUID: OfR6-QC06i1vuM7mxdr9uE_5p7vc3GuM X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Sep 2023 09:32:42 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776858579005535715 X-GMAIL-MSGID: 1776858579005535715 Pass the PCI SSID of the audio interface through to the machine driver. This allows the machine driver to use the SSID to uniquely identify the specific hardware configuration and apply any platform-specific configuration. struct snd_sof_pdata is passed around inside the SOF code, but it then passes configuration information to the machine driver through struct snd_soc_acpi_mach and struct snd_soc_acpi_mach_params. So SSID information has been added to both snd_sof_pdata and snd_soc_acpi_mach_params. PCI does not define 0x0000 as an invalid value so we can't use zero to indicate that the struct member was not written. Instead a flag is included to indicate that a value has been written to the subsystem_vendor and subsystem_device members. sof_pci_probe() creates the struct snd_sof_pdata. It is passed a struct pci_dev so it can fill in the SSID value. sof_machine_check() finds the appropriate struct snd_soc_acpi_mach. It copies the SSID information across to the struct snd_soc_acpi_mach_params. This done before calling any custom set_mach_params() so that it could be used by the set_mach_params() callback to apply variant params. The machine driver receives the struct snd_soc_acpi_mach as its platform_data. Signed-off-by: Richard Fitzgerald --- include/sound/soc-acpi.h | 7 +++++++ include/sound/sof.h | 8 ++++++++ sound/soc/sof/sof-audio.c | 7 +++++++ sound/soc/sof/sof-pci-dev.c | 8 ++++++++ 4 files changed, 30 insertions(+) diff --git a/include/sound/soc-acpi.h b/include/sound/soc-acpi.h index 6d31d535e8f6..23d6d6bfb073 100644 --- a/include/sound/soc-acpi.h +++ b/include/sound/soc-acpi.h @@ -68,6 +68,10 @@ static inline struct snd_soc_acpi_mach *snd_soc_acpi_codec_list(void *arg) * @i2s_link_mask: I2S/TDM links enabled on the board * @num_dai_drivers: number of elements in @dai_drivers * @dai_drivers: pointer to dai_drivers, used e.g. in nocodec mode + * @subsystem_vendor: optional PCI SSID vendor value + * @subsystem_device: optional PCI SSID device value + * @subsystem_id_set: true if a value has been written to + * subsystem_vendor and subsystem_device. */ struct snd_soc_acpi_mach_params { u32 acpi_ipc_irq_index; @@ -80,6 +84,9 @@ struct snd_soc_acpi_mach_params { u32 i2s_link_mask; u32 num_dai_drivers; struct snd_soc_dai_driver *dai_drivers; + unsigned short subsystem_vendor; + unsigned short subsystem_device; + bool subsystem_id_set; }; /** diff --git a/include/sound/sof.h b/include/sound/sof.h index d3c41f87ac31..51294f2ba302 100644 --- a/include/sound/sof.h +++ b/include/sound/sof.h @@ -64,6 +64,14 @@ struct snd_sof_pdata { const char *name; const char *platform; + /* + * PCI SSID. As PCI does not define 0 as invalid, the subsystem_id_set + * flag indicates that a value has been written to these members. + */ + unsigned short subsystem_vendor; + unsigned short subsystem_device; + bool subsystem_id_set; + struct device *dev; /* diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index e7ef77012c35..9c2359d10ecf 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -1031,6 +1031,13 @@ int sof_machine_check(struct snd_sof_dev *sdev) mach = snd_sof_machine_select(sdev); if (mach) { sof_pdata->machine = mach; + + if (sof_pdata->subsystem_id_set) { + mach->mach_params.subsystem_vendor = sof_pdata->subsystem_vendor; + mach->mach_params.subsystem_device = sof_pdata->subsystem_device; + mach->mach_params.subsystem_id_set = true; + } + snd_sof_set_mach_params(mach, sdev); return 0; } diff --git a/sound/soc/sof/sof-pci-dev.c b/sound/soc/sof/sof-pci-dev.c index f5ece43d0ec2..146d25983b08 100644 --- a/sound/soc/sof/sof-pci-dev.c +++ b/sound/soc/sof/sof-pci-dev.c @@ -214,6 +214,14 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) return ret; sof_pdata->name = pci_name(pci); + + /* PCI defines a vendor ID of 0xFFFF as invalid. */ + if (pci->subsystem_vendor != 0xFFFF) { + sof_pdata->subsystem_vendor = pci->subsystem_vendor; + sof_pdata->subsystem_device = pci->subsystem_device; + sof_pdata->subsystem_id_set = true; + } + sof_pdata->desc = desc; sof_pdata->dev = dev; From patchwork Tue Sep 12 16:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 138467 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9ecd:0:b0:3f2:4152:657d with SMTP id t13csp717019vqx; Tue, 12 Sep 2023 15:29:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHeb1eh6Kmxb0gXqbz4o79Mi6lSSMYYDJJOQk+lvsBqYlcHgKwJ+4wl57WDwktTtySp/cQR X-Received: by 2002:a05:6a00:1590:b0:68b:c2c7:a8ce with SMTP id u16-20020a056a00159000b0068bc2c7a8cemr1103925pfk.17.1694557759391; Tue, 12 Sep 2023 15:29:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694557759; cv=none; d=google.com; s=arc-20160816; b=HkJSB/4lsAvfaGL5L951FNECpmO0VPEjeLVKxDhG5OTJnbXktS4Lj7ILQZjQHTJDCA /3j7rES3jCug00uFF45DBsfWOS/MlSROmjH8hLGeOM3z46CkSczkmSkK/Vm4XcwYM+Ti 77xqQQGOsy5JFSDKPWl4k6znlUTzewGL2ZB78KqdK4Lyy4ITcrBmtJ0143Vmr3MPvx6G Cni8v3yYlApD+ADqi504JAAqZtfvJcBv4ARphEJ/cZhf7PHD2kbK0CblJNfzb6kxTK9c pP0oqPQeyXu+1kV1u0o1cBvqXlcUw+TpC4yXNwgPlEPknspAYWV44ISHNxJyEYUSlmqo WHbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sVc4KTYLdosqBY5c8XnIDGNWqNXt6ODbd7xx+vDE0Ss=; fh=BVyRkeWQgbLHHjD2wsZRKNYbtMse/+APTjljLzZQ3qo=; b=tsvxFCoL/Big+Rn3PV3xAXdUjwYX47ECCGvQQnz+vk7A/CvIBchE/iDBrK8tHEqGJ1 XW7ANOlIQZPnCpldHgu6dfnsCb5g2+DHku+lWz0nT82LwMcZ/LZdcflZBKiY0EoWHabo tCZXQzZbeCUHnS8ZqHp94DXEZvuJQ3RGSqh7BV4r3Q8005vNHygmwxJBLM/77GDwHEl8 SWWJVi0fG9thglsNrKsFvsY5YPgdYLu0PwoKiz525OhnKG3KtkarqY0wjLc/Zn9GB1h3 VA6QAo8V4gvOMPyC14aU5VfMx8btbNvHuI+Ykir9rpn2Ah0PSzFtdu3+PyUVoGoZbPgu B51A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=PXCpdORv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id f19-20020a056a00239300b0068a570fe35csi8958589pfc.180.2023.09.12.15.29.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 15:29:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=PXCpdORv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1D7CE824685B; Tue, 12 Sep 2023 09:32:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236879AbjILQcg (ORCPT + 37 others); Tue, 12 Sep 2023 12:32:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236697AbjILQc2 (ORCPT ); Tue, 12 Sep 2023 12:32:28 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A23310EB for ; Tue, 12 Sep 2023 09:32:24 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 38CFSmv9002448; Tue, 12 Sep 2023 11:32:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=sVc4KTYLdosqBY5c8XnIDGNWqNXt6ODbd7xx+vDE0Ss=; b= PXCpdORvKHqpb2pGHkM7k3GueQ9JgwlKBIQVTHx/f8olNtq0WMYoPvicVvPgmRIL 9H9mdGlonuB0xsrBd2fVCffSiEj+GkbwxhAijxbWn03fZgpu2HwnluZZnkx3Mwxi cWsOGqz3P1564ZmxZGTL0zOaCMWm+e/jS6fAU/MAZTR9RH55Vs4bDI5AQaEJPtIU gO8PN4zTQ4iCZDv4YHrVepMQ1niQ31Lz1M9LhzVembfBl3Z4brSPV4zS7udF1/f+ 7H2tn+Sunx97eDMq3k22vGfsjNB8HNFIel2UWkF9hquy4IxFdNp5s5aqp35a0oO0 Lwr5JSMitRmknXLPN72nkw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3t0p3xkxdb-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 12 Sep 2023 11:32:11 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Tue, 12 Sep 2023 17:32:08 +0100 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.2.1118.37 via Frontend Transport; Tue, 12 Sep 2023 17:32:08 +0100 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.125]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 0CD863575; Tue, 12 Sep 2023 16:32:08 +0000 (UTC) From: Richard Fitzgerald To: , , , , CC: , , , Richard Fitzgerald Subject: [PATCH 3/4] ASoC: Intel: sof_sdw: Copy PCI SSID to struct snd_soc_card Date: Tue, 12 Sep 2023 17:32:06 +0100 Message-ID: <20230912163207.3498161-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230912163207.3498161-1-rf@opensource.cirrus.com> References: <20230912163207.3498161-1-rf@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: TCeSaKBKJ_FcRr18fOXrIMkho0cju1vq X-Proofpoint-GUID: TCeSaKBKJ_FcRr18fOXrIMkho0cju1vq X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Sep 2023 09:32:57 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1776872597202016371 X-GMAIL-MSGID: 1776872597202016371 If the PCI SSID has been set in the struct snd_soc_acpi_mach_params, copy this to struct snd_soc_card so that it can be used by other ASoC components. This is important for components that must apply system-specific configuration. Signed-off-by: Richard Fitzgerald --- sound/soc/intel/boards/sof_sdw.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 5a1c750e6ae6..961241100012 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1924,6 +1924,12 @@ static int mc_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) codec_info_list[i].amp_num = 0; + if (mach->mach_params.subsystem_id_set) { + snd_soc_card_set_pci_ssid(card, + mach->mach_params.subsystem_vendor, + mach->mach_params.subsystem_device); + } + ret = sof_card_dai_links_create(card); if (ret < 0) return ret;