summary refs log tree commit diff
path: root/drivers/soundwire
diff options
context:
space:
mode:
authorVinod Koul <vkoul@kernel.org>2019-08-13 09:35:46 +0100
committerVinod Koul <vkoul@kernel.org>2019-09-04 14:57:19 +0530
commitc7578c1d6285252d862b324f6fc26dd5adc8517c (patch)
treedf8b857395a35ee11673115f6ea70c26bcefdb75 /drivers/soundwire
parenta2e484585ad306aa8ac84140ef54d722ac8f45df (diff)
downloadlinux-c7578c1d6285252d862b324f6fc26dd5adc8517c.tar.gz
soundwire: Add compute_params callback
This callback allows masters to compute the bus parameters required.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20190813083550.5877-2-srinivas.kandagatla@linaro.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Diffstat (limited to 'drivers/soundwire')
-rw-r--r--drivers/soundwire/stream.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 8d6c13528b68..0bc1b4dbd14b 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1485,6 +1485,16 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream)
 		bus->params.bandwidth += m_rt->stream->params.rate *
 			m_rt->ch_count * m_rt->stream->params.bps;
 
+		/* Compute params */
+		if (bus->compute_params) {
+			ret = bus->compute_params(bus);
+			if (ret < 0) {
+				dev_err(bus->dev, "Compute params failed: %d",
+					ret);
+				return ret;
+			}
+		}
+
 		/* Program params */
 		ret = sdw_program_params(bus);
 		if (ret < 0) {