From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE033C4167B for ; Mon, 27 Nov 2023 13:03:40 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3D787DF2; Mon, 27 Nov 2023 14:03:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3D787DF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701090218; bh=MKeHYQIcm37ccjV6yff59a6zCUoujh/0QydqqvKlRA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=VnfQkB8qOSb/cUYzCmhWUq+qdYxH7NklNRlz4q9VTpYxg6nRGFNwCY5GJiTl2jAnh Vlecel7WgkyA77k04cqRkc1JVVgzylOy5lAcNOeqAQDQjwsaVA5NjMehVbEK1uow53 Xt1+ivnSpqW3xpTNSoH+kX6sZhVBFFTSx7LiAIS0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id F0BF1F805C1; Mon, 27 Nov 2023 14:02:58 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 10AF6F805CA; Mon, 27 Nov 2023 14:02:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E77ADF8016E; Mon, 27 Nov 2023 14:02:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2B1BCF8016E for ; Mon, 27 Nov 2023 14:02:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2B1BCF8016E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=U/8kFjXB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701090166; x=1732626166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MKeHYQIcm37ccjV6yff59a6zCUoujh/0QydqqvKlRA8=; b=U/8kFjXBvayL1XMuAsHrH+tA00d/z4EUTRjvqPP2H6rbu3darLv4ENTu Et/X7EVirfQg6xhNQs3yohgqUrBYRKk5Nz9rH+Mh5NVWlMEuLtp5zlPWQ RJCWNnaT1LmaPeJLMhk18th2ER2gp9cpVZWTd7w2Pvdj6T4bR8h2nIo0R ZctKIJ+jyGmCKcFC9hVPpyKK7e1usXgiwv/h67BDj96H/ggXFcpHGk3r9 VK514e8EJe3LM2UZXESHVnvsbfbD89oQOlM4df2F6iRniaP1cQQHws+Xv zey3kWxXuecQABdUTmhAHeWuU68/i8yxyYg2dpMMzjBKE6Heyl5xZHm+W w==; X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="391568035" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="391568035" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 05:02:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10906"; a="797228703" X-IronPort-AV: E=Sophos;i="6.04,230,1695711600"; d="scan'208";a="797228703" Received: from acornagl-mobl.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.58.144]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Nov 2023 05:02:13 -0800 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com Subject: [PATCH 1/2] ALSA: hda/hdmi: Add helper function to check if a device is HDMI codec Date: Mon, 27 Nov 2023 15:02:44 +0200 Message-ID: <20231127130245.24295-2-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231127130245.24295-1-peter.ujfalusi@linux.intel.com> References: <20231127130245.24295-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CQK2FVN6E47RCVEG7BKDQLMBKQBMAMOD X-Message-ID-Hash: CQK2FVN6E47RCVEG7BKDQLMBKQBMAMOD X-MailFrom: peter.ujfalusi@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The snd_hda_device_is_hdmi() can be used in drivers to check if the hdev belongs to a display audio device. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen --- include/sound/hdaudio.h | 10 ++++++++++ sound/pci/hda/patch_hdmi.c | 13 +++++++++++++ 2 files changed, 23 insertions(+) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index dd7c87bbc613..cf5483d6b5b7 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -158,6 +158,16 @@ bool snd_hdac_check_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); unsigned int snd_hdac_sync_power_state(struct hdac_device *hdac, hda_nid_t nid, unsigned int target_state); + +#if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI) +bool snd_hda_device_is_hdmi(struct hdac_device *hdev); +#else +static inline bool snd_hda_device_is_hdmi(struct hdac_device *hdev) +{ + return false; +} +#endif + /** * snd_hdac_read_parm - read a codec parameter * @codec: the codec object diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 1cde2a69bdb4..d6943575c8c7 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -4645,6 +4645,19 @@ HDA_CODEC_ENTRY(HDA_CODEC_ID_GENERIC_HDMI, "Generic HDMI", patch_generic_hdmi), }; MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_hdmi); +bool snd_hda_device_is_hdmi(struct hdac_device *hdev) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(snd_hda_id_hdmi); i++) { + if (snd_hda_id_hdmi[i].vendor_id == hdev->vendor_id) + return true; + } + + return false; +} +EXPORT_SYMBOL_GPL(snd_hda_device_is_hdmi); + MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("HDMI HD-audio codec"); MODULE_ALIAS("snd-hda-codec-intelhdmi"); -- 2.43.0