Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp2405632rwp; Fri, 14 Jul 2023 05:53:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJ8QGiGzF8wm0lm9FC2+gDVv8E5ssovRlukeD9zuWik4ipILEWNJ51MMr0OznMSzu+lgfj X-Received: by 2002:a17:906:18f:b0:96a:52e:5379 with SMTP id 15-20020a170906018f00b0096a052e5379mr3944241ejb.63.1689339195508; Fri, 14 Jul 2023 05:53:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689339195; cv=none; d=google.com; s=arc-20160816; b=mm2/dmQ4ZFvo4gLymApdxVdt0v9rHEirodFakYWyiT1NP1bGJmGiJx3Xa0GopNih46 I3wSNHerE9jFj/qIe15jQz+V0rdA+HSsxR4GY0h6rE/56Yi80aA/jYTEoQ2DWmTe3QQX ObFP0jFPk32sJvkgggr5KnW3u9dgVYmmQ8jTr1lDYoe8pJfZFaqycxf4xy42CUYdMCyh OeUYwqKh+Yv9kNhHnKsglHHP0x9J1ZiI4/5AStokiPaLXUZOuvEJm5SDH2IUZQh8m4yJ LaUfzdP8g94RqzfBWXRYKXtLFR5Y2oxaxKfjH96c8bhzC+f6EOHfWicBgRSpbmJnxkIM nKAg== 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=P+Y/BRTEwKDTk+wn2xku+Yvf4LigGRE79SAQtI7Igyk=; fh=iLu8mJV3L09dzJN6VXkKj+SRT/C9p8fR4gJYErWu4bc=; b=KhwjDNrF7pvWAeTUgqBMozgXtcBsQ8kMrGjmwY2U0iXPzPE+U/B0p9pFV/cjD8o27D p7P/D+PAhCO+gx62VZARagod4mHcq6HgjKHZVJriukJUqT2Xbv+rtIJ8R4wR6jFR01VI SN+lmXLOV9MpEpySJmJOviwyJG0WYeIKRhEoQKv5azDMzBMinj1PFjXjhrnkA62oIgL6 +zcCPkdXRJBOQPaL/6FYNDGgEh2KZvpk/OPHjW00feWfiPgb7t08E6mtqvi/OfdLCz+E IFlLa1dvvzsjc5BKSMDEgsiIS6TCeW05hnVDRDNba808mgVoca+YptUbjkz1Ib92EoUX m4gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="a6oVZg/Y"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170906680d00b00992a0966793si8491729ejr.814.2023.07.14.05.52.51; Fri, 14 Jul 2023 05:53:15 -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="a6oVZg/Y"; 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 S235828AbjGNMYC (ORCPT + 99 others); Fri, 14 Jul 2023 08:24:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235830AbjGNMYA (ORCPT ); Fri, 14 Jul 2023 08:24:00 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F39B23593; Fri, 14 Jul 2023 05:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689337437; x=1720873437; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=npG2m1UCZxKCtzRaw5t5Am2kMO3bj0pf6Epbexb+5Ig=; b=a6oVZg/YjXaq4/3eTXTBgW+MTMYTphmveLpHy+K1hQU1M3/ds/EIz6aA oKT52oUS/3q7EZxd/b9jUnrshu7GvqpmvZ9HVi2jOKA2KSnTMU04EvVSm E3R7GKiUgTfEvfqtjn0FH8J5czo8JSvzFeW73she1zizLSZ26ZaCTEOFJ wdnqDQxx+cEvpNmeb8ZVDYUvabQs3T9egMeLHOnMdEhl160WEBOk0JrnP jG2HYq6Ide4SmvPubVAIE7ce2WN5jwJTO0jzl1ozyHf/YNKxS21TFwlF7 gmVTxivd7YJPCTBM5oBgydTuZjWyX3ooSoEUJK7NtU42m9KEzM85sZfKv g==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="429225825" X-IronPort-AV: E=Sophos;i="6.01,205,1684825200"; d="scan'208";a="429225825" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 05:23:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="1053034885" X-IronPort-AV: E=Sophos;i="6.01,205,1684825200"; d="scan'208";a="1053034885" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga005.fm.intel.com with ESMTP; 14 Jul 2023 05:23:54 -0700 From: =?UTF-8?q?Amadeusz=20S=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 , Hans de Goede , =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Andy Shevchenko Subject: [PATCH v3 05/15] ALSA: hda: Add controller matching macros Date: Fri, 14 Jul 2023 22:24:47 +0200 Message-Id: <20230714202457.423866-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230714202457.423866-1-amadeuszx.slawinski@linux.intel.com> References: <20230714202457.423866-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=-0.1 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 */ -- 2.34.1