diff options
author | Bard Liao <yung-chuan.liao@linux.intel.com> | 2020-09-08 21:15:20 +0800 |
---|---|---|
committer | Vinod Koul <vkoul@kernel.org> | 2020-09-18 17:48:51 +0530 |
commit | 9026118f20e28f202dab34f219bbb831ffb8c4dc (patch) | |
tree | 1ee57a6ac5368a66aad6feed6ac8074a15fdf05b /drivers/soundwire/bus.c | |
parent | 32d2a8935bf8faf201ff1a859eeb43ef6e5e438d (diff) |
soundwire: Add generic bandwidth allocation algorithm
This algorithm computes bus parameters like clock frequency, frame
shape and port transport parameters based on active stream(s) running
on the bus.
Developers can also implement their own .compute_params() callback for
specific resource management algorithm, and set if before calling
sdw_add_bus_master()
Credits: this patch is based on an earlier internal contribution by
Vinod Koul, Sanyog Kale, Shreyas Nc and Hardik Shah. All hard-coded
values were removed from the initial contribution to use BIOS
information instead.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20200908131520.5712-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire/bus.c')
-rw-r--r-- | drivers/soundwire/bus.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 02574b4bb179..340fd1e23e5c 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -61,6 +61,12 @@ int sdw_bus_master_add(struct sdw_bus *bus, struct device *parent, return -EINVAL; } + if (!bus->compute_params) { + dev_err(bus->dev, + "Bandwidth allocation not configured, compute_params no set\n"); + return -EINVAL; + } + mutex_init(&bus->msg_lock); mutex_init(&bus->bus_lock); INIT_LIST_HEAD(&bus->slaves); |