From patchwork Mon Jul 17 11:45:01 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: 121230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1061905vqt; Mon, 17 Jul 2023 05:00:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlGP6T6P4w/7lwaFT9ZUkooFc8ERQoK7XcaBv5qV1tAOVxs5STFfM0/PtbB0plTawG60nVnM X-Received: by 2002:a17:907:3fa6:b0:982:a022:a540 with SMTP id hr38-20020a1709073fa600b00982a022a540mr11489191ejc.11.1689595247731; Mon, 17 Jul 2023 05:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689595247; cv=none; d=google.com; s=arc-20160816; b=bU5eWjsV1mNydJ408Mm3VSUQorbenuAF/J2lIiltUdJAspQZMKqpF83pt2EL9/UTst 0GQGaxt+AeIWEFreqKSn1lWFPiELsu9lNBP07UuNVdc47dg76eNtoD75fcSY5+yet5iD MqAqcGcJlRRZFyMBbQTkclkayu5TUaniPsUuR9/HYgHoVFdrgn+D2juEe1vUUpNo9HJX +TDF9D5enBTEBnk6ReAiLiiRb+5+aMnH0eM3uQAEfzZjxluLwrGRlF48AiPecsvhCSS7 Ho+m/EfmY3pvkcFlinSWCmsDXhhv84M8XBvpPAlOgVAwSsb6H7SGpzwFY/Y5zbaS+XOe vJkQ== 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=8qxA3LCFKEgYuJ18kNZrx5UpZ7U4kVhouro2DxhIDfY=; fh=WYMxSBIzRoGpjokqDjpNyzs/ox+ow6sUuRoGJdpn/uA=; b=b14typ3XVcdW8GoYwJciy1IhdwsvplAeqmITSGnAM8BIfvw9S6UwWpwZkb/P605S3L V+hvw8Am7RIME5ENQBnEEkIPS8c6cpazhz2hp0UooMTLw26r9lobq1OiN1Mq6YW8aMCG 7vsWS+qjutWJtIJWgoZqAHCQlJs2+ole0nbl+0srvN4W7P/u9XYUW+hStRAfjhGgzG5T 64kfMbJTFJnrRTgYiF/bzJZP5xTZBGQsqOB1YbM3Vx4gxw5V5AuBBtTMyR2k+rEzYGHS YtZ2ddBm6KmWsuE+LDz+jCNQGU9kEnNiXJry7w76yo6H9MjYdMF2EJunnnp3ircoWVJa 8RSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=W5QKcbjt; 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 f9-20020a056402150900b005219bddd8cesi560855edw.393.2023.07.17.05.00.22; Mon, 17 Jul 2023 05:00:47 -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=W5QKcbjt; 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 S229925AbjGQLqH (ORCPT + 99 others); Mon, 17 Jul 2023 07:46:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjGQLqD (ORCPT ); Mon, 17 Jul 2023 07:46:03 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99388172E; Mon, 17 Jul 2023 04:45:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689594348; x=1721130348; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bg/Oeye7JlKu5M4sZceMFdhSsrroMtW9Z2UVA8ue+co=; b=W5QKcbjtaY9Wmb02YkRyIsEyf835GL3+X65vgndczO9AY1Xte0loc8oC 7ton3wAAdmRhOP9YSmrFF0cX6ASFlJCsAMkuOSW1zKtDwk9/9wsKrtrxe ZU3peqEygsCslRwhiD1hAsuUFrNioO7U4wRsDoBdGh5wygXZHusCe00yo ce3VBQIsWniOQ/kgE95nOtVy3H1TxL3BO/T5Io45HelhcNMTQei5pAVUl rThTSZ47hXE/lxqd9yQbws+TfUN6jZaD/djdGmAbxrYFlFKCmdEYR2kvZ aMSSe8IwKvXmmP9n1lYVz+QBHg0gE5f3tN78SQ0Rne+yoWsXAk3V/mFhN Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="363372818" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="363372818" 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:45:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10773"; a="969856505" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="969856505" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga006.fm.intel.com with ESMTP; 17 Jul 2023 04:45:34 -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 05/15] ALSA: hda: Add controller matching macros Date: Mon, 17 Jul 2023 13:45:01 +0200 Message-Id: <20230717114511.484999-6-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: 1771669026607665966 X-GMAIL-MSGID: 1771669026607665966 Some HDA controllers require additional handling, so there are macros to match them, however those are spread across multiple files. Add them all in one place, so they can be reused. Reviewed-by: Andy Shevchenko Acked-by: Mark Brown Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- include/sound/hdaudio.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 2ffdf58bd6d4..32c59053b48e 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -704,4 +705,29 @@ static inline unsigned int snd_array_index(struct snd_array *array, void *ptr) for ((idx) = 0, (ptr) = (array)->list; (idx) < (array)->used; \ (ptr) = snd_array_elem(array, ++(idx))) +/* + * Device matching + */ + +#define HDA_CONTROLLER_IS_HSW(pci) (pci_match_id((struct pci_device_id []){ \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_0) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_2) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_HSW_3) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_BDW) }, \ + { } \ + }, pci)) + +#define HDA_CONTROLLER_IS_APL(pci) (pci_match_id((struct pci_device_id []){ \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_APL) }, \ + { } \ + }, pci)) + +#define HDA_CONTROLLER_IN_GPU(pci) (pci_match_id((struct pci_device_id []){ \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG1) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_0) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_1) }, \ + { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HDA_DG2_2) }, \ + { } \ + }, pci) || HDA_CONTROLLER_IS_HSW(pci)) + #endif /* __SOUND_HDAUDIO_H */