clear-pkgs-linux-iot-lts2018/0226-SKL-PCM-Derive-the-SDW...

101 lines
3.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Hardik Shah <hardik.t.shah@intel.com>
Date: Fri, 20 May 2016 14:55:05 +0530
Subject: [PATCH] SKL:PCM: Derive the SDW master controller number from be_id.
SDW Master number or SSP instance number can be derived from
VBUS ID. But for aggregation one copier is linked to two
SDW master controllers, so its not feasible to get controller
number from vbus_id. So fixing the range of BE_IDs for number
of controllers to find for which controller PCM ops got called.
Change-Id: I6cb995404e0488e660f35f943e9bfc3fdc518e07
Signed-off-by: Hardik Shah <hardik.t.shah@intel.com>
Reviewed-on:
---
sound/soc/intel/skylake/skl-sdw-pcm.c | 31 ++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-sdw-pcm.c b/sound/soc/intel/skylake/skl-sdw-pcm.c
index af8d117..504228e 100644
--- a/sound/soc/intel/skylake/skl-sdw-pcm.c
+++ b/sound/soc/intel/skylake/skl-sdw-pcm.c
@@ -24,6 +24,7 @@
#include <sound/soc.h>
#include "skl.h"
#include "skl-topology.h"
+#include "skl-sdw-pcm.h"
#define STREAM_STATE_ALLOC_STREAM_TAG 0x1
#define STREAM_STATE_ALLOC_STREAM 0x2
@@ -42,6 +43,7 @@ struct sdw_dma_data {
struct sdw_master *mstr;
enum cnl_sdw_pdi_stream_type stream_type;
int stream_state;
+ int mstr_nr;
};
@@ -54,6 +56,7 @@ int cnl_sdw_startup(struct snd_pcm_substream *substream,
struct sdw_master *mstr;
struct sdw_dma_data *dma;
int ret = 0;
+ char *uuid = NULL;
m_cfg = skl_tplg_be_get_cpr_module(dai, substream->stream);
@@ -61,7 +64,18 @@ int cnl_sdw_startup(struct snd_pcm_substream *substream,
dev_err(dai->dev, "BE Copier not found\n");
return -EINVAL;
}
- sdw_ctrl_nr = m_cfg->vbus_id;
+ if (dai->id >= SDW_BE_DAI_ID_MSTR3)
+ sdw_ctrl_nr = 3;
+
+ else if (dai->id >= SDW_BE_DAI_ID_MSTR2)
+ sdw_ctrl_nr = 2;
+
+ else if (dai->id >= SDW_BE_DAI_ID_MSTR1)
+ sdw_ctrl_nr = 1;
+
+ else
+ sdw_ctrl_nr = 0;
+
mstr = sdw_get_master(sdw_ctrl_nr);
if (!mstr) {
dev_err(dai->dev, "Master controller not found\n");
@@ -81,9 +95,10 @@ int cnl_sdw_startup(struct snd_pcm_substream *substream,
return -EINVAL;
}
dma->mstr = mstr;
+ dma->mstr_nr = sdw_ctrl_nr;
snd_soc_dai_set_dma_data(dai, substream, dma);
- ret = sdw_alloc_stream_tag(NULL, &dma->stream_tag);
+ ret = sdw_alloc_stream_tag(uuid, &dma->stream_tag);
if (ret) {
dev_err(dai->dev, "Unable to allocate stream tag");
ret = -EINVAL;
@@ -144,7 +159,17 @@ int cnl_sdw_hw_params(struct snd_pcm_substream *substream,
dev_err(dai->dev, "BE Copier not found\n");
return -EINVAL;
}
- m_cfg->sdw_stream_num = dma->port->pdi_stream->sdw_pdi_num;
+
+ if (!m_cfg->sdw_agg_enable)
+ m_cfg->sdw_stream_num = dma->port->pdi_stream->sdw_pdi_num;
+ else
+ m_cfg->sdw_agg.agg_data[dma->mstr_nr].alh_stream_num =
+ dma->port->pdi_stream->sdw_pdi_num;
+ ret = skl_tplg_be_update_params(dai, &p_params);
+ if (ret)
+ return ret;
+
+
stream_config.frame_rate = params_rate(params);
/* TODO: Get the multiplication factor from NHLT or the XML
* to decide with Poland team from where to get it
--
2.21.0