[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200227223206.5020-9-pierre-louis.bossart@linux.intel.com>
Date: Thu, 27 Feb 2020 16:32:06 -0600
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: alsa-devel@...a-project.org
Cc: linux-kernel@...r.kernel.org, tiwai@...e.de, broonie@...nel.org,
vkoul@...nel.org, gregkh@...uxfoundation.org, jank@...ence.com,
srinivas.kandagatla@...aro.org, slawomir.blauciak@...el.com,
Bard liao <yung-chuan.liao@...ux.intel.com>,
Rander Wang <rander.wang@...ux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Hui Wang <hui.wang@...onical.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Sanyog Kale <sanyog.r.kale@...el.com>
Subject: [PATCH 8/8] soundwire: intel_init: save Slave(s) _ADR info in sdw_intel_ctx
From: Bard Liao <yung-chuan.liao@...ux.intel.com>
Save ACPI information in context so that we can match machine driver
with sdw _ADR matching tables.
Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@...ux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@...ux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
---
drivers/soundwire/intel_init.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 91ec91127f2a..60d6d844ee4a 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -74,6 +74,8 @@ static int sdw_intel_cleanup(struct sdw_intel_ctx *ctx)
kfree(ctx->links);
ctx->links = NULL;
+ kfree(ctx->ids);
+ ctx->ids = NULL;
return 0;
}
@@ -188,7 +190,11 @@ static struct sdw_intel_ctx
struct acpi_device *adev;
struct sdw_master_device *md;
unsigned long time;
+ struct sdw_slave *slave;
+ struct list_head *node;
+ struct sdw_bus *bus;
u32 link_mask;
+ int num_slaves = 0;
int count;
int i;
@@ -261,6 +267,25 @@ static struct sdw_intel_ctx
link->md = md;
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 = kcalloc(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.20.1
Powered by blists - more mailing lists