From patchwork Fri Jul 14 20:24:47 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: 120465 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2476853vqm; Fri, 14 Jul 2023 05:44:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6LGuLhjLzyxab3Td7hSbmMfJj1/6PguWa7bcdLhBgztXMfysimCdtHecY5Dh0BcDzXf0g X-Received: by 2002:a05:6a20:4914:b0:133:bd83:2212 with SMTP id ft20-20020a056a20491400b00133bd832212mr947812pzb.40.1689338682132; Fri, 14 Jul 2023 05:44:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689338682; cv=none; d=google.com; s=arc-20160816; b=jsDTQbswxiuJTaziY5kUsNMNaEc1O337naMnbjernggemyHVek+ORzz5lftr2RRXP/ oZFUrXFankCAKbb37xff36w8q2gERayEaOX5LYQjvRiIwAFj1sAxW3rx9tbWon/CY0AE ydxf3pvswNmpRTPUn/kGGxS2QIXhOsAtB7/f0lPllNGK8dy9zVMNtJeZQwMpOaQLbr9m lmQGg95Ijnn3dj66jPCdgOibolmIirxY1QSSdn/elqSoFA9sVhSzy9FHwig/m0YLftYx z4Bm3ZJwrxn7VIv/WNhaWBEnKp4ERO2QnWvv0P5rM5z0CAG07gY3HbFYp3lQfXptctCk ZW6w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j9-20020a654309000000b005538c82b70esi1231311pgq.101.2023.07.14.05.44.29; Fri, 14 Jul 2023 05:44:42 -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 S235832AbjGNMYD (ORCPT + 99 others); Fri, 14 Jul 2023 08:24:03 -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_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 , Hans de Goede , =?utf-8?q?Amadeusz_S=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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771399997942835581 X-GMAIL-MSGID: 1771399997942835581 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 */