ASoC: wm_adsp: Implement support for coefficeint file format 1
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 16 Jan 2013 07:59:04 +0000 (16:59 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 18 Jan 2013 06:02:17 +0000 (15:02 +0900)
Implement support for a new revision of the coefficeint file format for
ADSP cores.

Since coefficient file format 0 has not been widely deployed and is very
unlikely to ever be used with this driver code support for it has been
removed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/codecs/wm_adsp.c
sound/soc/codecs/wmfw.h

index 58cac07..5841285 100644 (file)
@@ -686,6 +686,16 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
                return -EINVAL;
        }
 
+       switch (be32_to_cpu(hdr->rev) & 0xff) {
+       case 1:
+               break;
+       default:
+               adsp_err(dsp, "%s: Unsupported coefficient file format %d\n",
+                        file, be32_to_cpu(hdr->rev) & 0xff);
+               ret = -EINVAL;
+               goto out_fw;
+       }
+
        adsp_dbg(dsp, "%s: v%d.%d.%d\n", file,
                (le32_to_cpu(hdr->ver) >> 16) & 0xff,
                (le32_to_cpu(hdr->ver) >>  8) & 0xff,
@@ -698,8 +708,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
               pos - firmware->size > sizeof(*blk)) {
                blk = (void*)(&firmware->data[pos]);
 
-               type = be32_to_cpu(blk->type) & 0xff;
-               offset = le32_to_cpu(blk->offset) & 0xffffff;
+               type = le16_to_cpu(blk->type);
+               offset = le16_to_cpu(blk->offset);
 
                adsp_dbg(dsp, "%s.%d: %x v%d.%d.%d\n",
                         file, blocks, le32_to_cpu(blk->id),
@@ -712,10 +722,10 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
                reg = 0;
                region_name = "Unknown";
                switch (type) {
-               case WMFW_NAME_TEXT:
-               case WMFW_INFO_TEXT:
+               case (WMFW_NAME_TEXT << 8):
+               case (WMFW_INFO_TEXT << 8):
                        break;
-               case WMFW_ABSOLUTE:
+               case (WMFW_ABSOLUTE << 8):
                        region_name = "register";
                        reg = offset;
                        break;
index 5632ded..ef16336 100644 (file)
@@ -93,15 +93,20 @@ struct wmfw_adsp2_alg_hdr {
 struct wmfw_coeff_hdr {
        u8 magic[4];
        __le32 len;
-       __le32 ver;
+       union {
+               __be32 rev;
+               __le32 ver;
+       };
+       union {
+               __be32 core;
+               __le32 core_ver;
+       };
        u8 data[];
 } __packed;
 
 struct wmfw_coeff_item {
-       union {
-               __be32 type;
-               __le32 offset;
-       };
+       __le16 offset;
+       __le16 type;
        __le32 id;
        __le32 ver;
        __le32 sr;