From patchwork Thu Jan 20 23:21:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 534559 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 42EA5C433EF for ; Thu, 20 Jan 2022 23:23:57 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1A6862BEF; Fri, 21 Jan 2022 00:23:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1A6862BEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1642721035; bh=uH2kXM/iq8U6IPuFRmIvgFpDnlbRgD+EJlBLvo/JR9c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gue3cxLH/CT7An+0WcIJn5AQm7rGrUqNMPhgSaWE2k70aPkt+4vV5GjkZ6Nt2OATT Dwj4jDJnoEf7FRMXP5ByGRDRdPciY7TXJ6oWAyp8Q9vVbQS9NZvfw5rsnRofjY3Zsf JMSCFxxxU8cj8zV1dj1PgvkLBG0b6ArB4skuSWd4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 653D4F80423; Fri, 21 Jan 2022 00:22:21 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B72D9F804BB; Fri, 21 Jan 2022 00:22:19 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 3D18EF80248 for ; Fri, 21 Jan 2022 00:22:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3D18EF80248 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LroJXjV8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1642720934; x=1674256934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uH2kXM/iq8U6IPuFRmIvgFpDnlbRgD+EJlBLvo/JR9c=; b=LroJXjV8FwtdNcWHXKvntEOhfJEeJopJ+C/dyYDO1pj7peuVGu+n4iOm ltTOxRb6kyDNFxrh2VYzppMbNJ2i1PQMnroWHG0ISm/b3+JCMSsAknM5e Vzx0Iu5gtRIUwST5wmBux4+GHSqx1r/eZHfl01BQBUby+mFiKSfd8smCf lnRI3hdGr6XiPyyXgzYTM2LiId7uQLoxVAponBK/c2rA7OEx1kpXo52GQ N0DX3RESJ15BcWYx6G+uQX294cb+GEB8hRpcBrxUN8ZWLlAzyevEECoh1 srcvKmrg3UqTWnpOOqSQKSYvEVpzTSkAxj/DHdvCle4mIyqOSSmT+KhgW Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10233"; a="269926958" X-IronPort-AV: E=Sophos;i="5.88,303,1635231600"; d="scan'208";a="269926958" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2022 15:22:08 -0800 X-IronPort-AV: E=Sophos;i="5.88,303,1635231600"; d="scan'208";a="493637728" Received: from sthambit-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.212.64.44]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2022 15:22:07 -0800 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Subject: [PATCH 2/2] ASoC: SOF: Intel: Compare sdw adr directly Date: Thu, 20 Jan 2022 17:21:57 -0600 Message-Id: <20220120232157.199919-3-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220120232157.199919-1-pierre-louis.bossart@linux.intel.com> References: <20220120232157.199919-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Cc: Pierre-Louis Bossart , tiwai@suse.de, Ranjani Sridharan , Rander Wang , vkoul@kernel.org, broonie@kernel.org, Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Bard Liao We can exclude the sdw unique id and compare the sdw adr directly when we are finding out identical parts. Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/intel/hda.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 67936be54ef7..8f6765317cfa 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -1179,6 +1179,10 @@ static void hda_generic_machine_select(struct snd_sof_dev *sdev, #endif #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE) + +#define SDW_CODEC_ADR_MASK(_adr) ((_adr) & (SDW_DISCO_LINK_ID_MASK | SDW_VERSION_MASK | \ + SDW_MFG_ID_MASK | SDW_PART_ID_MASK)) + /* Check if all Slaves defined on the link can be found */ static bool link_slaves_found(struct snd_sof_dev *sdev, const struct snd_soc_acpi_link_adr *link, @@ -1220,17 +1224,8 @@ static bool link_slaves_found(struct snd_sof_dev *sdev, /* find out how many identical parts are expected */ for (k = 0; k < link->num_adr; k++) { u64 adr2 = link->adr_d[k].adr; - unsigned int part_id2, link_id2, mfg_id2, version2; - - mfg_id2 = SDW_MFG_ID(adr2); - part_id2 = SDW_PART_ID(adr2); - link_id2 = SDW_DISCO_LINK_ID(adr2); - version2 = SDW_VERSION(adr2); - if (link_id2 == link_id && - part_id2 == part_id && - mfg_id2 == mfg_id && - version2 == version) + if (SDW_CODEC_ADR_MASK(adr2) == SDW_CODEC_ADR_MASK(adr)) expected_part_count++; }