112 lines
4.0 KiB
Diff
112 lines
4.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Praveen Diwakar <praveen.diwakar@intel.com>
|
|
Date: Wed, 8 Mar 2017 20:12:57 +0530
|
|
Subject: [PATCH] ASoC: Intel: Skylake: Audio format mismatch detection
|
|
|
|
This patch detects mismatch in audio format for source and destination
|
|
modules. It prints warning to inform a mismatch
|
|
occured in given path.
|
|
|
|
Change-Id: Ic9fe0bbde2e2487d3ec25cbd3723ebaab81b395a
|
|
Signed-off-by: Praveen Diwakar <praveen.diwakar@intel.com>
|
|
Signed-off-by: Rahul Patil <rahul.raghunathx.patil@intel.com>
|
|
Reviewed-on:
|
|
Reviewed-by: Nc, Shreyas <shreyas.nc@intel.com>
|
|
Reviewed-by: Prusty, Subhransu S <subhransu.s.prusty@intel.com>
|
|
Reviewed-by: Singh, Guneshwor O <guneshwor.o.singh@intel.com>
|
|
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
Reviewed-by: Kp, Jeeja <jeeja.kp@intel.com>
|
|
Tested-by: Sm, Bhadur A <bhadur.a.sm@intel.com>
|
|
---
|
|
sound/soc/intel/skylake/skl-messages.c | 67 ++++++++++++++++++++++++++
|
|
1 file changed, 67 insertions(+)
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
|
|
index e0d6f74a8fd5..f4ebdce7446d 100644
|
|
--- a/sound/soc/intel/skylake/skl-messages.c
|
|
+++ b/sound/soc/intel/skylake/skl-messages.c
|
|
@@ -2086,6 +2086,70 @@ static void fill_pin_params(struct skl_audio_data_format *pin_fmt,
|
|
|
|
#define CPR_SINK_FMT_PARAM_ID 2
|
|
|
|
+static struct
|
|
+skl_module_fmt *skl_get_pin_format(struct skl_module_cfg *mconfig,
|
|
+ u8 pin_direction, u8 pin_idx)
|
|
+{
|
|
+ struct skl_module *module = mconfig->module;
|
|
+ int fmt_idx = mconfig->fmt_idx;
|
|
+ struct skl_module_iface *intf;
|
|
+ struct skl_module_fmt *pin_fmt;
|
|
+
|
|
+ intf = &module->formats[fmt_idx];
|
|
+
|
|
+ if (pin_direction == SKL_INPUT_PIN)
|
|
+ pin_fmt = &intf->inputs[pin_idx].fmt;
|
|
+ else
|
|
+ pin_fmt = &intf->outputs[pin_idx].fmt;
|
|
+
|
|
+ return pin_fmt;
|
|
+}
|
|
+
|
|
+/*
|
|
+ * This function checks for source module and destination module format
|
|
+ * mismatch
|
|
+ */
|
|
+static void skl_module_format_mismatch_detection(struct skl_sst *ctx,
|
|
+ struct skl_module_cfg *src_mcfg,
|
|
+ struct skl_module_cfg *dst_mcfg,
|
|
+ int src_index, int dst_index)
|
|
+{
|
|
+ struct skl_module_fmt *src_fmt, *dst_fmt;
|
|
+
|
|
+ src_fmt = skl_get_pin_format(src_mcfg, SKL_OUTPUT_PIN, src_index);
|
|
+ dst_fmt = skl_get_pin_format(dst_mcfg, SKL_INPUT_PIN, dst_index);
|
|
+
|
|
+ if(memcmp(src_fmt, dst_fmt, sizeof(*src_fmt))) {
|
|
+ dev_warn(ctx->dev, "#### src and dst format mismatch: ####\n");
|
|
+ dev_warn(ctx->dev, "pipe=%d src module_id=%d src instance_id=%d\n",
|
|
+ src_mcfg->pipe->ppl_id,
|
|
+ src_mcfg->id.module_id,
|
|
+ src_mcfg->id.pvt_id);
|
|
+
|
|
+ dev_warn(ctx->dev, "pipe=%d dst module_id=%d dst instance_id=%d\n",
|
|
+ dst_mcfg->pipe->ppl_id,
|
|
+ dst_mcfg->id.module_id,
|
|
+ dst_mcfg->id.pvt_id);
|
|
+
|
|
+ dev_warn(ctx->dev, "channels: src=%d dst=%d\n",
|
|
+ src_fmt->channels, dst_fmt->channels);
|
|
+ dev_warn(ctx->dev, "s_freq: src=%d dst=%d\n",
|
|
+ src_fmt->s_freq, dst_fmt->s_freq);
|
|
+ dev_warn(ctx->dev, "bit_depth: src=%d dst=%d\n",
|
|
+ src_fmt->bit_depth, dst_fmt->bit_depth);
|
|
+ dev_warn(ctx->dev, "valid_bit_depth: src=%d dst=%d\n",
|
|
+ src_fmt->valid_bit_depth, dst_fmt->valid_bit_depth);
|
|
+ dev_warn(ctx->dev, "ch_cfg: src=%d dst=%d\n",
|
|
+ src_fmt->ch_cfg, dst_fmt->ch_cfg);
|
|
+ dev_warn(ctx->dev, "interleaving_style: src=%d dst=%d\n",
|
|
+ src_fmt->interleaving_style, dst_fmt->interleaving_style);
|
|
+ dev_warn(ctx->dev, "sample_type: src=%d dst=%d\n",
|
|
+ src_fmt->sample_type, dst_fmt->sample_type);
|
|
+ dev_warn(ctx->dev, "ch_map: src=%d dst=%d\n",
|
|
+ src_fmt->ch_map, dst_fmt->ch_map);
|
|
+ }
|
|
+}
|
|
+
|
|
/*
|
|
* Once a module is instantiated it need to be 'bind' with other modules in
|
|
* the pipeline. For binding we need to find the module pins which are bind
|
|
@@ -2152,6 +2216,9 @@ int skl_bind_modules(struct skl_sst *ctx,
|
|
dev_dbg(ctx->dev, "src queue = %d dst queue =%d\n",
|
|
msg.src_queue, msg.dst_queue);
|
|
|
|
+ skl_module_format_mismatch_detection(ctx, src_mcfg, dst_mcfg,
|
|
+ src_index, dst_index);
|
|
+
|
|
msg.module_id = src_mcfg->id.module_id;
|
|
msg.instance_id = src_mcfg->id.pvt_id;
|
|
msg.dst_module_id = dst_mcfg->id.module_id;
|
|
--
|
|
https://clearlinux.org
|
|
|