All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Ramesh Babu <ramesh.babu@intel.com>
Cc: Vinod Koul <vinod.koul@intel.com>,
	liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, patches.audio@intel.com
Subject: Applied "ASoC: Intel: Skylake: Add strip extended manifest utility" to the asoc tree
Date: Mon, 30 May 2016 18:39:19 +0100	[thread overview]
Message-ID: <E1b7R9r-0000oG-9g@debutante> (raw)
In-Reply-To: <1464610381-19416-2-git-send-email-vinod.koul@intel.com>

The patch

   ASoC: Intel: Skylake: Add strip extended manifest utility

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 6eee87261f69e366bfe9b908ae3b441efb8e28ea Mon Sep 17 00:00:00 2001
From: Ramesh Babu <ramesh.babu@intel.com>
Date: Mon, 30 May 2016 17:42:55 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Add strip extended manifest utility

Some upcoming platforms like broxton etc have extended manifest
in firmware binary. This is not required to be downloaded to DSP.
So driver needs to strip this before downloading.

Add a utility function to check if a header exists, and remove it
in that case

Signed-off-by: Ramesh Babu <ramesh.babu@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/intel/skylake/Makefile        |  2 +-
 sound/soc/intel/skylake/skl-sst-dsp.h   |  2 ++
 sound/soc/intel/skylake/skl-sst-utils.c | 54 +++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)
 create mode 100644 sound/soc/intel/skylake/skl-sst-utils.c

diff --git a/sound/soc/intel/skylake/Makefile b/sound/soc/intel/skylake/Makefile
index c28f5d0e1d99..60fbc9bbe473 100644
--- a/sound/soc/intel/skylake/Makefile
+++ b/sound/soc/intel/skylake/Makefile
@@ -5,6 +5,6 @@ obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl.o
 
 # Skylake IPC Support
 snd-soc-skl-ipc-objs := skl-sst-ipc.o skl-sst-dsp.o skl-sst-cldma.o \
-		skl-sst.o bxt-sst.o
+		skl-sst.o bxt-sst.o skl-sst-utils.o
 
 obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl-ipc.o
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index deabe7308d3b..94878fac2269 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -175,4 +175,6 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 void skl_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx);
 void bxt_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx);
 
+int skl_dsp_strip_extended_manifest(struct firmware *fw);
+
 #endif /*__SKL_SST_DSP_H__*/
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
new file mode 100644
index 000000000000..c00567dad989
--- /dev/null
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -0,0 +1,54 @@
+/*
+ *  skl-sst-utils.c - SKL sst utils functions
+ *
+ *  Copyright (C) 2016 Intel Corp
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#include <linux/firmware.h>
+#include "skl-sst-dsp.h"
+
+/* FW Extended Manifest Header id = $AE1 */
+#define SKL_EXT_MANIFEST_HEADER_MAGIC   0x31454124
+
+struct skl_ext_manifest_hdr {
+	u32 id;
+	u32 len;
+	u16 version_major;
+	u16 version_minor;
+	u32 entries;
+};
+
+/*
+ * some firmware binary contains some extended manifest. This needs
+ * to be stripped in that case before we load and use that image.
+ *
+ * So check for magic header, if found strip the header
+ */
+int skl_dsp_strip_extended_manifest(struct firmware *fw)
+{
+	struct skl_ext_manifest_hdr *hdr;
+
+	/* check if fw file is greater than header we are looking */
+	if (fw->size < sizeof(hdr)) {
+		pr_err("%s: Firmware file small, no hdr\n", __func__);
+		return -EINVAL;
+	}
+
+	hdr = (struct skl_ext_manifest_hdr *)fw->data;
+
+	if (hdr->id == SKL_EXT_MANIFEST_HEADER_MAGIC) {
+		fw->size -= hdr->len;
+		fw->data += hdr->len;
+	}
+
+	return 0;
+}
-- 
2.8.1

  reply	other threads:[~2016-05-30 17:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30 12:12 [PATCH 0/7] ASoC: Intel: Skylake: Manifest parsing support Vinod Koul
2016-05-30 12:12 ` [PATCH 1/7] ASoC: Intel: Skylake: Add strip extended manifest utility Vinod Koul
2016-05-30 17:39   ` Mark Brown [this message]
2016-05-30 12:12 ` [PATCH 2/7] ASoC: Intel: Skylake: Don't use local pointer for firmware Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Don't use local pointer for firmware" to the asoc tree Mark Brown
2016-05-30 12:12 ` [PATCH 3/7] ASoC: Intel: Skylake: Strip manifest for Skylake platform Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Strip manifest for Skylake platform" to the asoc tree Mark Brown
2016-05-30 12:12 ` [PATCH 4/7] ASoC: Intel: Skylake: Strip manifest for Broxton platform Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Strip manifest for Broxton platform" to the asoc tree Mark Brown
2016-05-30 12:12 ` [PATCH 5/7] ASoC: Intel: Skylake: Add DSP firmware manifest parsing Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Add DSP firmware manifest parsing" to the asoc tree Mark Brown
2016-05-30 12:13 ` [PATCH 6/7] ASoC: Intel: Skylake: Find uuids for Skylake Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Find uuids for Skylake" to the asoc tree Mark Brown
2016-05-30 12:13 ` [PATCH 7/7] ASoC: Intel: Skylake: Find uuids for Broxton Vinod Koul
2016-05-30 17:39   ` Applied "ASoC: Intel: Skylake: Find uuids for Broxton" to the asoc tree Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1b7R9r-0000oG-9g@debutante \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=patches.audio@intel.com \
    --cc=ramesh.babu@intel.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.