From patchwork Tue Jul 11 12:57:16 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: 118505 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp456823vqm; Tue, 11 Jul 2023 06:00:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFdRCt0bOJt4IzPrtXCbgguY9fZTNe7xsoYLA98ZqXbZcHs69sjMpCPTqEfJ3dBFPQWhi2 X-Received: by 2002:a92:d4d1:0:b0:346:4c75:a8b5 with SMTP id o17-20020a92d4d1000000b003464c75a8b5mr10283922ilm.15.1689080428927; Tue, 11 Jul 2023 06:00:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689080428; cv=none; d=google.com; s=arc-20160816; b=mX9Yvn4HJffVh2wtIjY97VSkOuh0o6G6dFJIXKFM8jp8vVcZI3N25eJTC/JacOtD2Y 0ienPX0jrlhP3HoRHNzyYzxV+EDlj4aXy09ezm513EduJRyunbDsNOdpTVVrRtxcKvhV +E1FQ3DnKADEf2h8Sc4mD5AeEkFPzmpaKL2zfKMlUgYuERneC/Adbie89ilOAZkJ4kHk 1GmBfe0q+RXz1dDk17lAzYz0nh2iNbj8hxJ2+Hf+df5VmGvl+Cgjgd9pJw9LidW6HU05 lNdqpfaYRG0t4YolBuv9vLv4HePgTcKyRYV+SAEZ5NyOjXa2YUJFOz4UjDpXetQ+IlOV Oarw== 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=H7uN0GbRfTjXyXzo3fG7dsaC3dQzioXNssZkidj/xYo=; fh=sKxO7Xj+YIOQJw2gBVYevujm0+5GA4/lF0Hs7SAhyQ0=; b=vltYLohsSCnbgYmC/ihAwhApflbTxfiykINb+/d6TVPDNyzV8AiWQIVUF0lD/HvzAl vra79KX7JKcrAq+rMtk4fgDRexlIHxkJ821SEvgFCMZx4YUBO9PZ7qx77q3hqeNBaO/u 9/H4glDLU7+hVUNFC7IY4xQP015J8p74VDc9aY5892Kn3V3iEVh2biMxvyEhUcYId8VJ V6E0+b84yEXhlpy0NbtQGwigccvqck/Dz6bOKloSQcC/vpyaYwkepcg1IUg3KUeB/3ec CwKsE8ghM05LGEC/LwwwgJQRAQH9VmaDykrCow4vLlBUb4cseE3YZoig1OGUUPY81Ge7 BPwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Usi03dCp; 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 a7-20020a17090a008700b002637aa0a4dbsi8638941pja.103.2023.07.11.06.00.15; Tue, 11 Jul 2023 06:00:28 -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=Usi03dCp; 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 S231704AbjGKM5d (ORCPT + 99 others); Tue, 11 Jul 2023 08:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231441AbjGKM5c (ORCPT ); Tue, 11 Jul 2023 08:57:32 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3E6610EA; Tue, 11 Jul 2023 05:57:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689080245; x=1720616245; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cqzG/YH5kuutolTR1cOIZEsbX/zwe6Apecdzhtfj8uI=; b=Usi03dCpw0uOVOEiZr4WP0ryP3hArSw4Bxayc5FVLumKUf98FQytgWHk g8nquCIWKqlkVcYD5sYXuFtg3zpiwG/V8kw5R+502cQkh4sXeKTjbEGmu royw43R9Ju8YN13xXKy0FQLwsThhJxT+ZliSDcmca7F2bn/sa9S2MLP0o MpuXqr1Ebt/3OzXJXan7HXgPt3OKdFVTs+IqyXz+YYoIIb0ok0H72eVHP kaJOJRBIsDHbSU6mhsIWijqnLr1+opd/fDPiDmatQ+3XKrYlTVF/4TIv5 CMyRB1/WrNr8sqzOrss2Dipog6ZuKwemgx9WNKSIRyQKfXb3Zqow3+8Xe A==; X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="367187388" X-IronPort-AV: E=Sophos;i="6.01,196,1684825200"; d="scan'208";a="367187388" 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:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10768"; a="834666531" X-IronPort-AV: E=Sophos;i="6.01,196,1684825200"; d="scan'208";a="834666531" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga002.fm.intel.com with ESMTP; 11 Jul 2023 05:57:13 -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?= Subject: [PATCH 03/13] ALSA: hda: Add controller matching macros Date: Tue, 11 Jul 2023 14:57:16 +0200 Message-Id: <20230711125726.3509391-4-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771129199859260540 X-GMAIL-MSGID: 1771129199859260540 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. Signed-off-by: Amadeusz Sławiński Reviewed-by: Andy Shevchenko --- include/sound/hdaudio.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 2ffdf58bd6d4..aacacca456d5 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,30 @@ 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) (HDA_CONTROLLER_IS_HSW(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)) + #endif /* __SOUND_HDAUDIO_H */