From patchwork Mon Jul 17 11:45:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 121241 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1070078vqt; Mon, 17 Jul 2023 05:13:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlHt43JdFLWKUEhp9qXAYxrrtX4lzl+xCY5FYCf5beQU/JXIJngdgJfBct1vJK3s5vudISoM X-Received: by 2002:aa7:d6d2:0:b0:51d:e182:d7f3 with SMTP id x18-20020aa7d6d2000000b0051de182d7f3mr10088923edr.32.1689596016570; Mon, 17 Jul 2023 05:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689596016; cv=none; d=google.com; s=arc-20160816; b=t+CCX+QuAkQqAF/60Xp4oIlhnAJjOiXTd4Nkps8ceUYI2m96X+MhYds/1z51boXUPr Bo4lG6eoHlzjm2QIVwS6Glk0SK+PBNQUwPJgXywHco4+NLV1dQ3XQF+4eWfQroUXq5o9 Xd8s1bivrvPJogrcnjBAqIWYUS3XIBNV3mBkTeN7GD6gjwWXqve+ldZsHFiV+82xVKXg rh8evzpENIB8wutZa32do1Lp6bBL+n4FLqt/u5y9O47ANLQ5JNpSDHNAsCFSRfGBs1sA EkrU311ju5UKYhF2CGUBAY3uqgpzoZQrlC8bcN7r1e7WWvd1hEiCJP/judYcsNLl8rnn cvMg== 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=7wqrwwpuV5u75Xtu/qMRf8UBquyuLeVllLW1S9swmoI=; fh=WYMxSBIzRoGpjokqDjpNyzs/ox+ow6sUuRoGJdpn/uA=; b=N6Ogvdkrqhpl1pqwBnhkQOlZDW+IulcTNaQdVUxDs+BmlbnUI+Qra+ktTjjEFb65kK VnLUbzPUKtZQdC+0W0dIUqeDRHjBvkgtrWkWPAz5G1B0u78TSkaXy1kaYERkhlHhzmYO g1k/HVH/AP8kAf2wuSccWXe2mkeoUloURM5bonti35c0QpsV1EMlA/3OBHsTe9CXZk0H OS9yyK5owGmnbO8j7hJq5AC2QK91LjGjob/qEigQRbNratGX42PXg8H5sNNIfPjQi9Dr 831kkw2TPDrhG3FuXISwC4lHP/Slqls9eELi3/OcfuELarQSusQyBVzSpTPg48gsCBcv QdzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=e6isGebX; 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 r24-20020aa7da18000000b0051fdaa08fd8si11230745eds.261.2023.07.17.05.13.12; Mon, 17 Jul 2023 05:13:36 -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=e6isGebX; 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 S230319AbjGQLs4 (ORCPT + 99 others); Mon, 17 Jul 2023 07:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbjGQLsf (ORCPT ); Mon, 17 Jul 2023 07:48:35 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33D1A1702; Mon, 17 Jul 2023 04:48:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689594495; x=1721130495; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+ns55PFsbF+pwy5bfcAnX7Qwt8Z8NXqqD7EMZ+8zZrg=; b=e6isGebXsYEwsrrPAo33UjhlL7RNGF/Hbm9p6nZkKwwr3wG2SYO5XHLP 0AwMgH7J9RHzZ6XuvWzymDKSYQcgcY686ZFldzmTWxhc/bQxgIKe5jzxH 4Zs/MJ2JEeUaYUUvIKv3XGS7zK0NMXitLm/b8aJwdiSyZd16tG9pFzgQa D3kX0oECWejqvf2taLliFrN9XLde9PPPn/7AjrEyUMErz7aMkARlFfaFB Hp7Jw2+0+Krdg79Oskm0nE/P7PrSpCjuIYhuUObqmD2Xqb34BoKmIVbXj kTG4OnFW8QmC1DSonrZBYqLFlXyAaHJa5rqqkbprMIs+FAdanj2p0Qwgk A==; X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="363373024" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="363373024" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 04:46:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="969856581" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="969856581" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga006.fm.intel.com with ESMTP; 17 Jul 2023 04:46:07 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Bjorn Helgaas , Mark Brown , Takashi Iwai Cc: alsa-devel@alsa-project.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Cezary Rojewski , Pierre-Louis Bossart , Kai Vehmanen , Andy Shevchenko , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Hans de Goede , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= , Andy Shevchenko Subject: [PATCH v4 15/15] ASoC: Intel: sst: Convert to PCI device IDs defines Date: Mon, 17 Jul 2023 13:45:11 +0200 Message-Id: <20230717114511.484999-16-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230717114511.484999-1-amadeuszx.slawinski@linux.intel.com> References: <20230717114511.484999-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 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, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771669832667912369 X-GMAIL-MSGID: 1771669832667912369 Use PCI device IDs from pci_ids.h header. BSW replaces CHV, as 0x22a8 was added in PCI header as BSW ID for consistency, as they are same (similar) platforms. The ACPI IDs are used only internally and lower 16 bits uniquely define the device as vendor ID for Intel is 8086 for all of them. Use PCI_DEVICE_DATA() to match PCI device to be consistent with other Intel audio drivers. Suggested-by: Andy Shevchenko Acked-by: Mark Brown Reviewed-by: Cezary Rojewski Reviewed-by: Andy Shevchenko Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/atom/sst/sst.c | 14 ++++++++++---- sound/soc/intel/atom/sst/sst.h | 7 ++----- sound/soc/intel/atom/sst/sst_pci.c | 4 ++-- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sound/soc/intel/atom/sst/sst.c b/sound/soc/intel/atom/sst/sst.c index a0d29510d2bc..e0357d257c6c 100644 --- a/sound/soc/intel/atom/sst/sst.c +++ b/sound/soc/intel/atom/sst/sst.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -174,9 +175,9 @@ int sst_driver_ops(struct intel_sst_drv *sst) { switch (sst->dev_id) { - case SST_MRFLD_PCI_ID: - case SST_BYT_ACPI_ID: - case SST_CHV_ACPI_ID: + case PCI_DEVICE_ID_INTEL_SST_TNG: + case PCI_DEVICE_ID_INTEL_SST_BYT: + case PCI_DEVICE_ID_INTEL_SST_BSW: sst->tstamp = SST_TIME_STAMP_MRFLD; sst->ops = &mrfld_ops; return 0; @@ -221,8 +222,13 @@ static void sst_init_locks(struct intel_sst_drv *ctx) spin_lock_init(&ctx->block_lock); } +/* + * Driver handles PCI IDs in ACPI - sst_acpi_probe() - and we are using only + * device ID part. If real ACPI ID appears, the kstrtouint() returns error, so + * we are fine with using unsigned short as dev_id type. + */ 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..126903e126e4 100644 --- a/sound/soc/intel/atom/sst/sst.h +++ b/sound/soc/intel/atom/sst/sst.h @@ -20,9 +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 #define SST_SUSPEND_DELAY 2000 #define FW_CONTEXT_MEM (64*1024) @@ -358,7 +355,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 +520,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); diff --git a/sound/soc/intel/atom/sst/sst_pci.c b/sound/soc/intel/atom/sst/sst_pci.c index 4058b4f80a0c..d1e64c3500be 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_SST_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_DEVICE_DATA(INTEL, SST_TNG, 0) }, { 0, } };