From: Scott Ling <sl@opensource.wolfsonmicro.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
scott.ling@wolfsonmicro.com
Subject: [PATCH] ASoC: wm0010: Add checking for .dfw info record version.
Date: Fri, 23 Nov 2012 12:37:35 +0000 [thread overview]
Message-ID: <1353674255-23368-1-git-send-email-sl@opensource.wolfsonmicro.com> (raw)
The info record at the start of the dsp firmware file has been
expanded to incorporate additional version information. We need
to check the version to make sure we understand the layout of
the information in the record. The srec2image tool is currently
used to create this record during creation of the .dfw file.
Signed-off-by: Scott Ling <sl@opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm0010.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index d795860..e7e6c2f 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -32,6 +32,9 @@
#define DEVICE_ID_WM0010 10
#define S2_LOADER_ID_OFFSET 8
+/* We only support v1 of the .dfw INFO record */
+#define INFO_VERSION 1
+
enum dfw_cmd {
DFW_CMD_FUSE = 0x01,
DFW_CMD_CODE_HDR,
@@ -47,6 +50,13 @@ struct dfw_binrec {
uint8_t data[0];
} __packed;
+struct dfw_inforec {
+ u8 info_version;
+ u8 tool_major_version;
+ u8 tool_minor_version;
+ u8 dsp_target;
+};
+
struct dfw_pllrec {
u8 command;
u32 length:24;
@@ -343,6 +353,7 @@ static int wm0010_firmware_load(char *name, struct snd_soc_codec *codec)
struct completion done;
const struct firmware *fw;
const struct dfw_binrec *rec;
+ const struct dfw_inforec *inforec;
u64 *img;
u8 *out, dsp;
u32 len, offset;
@@ -357,8 +368,9 @@ static int wm0010_firmware_load(char *name, struct snd_soc_codec *codec)
}
rec = (const struct dfw_binrec *)fw->data;
+ inforec = (const struct dfw_inforec *)rec->data;
offset = 0;
- dsp = rec->data[0];
+ dsp = inforec->dsp_target;
wm0010->boot_failed = false;
BUG_ON(!list_empty(&xfer_list));
init_completion(&done);
@@ -370,6 +382,17 @@ static int wm0010_firmware_load(char *name, struct snd_soc_codec *codec)
goto abort;
}
+ if (inforec->info_version != INFO_VERSION) {
+ dev_err(codec->dev,
+ "Unsupported version (%02d) of INFO record\r\n",
+ inforec->info_version);
+ ret = -EINVAL;
+ goto abort;
+ }
+
+ dev_dbg(codec->dev, "Version v%02d INFO record found\r\n",
+ inforec->info_version);
+
/* Check it's a DSP file */
if (dsp != DEVICE_ID_WM0010) {
dev_err(codec->dev, "Not a WM0010 firmware file.\r\n");
--
1.7.9.5
next reply other threads:[~2012-11-23 12:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-23 12:37 Scott Ling [this message]
2012-11-23 12:44 ` [PATCH] ASoC: wm0010: Add checking for .dfw info record version 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=1353674255-23368-1-git-send-email-sl@opensource.wolfsonmicro.com \
--to=sl@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=patches@opensource.wolfsonmicro.com \
--cc=scott.ling@wolfsonmicro.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.