Message ID | 20230711125726.3509391-14-amadeuszx.slawinski@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp511796vqm; Tue, 11 Jul 2023 07:14:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHk4XSbt8U+y1BfdoRNT/9Rq15wJykv8FQW1O5Mzhcmvvl/KSXWVj8CzIhBDXzzHhg3TsP6 X-Received: by 2002:a2e:9188:0:b0:2b6:cdfb:fe36 with SMTP id f8-20020a2e9188000000b002b6cdfbfe36mr14890393ljg.39.1689084898610; Tue, 11 Jul 2023 07:14:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689084898; cv=none; d=google.com; s=arc-20160816; b=xUjZXqR7jWWBRlGUuDsbfsJPMqfeYOWOdpqKynQvj/I1gdaQ7lvGzDwzOai3Wu7m1E 0i7isMTwDbdxuMA2IjVwPfbna89YYZ/1Dq0PIFseBtepI6erKv8rTGnUzE/qwQ7Ps626 lSMmYIlBXspxRd9v2odgJumibNhUl5Umho3gLplWGmUDTm2NwnShQ//ZBwc0+CD2lWj5 Av28fyOt8rAIKfJikNET3pia/epmvK+32bjwjOdW6sKbT4k8Scisb1Jv3l+j4F8V2Vvw dmaLuaXTd13Au5cElA27EP3JxrxIfjdbqLKgYTT1S+G6Ei27vswsDg8fj1WSj9MKe4uG SCbw== 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=ETiBq52pG2M+khkHKcptdyzMA5V/Qbq1tZF7rd/AQlo=; fh=sKxO7Xj+YIOQJw2gBVYevujm0+5GA4/lF0Hs7SAhyQ0=; b=tIeLpi1lVzGeh4TNqwEjTyfkxhrX9aIFuhbyqYNSpF9xte6pN3QDaXMxYy60MYe2aq Y60m5DFSIfM070sjq+kvPpUfU5Ou2DGYORkhxJTcj+MZVahIK3F/QFzw5h+xef5KPMiZ vp9Bk5yNd6DhkuNOSQXH6QHtWhjpk6RIaW1AWgWCxHX4u52LpLK76j6dxmR0o1LXt5iY AU80XwZFrDGU4tr6PFaHqPv6fK+tgwq9m1tdDH1gloWTspmbXcHE/X/fg2EnghW6/cml XaUUIOk2Aztq8zsF974xK5+Xxrx/Awri3rS5FiFsllJ6/sk7IoT5+WKlUrzkjOb/eWgP 5+jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hS0luW66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i10-20020a170906114a00b0097885ff4845si2468288eja.168.2023.07.11.07.14.33; Tue, 11 Jul 2023 07:14:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hS0luW66; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232848AbjGKNAN (ORCPT <rfc822;gnulinuxfreebsd@gmail.com> + 99 others); Tue, 11 Jul 2023 09:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232882AbjGKM75 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Jul 2023 08:59:57 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E1D268D; Tue, 11 Jul 2023 05:59:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689080373; x=1720616373; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rbfp/ATGi8YL1NhYsnv9rDVDnh7mPVl04cteWEUCpLs=; b=hS0luW66oOJeOaMJ9bw2WHW7JVOAKv6vHHJyjPerp6g/VO0M59wu42/P Zp2MI3h69QE3M97UDhOQ0BjIVBWksA9nNbtvym5FqNOxTOuanQCgb2afE BWPwWCTFIeiepW/+5ri8pFvXLg580TtaLMI5gv9uSp5BTR67+/KBW35K/ 78hg9mSpWHx68Nk8dU84H12yrjoiG1jvyK74mH2fAswYyuFSiB2MJeRDA EgI9UwlC7vlNWAc4vMva84vwMjdSjHDI1kcPwmFR/gI/dnDADZZ9ibD4n C2j32Je9pFNBD4L7jrgsyzaXciPaB0p36qZ8beFii9oItc606WThb2F3n Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="367187580" X-IronPort-AV: E=Sophos;i="6.01,196,1684825200"; d="scan'208";a="367187580" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jul 2023 05:57:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="834666843" X-IronPort-AV: E=Sophos;i="6.01,196,1684825200"; d="scan'208";a="834666843" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 11 Jul 2023 05:57:41 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= <amadeuszx.slawinski@linux.intel.com> To: Bjorn Helgaas <bhelgaas@google.com>, Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Cezary Rojewski <cezary.rojewski@intel.com>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>, Kai Vehmanen <kai.vehmanen@linux.intel.com>, Andy Shevchenko <andriy.shevchenko@intel.com>, Hans de Goede <hdegoede@redhat.com>, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= <amadeuszx.slawinski@linux.intel.com> Subject: [PATCH 13/13] ASoC: Intel: sst: Convert to PCI device IDs defines Date: Tue, 11 Jul 2023 14:57:26 +0200 Message-Id: <20230711125726.3509391-14-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230711125726.3509391-1-amadeuszx.slawinski@linux.intel.com> References: <20230711125726.3509391-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771133886476244438 X-GMAIL-MSGID: 1771133886476244438 |
Series |
PCI: Define Intel PCI IDs and use them in drivers
|
|
Commit Message
Amadeusz Sławiński
July 11, 2023, 12:57 p.m. UTC
Use PCI device IDs from pci_ids.h header.
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
sound/soc/intel/atom/sst/sst.c | 3 ++-
sound/soc/intel/atom/sst/sst.h | 1 -
sound/soc/intel/atom/sst/sst_pci.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
Comments
On Tue, Jul 11, 2023 at 02:57:26PM +0200, Amadeusz Sławiński wrote: > Use PCI device IDs from pci_ids.h header. ... > switch (sst->dev_id) { > - case SST_MRFLD_PCI_ID: > + case PCI_DEVICE_ID_INTEL_ADSP_TNG: > case SST_BYT_ACPI_ID: > case SST_CHV_ACPI_ID: I think this needs a bit more, i.e. replacing the rest with respective PCI IDs. All three will be defined with SST prefix, which makes sense to me. ACPI here is a bit misleading, but correct. The ACPI specification assumes that respective part of the ID space covers 100% of PCI ID space. I have briefly checked the code and it seems that ID is used externally only for PCI case, so we may simply use the lower 16 bits of the ACPI _HID for the context. diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c index a0d29510d2bc..b1f59604d825 100644 --- a/sound/soc/intel/atom/sst/sst.c +++ b/sound/soc/intel/atom/sst/sst.c @@ -222,7 +222,7 @@ static void sst_init_locks(struct intel_sst_drv *ctx) } int sst_alloc_drv_context(struct intel_sst_drv **ctx, - struct device *dev, unsigned int dev_id) + struct device *dev, unsigned short dev_id) { *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL); if (!(*ctx)) diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h index 4d37d39fd8f4..c04f033e1d5f 100644 --- a/sound/soc/intel/atom/sst/sst.h +++ b/sound/soc/intel/atom/sst/sst.h @@ -358,7 +358,7 @@ struct sst_fw_save { struct intel_sst_drv { int sst_state; int irq_num; - unsigned int dev_id; + unsigned short dev_id; void __iomem *ddr; void __iomem *shim; void __iomem *mailbox; @@ -523,7 +523,7 @@ int sst_register(struct device *); int sst_unregister(struct device *); int sst_alloc_drv_context(struct intel_sst_drv **ctx, - struct device *dev, unsigned int dev_id); + struct device *dev, unsigned short dev_id); int sst_context_init(struct intel_sst_drv *ctx); void sst_context_cleanup(struct intel_sst_drv *ctx); void sst_configure_runtime_pm(struct intel_sst_drv *ctx); ... > /* driver names */ > #define SST_DRV_NAME "intel_sst_driver" > -#define SST_MRFLD_PCI_ID 0x119A > #define SST_BYT_ACPI_ID 0x80860F28 > #define SST_CHV_ACPI_ID 0x808622A8 And kill all three!
On 7/11/2023 4:33 PM, Andy Shevchenko wrote: > On Tue, Jul 11, 2023 at 02:57:26PM +0200, Amadeusz Sławiński wrote: >> Use PCI device IDs from pci_ids.h header. > > ... > >> switch (sst->dev_id) { >> - case SST_MRFLD_PCI_ID: >> + case PCI_DEVICE_ID_INTEL_ADSP_TNG: >> case SST_BYT_ACPI_ID: >> case SST_CHV_ACPI_ID: > > I think this needs a bit more, i.e. replacing the rest with respective PCI IDs. > > All three will be defined with SST prefix, which makes sense to me. > > ACPI here is a bit misleading, but correct. The ACPI specification assumes that > respective part of the ID space covers 100% of PCI ID space. > > I have briefly checked the code and it seems that ID is used externally only > for PCI case, so we may simply use the lower 16 bits of the ACPI _HID for the > context. > Do I understand correctly that I should just do: #define PCI_DEVICE_ID_INTEL_SST_BYT 0x0F28 #define PCI_DEVICE_ID_INTEL_SST_CHV 0x22A8 and use those IDs instead? > diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c > index a0d29510d2bc..b1f59604d825 100644 > --- a/sound/soc/intel/atom/sst/sst.c > +++ b/sound/soc/intel/atom/sst/sst.c > @@ -222,7 +222,7 @@ static void sst_init_locks(struct intel_sst_drv *ctx) > } > > int sst_alloc_drv_context(struct intel_sst_drv **ctx, > - struct device *dev, unsigned int dev_id) > + struct device *dev, unsigned short dev_id) > { > *ctx = devm_kzalloc(dev, sizeof(struct intel_sst_drv), GFP_KERNEL); > if (!(*ctx)) > diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h > index 4d37d39fd8f4..c04f033e1d5f 100644 > --- a/sound/soc/intel/atom/sst/sst.h > +++ b/sound/soc/intel/atom/sst/sst.h > @@ -358,7 +358,7 @@ struct sst_fw_save { > struct intel_sst_drv { > int sst_state; > int irq_num; > - unsigned int dev_id; > + unsigned short dev_id; > void __iomem *ddr; > void __iomem *shim; > void __iomem *mailbox; > @@ -523,7 +523,7 @@ int sst_register(struct device *); > int sst_unregister(struct device *); > > int sst_alloc_drv_context(struct intel_sst_drv **ctx, > - struct device *dev, unsigned int dev_id); > + struct device *dev, unsigned short dev_id); > int sst_context_init(struct intel_sst_drv *ctx); > void sst_context_cleanup(struct intel_sst_drv *ctx); > void sst_configure_runtime_pm(struct intel_sst_drv *ctx); > > ... > >> /* driver names */ >> #define SST_DRV_NAME "intel_sst_driver" > >> -#define SST_MRFLD_PCI_ID 0x119A >> #define SST_BYT_ACPI_ID 0x80860F28 >> #define SST_CHV_ACPI_ID 0x808622A8 > > And kill all three! >
On Wed, Jul 12, 2023 at 02:19:47PM +0200, Amadeusz Sławiński wrote: > On 7/11/2023 4:33 PM, Andy Shevchenko wrote: > > On Tue, Jul 11, 2023 at 02:57:26PM +0200, Amadeusz Sławiński wrote: > > > Use PCI device IDs from pci_ids.h header. ... > > > switch (sst->dev_id) { > > > - case SST_MRFLD_PCI_ID: > > > + case PCI_DEVICE_ID_INTEL_ADSP_TNG: > > > case SST_BYT_ACPI_ID: > > > case SST_CHV_ACPI_ID: > > > > I think this needs a bit more, i.e. replacing the rest with respective PCI IDs. > > > > All three will be defined with SST prefix, which makes sense to me. > > > > ACPI here is a bit misleading, but correct. The ACPI specification assumes that > > respective part of the ID space covers 100% of PCI ID space. > > > > I have briefly checked the code and it seems that ID is used externally only > > for PCI case, so we may simply use the lower 16 bits of the ACPI _HID for the > > context. > > Do I understand correctly that I should just do: > #define PCI_DEVICE_ID_INTEL_SST_BYT 0x0F28 > #define PCI_DEVICE_ID_INTEL_SST_CHV 0x22A8 > and use those IDs instead? Correct!
diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c index a0d29510d2bc..f582e0737778 100644 --- a/sound/soc/intel/atom/sst/sst.c +++ b/sound/soc/intel/atom/sst/sst.c @@ -16,6 +16,7 @@ #include <linux/interrupt.h> #include <linux/io.h> #include <linux/firmware.h> +#include <linux/pci.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <linux/async.h> @@ -174,7 +175,7 @@ int sst_driver_ops(struct intel_sst_drv *sst) { switch (sst->dev_id) { - case SST_MRFLD_PCI_ID: + case PCI_DEVICE_ID_INTEL_ADSP_TNG: case SST_BYT_ACPI_ID: case SST_CHV_ACPI_ID: sst->tstamp = SST_TIME_STAMP_MRFLD; diff --git a/sound/soc/intel/atom/sst/sst.h b/sound/soc/intel/atom/sst/sst.h index 4d37d39fd8f4..6670aaf9aca4 100644 --- a/sound/soc/intel/atom/sst/sst.h +++ b/sound/soc/intel/atom/sst/sst.h @@ -20,7 +20,6 @@ /* driver names */ #define SST_DRV_NAME "intel_sst_driver" -#define SST_MRFLD_PCI_ID 0x119A #define SST_BYT_ACPI_ID 0x80860F28 #define SST_CHV_ACPI_ID 0x808622A8 diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c index 4058b4f80a0c..9098076d6c72 100644 --- a/sound/soc/intel/atom/sst/sst_pci.c +++ b/sound/soc/intel/atom/sst/sst_pci.c @@ -32,7 +32,7 @@ static int sst_platform_get_resources(struct intel_sst_drv *ctx) /* map registers */ /* DDR base */ - if (ctx->dev_id == SST_MRFLD_PCI_ID) { + if (ctx->dev_id == PCI_DEVICE_ID_INTEL_ADSP_TNG) { ctx->ddr_base = pci_resource_start(pci, 0); /* check that the relocated IMR base matches with FW Binary */ ddr_base = relocate_imr_addr_mrfld(ctx->ddr_base); @@ -173,7 +173,7 @@ static void intel_sst_remove(struct pci_dev *pci) /* PCI Routines */ static const struct pci_device_id intel_sst_ids[] = { - { PCI_VDEVICE(INTEL, SST_MRFLD_PCI_ID), 0}, + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ADSP_TNG), 0}, { 0, } };