Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp290265ybt; Tue, 23 Jun 2020 22:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb4cC+ftAaFOtq3sCVQYx4NYXaIqX1MUH/LwmrInDhYkerMzEfU4Pt1mlXgCSbmEo9DCmR X-Received: by 2002:a05:6402:30b2:: with SMTP id df18mr13955270edb.229.1592976761649; Tue, 23 Jun 2020 22:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592976761; cv=none; d=google.com; s=arc-20160816; b=cLBeeGxwX9Df3EGFQwOoTeGztC+DctrYyrdnzlDTQabCWsJKwXvZ4vWf0MZ+0b2oqk 9Uq9FJf3ezxHFp4fma8CKVGND5SMDM9WC+FGQTpCTpBxjbpgruy2sk3yWrzNmvJjFZ4W CJ2TQWChehZZTkvIaTnuR6zlGY/0W0XWVbJzyrlEGdXiK74H6Dm40XvRr7W2O+jb+YI2 AoLkh8lbq4/C5oLJXAk3ulC697SAL2n4r6GNqFvizhizKkYJg8vky9CXsTYofomR55JD 0jJXAn0ArfZteE7cEj2zfmUQ9M0rrTgiE//GHXHplNkNFuNrTBBCEyIx4EsSlaYWyrAs GJzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=Y4secoFryd25wmZ+9dvsOmauvrELYFqkQd98mmMMOGE=; b=bOST6GaZcTwzpncqCpR7bULwKsThFkTvUGPsLsjnz6WG4xaFFHlK2Z4Z3svcqXvx6S q0f6ZGrd17QrXFa7atYpKmu5yCpeLLBFbpk0lHf/ruiB0LNzm+JSiKXJjLrRZNEa0XW5 nZlfJ98kvm6mrwgm85xr/OrAW3OaK8qeJ15qBjPwRw8blwwZzjET6Ze9XR2vfrLASpHf dB9pg6C4I3+aAFrHsmZNlMMw0dBLdpFvMJ49PWHpbfUjG2mmoQZPReN6bfnSXwWILeJX 5GYIeEaT34Nrx8DQGB0zCn3+DdkpbbyEEfqXQRtua6ZYf1TM2aLKuGO9ATvVoCdVVzI2 P65w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si824008eju.654.2020.06.23.22.32.18; Tue, 23 Jun 2020 22:32:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389037AbgFXFar (ORCPT + 99 others); Wed, 24 Jun 2020 01:30:47 -0400 Received: from mga02.intel.com ([134.134.136.20]:1697 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389022AbgFXFap (ORCPT ); Wed, 24 Jun 2020 01:30:45 -0400 IronPort-SDR: +PfI0qPQi9c351f7eOCpJgeKttqxLzLU83Ze/9klFMSSpcrlIOTMeXuoPLwBs6YnBu9TLAfVZC b01wii542rgw== X-IronPort-AV: E=McAfee;i="6000,8403,9661"; a="132755881" X-IronPort-AV: E=Sophos;i="5.75,274,1589266800"; d="scan'208";a="132755881" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2020 22:30:45 -0700 IronPort-SDR: YHZbXwFMmJMd1fC8ZZkZVKSQwJO+OCQaDr50XMc5njX1ODc/gEjJ9ey/TZZbyFPUHvGqSGvqtv TN22WHx0/Zdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,274,1589266800"; d="scan'208";a="452513619" Received: from bard-ubuntu.sh.intel.com ([10.239.13.33]) by orsmga005.jf.intel.com with ESMTP; 23 Jun 2020 22:30:38 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Cc: vinod.koul@linaro.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, rander.wang@linux.intel.com, ranjani.sridharan@linux.intel.com, hui.wang@canonical.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, slawomir.blauciak@intel.com, mengdong.lin@intel.com, bard.liao@intel.com Subject: [PATCH 9/9] Soundwire: intel_init: save Slave(s) _ADR info in sdw_intel_ctx Date: Wed, 24 Jun 2020 01:35:46 +0800 Message-Id: <20200623173546.21870-10-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> References: <20200623173546.21870-1-yung-chuan.liao@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Save ACPI information in context so that we can match machine driver with sdw _ADR matching tables. Suggested-by: Guennadi Liakhovetski Signed-off-by: Bard Liao Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel_init.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c index eff4e385bb59..6502a5e82229 100644 --- a/drivers/soundwire/intel_init.c +++ b/drivers/soundwire/intel_init.c @@ -188,7 +188,11 @@ static struct sdw_intel_ctx struct sdw_intel_link_res *link; struct sdw_intel_ctx *ctx; struct acpi_device *adev; + struct sdw_slave *slave; + struct list_head *node; + struct sdw_bus *bus; u32 link_mask; + int num_slaves = 0; int count; int i; @@ -265,6 +269,26 @@ static struct sdw_intel_ctx link->cdns = platform_get_drvdata(pdev); list_add_tail(&link->list, &ctx->link_list); + bus = &link->cdns->bus; + /* Calculate number of slaves */ + list_for_each(node, &bus->slaves) + num_slaves++; + } + + ctx->ids = devm_kcalloc(&adev->dev, num_slaves, + sizeof(*ctx->ids), GFP_KERNEL); + if (!ctx->ids) + goto err; + + ctx->num_slaves = num_slaves; + i = 0; + list_for_each_entry(link, &ctx->link_list, list) { + bus = &link->cdns->bus; + list_for_each_entry(slave, &bus->slaves, node) { + ctx->ids[i].id = slave->id; + ctx->ids[i].link_id = bus->link_id; + i++; + } } return ctx; -- 2.17.1