clear-pkgs-linux-iot-lts2018/0216-REVERTME-SKL-Topology-...

94 lines
3.0 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:42:17 +0530
Subject: [PATCH] REVERTME:SKL:Topology: Add logic to create SDW aggregation
blob.
Blob needs to be sent to copier for SDW aggregation. Normally
blob is derived from NHLT, but since in SDW blob, stream number
is dynamic, blob needs to be created in driver. Blob creation
logic for the SDW is implemented in this function. Actually
this should go in skl-messages.c as per review. Need to move
this to skl-messages.c in next patch set.
Change-Id: Ifc58a2343498190f736295754be2c14e3c6d5bea
Signed-off-by: Hardik Shah <hardik.t.shah@intel.com>
Reviewed-on:
---
sound/soc/intel/skylake/skl-topology.c | 40 ++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 8cc33fbec030..52d73a4fc917 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1865,6 +1865,17 @@ static u8 skl_tplg_be_link_type(int dev_type)
return ret;
}
+struct skl_sdw_agg_data_caps {
+ u32 alh_stream_num;
+ u32 ch_mask;
+} __packed;
+
+struct skl_sdw_caps_cfg {
+ u32 gw_attributes;
+ u32 count;
+ struct skl_sdw_agg_data_caps data[0];
+
+} __packed;
/*
* Fill the BE gateway parameters
@@ -1873,20 +1884,45 @@ static u8 skl_tplg_be_link_type(int dev_type)
* The port can have multiple settings so pick based on the PCM
* parameters
*/
+#define SDW_MAX_MASTERS 4
static int skl_tplg_be_fill_pipe_params(struct snd_soc_dai *dai,
struct skl_module_cfg *mconfig,
struct skl_pipe_params *params)
{
+ int i;
struct nhlt_specific_cfg *cfg;
+ struct skl_sdw_caps_cfg *sdw_cfg;
struct skl *skl = get_skl_ctx(dai->dev);
int link_type = skl_tplg_be_link_type(mconfig->dev_type);
u8 dev_type = skl_tplg_be_dev_type(mconfig->dev_type);
skl_tplg_fill_dma_id(mconfig, params);
- if (link_type == NHLT_LINK_HDA || link_type == NHLT_LINK_SDW)
+ if (link_type == NHLT_LINK_HDA)
return 0;
-
+ if (link_type == NHLT_LINK_SDW) {
+ sdw_cfg = kzalloc((((sizeof(struct skl_sdw_agg_data_caps)) *
+ (mconfig->sdw_agg.num_masters)) + 2),
+ GFP_KERNEL);
+ if (!sdw_cfg)
+ return -ENOMEM;
+ mconfig->formats_config.caps_size = (((sizeof(u32)) *
+ (mconfig->sdw_agg.num_masters) * 2)
+ + (2 * (sizeof(u32))));
+
+ sdw_cfg->count = mconfig->sdw_agg.num_masters;
+ for (i = 0; i < SDW_MAX_MASTERS; i++) {
+ if (mconfig->sdw_agg.agg_data[i].ch_mask) {
+ sdw_cfg->data[i].ch_mask =
+ mconfig->sdw_agg.agg_data[i].ch_mask;
+ sdw_cfg->data[i].alh_stream_num =
+ mconfig->sdw_agg.agg_data[i].alh_stream_num;
+ }
+ }
+ sdw_cfg->count = mconfig->sdw_agg.num_masters;
+ mconfig->formats_config.caps = (u32 *) sdw_cfg;
+ return 0;
+ }
/* update the blob based on virtual bus_id*/
if (!skl->nhlt_override) {
cfg = skl_get_ep_blob(skl, mconfig->vbus_id, link_type,
--
https://clearlinux.org