Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 1 | /* |
| 2 | * wmfw.h - Wolfson firmware format information |
| 3 | * |
| 4 | * Copyright 2012 Wolfson Microelectronics plc |
| 5 | * |
| 6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | |
| 13 | #ifndef __WMFW_H |
| 14 | #define __WMFW_H |
| 15 | |
| 16 | #include <linux/types.h> |
| 17 | |
Charles Keepax | 2323736 | 2015-04-13 13:28:02 +0100 | [diff] [blame] | 18 | #define WMFW_MAX_ALG_NAME 256 |
| 19 | #define WMFW_MAX_ALG_DESCR_NAME 256 |
| 20 | |
| 21 | #define WMFW_MAX_COEFF_NAME 256 |
| 22 | #define WMFW_MAX_COEFF_DESCR_NAME 256 |
| 23 | |
Charles Keepax | 26c22a1 | 2015-04-20 13:52:45 +0100 | [diff] [blame] | 24 | #define WMFW_CTL_FLAG_SYS 0x8000 |
| 25 | #define WMFW_CTL_FLAG_VOLATILE 0x0004 |
| 26 | #define WMFW_CTL_FLAG_WRITEABLE 0x0002 |
| 27 | #define WMFW_CTL_FLAG_READABLE 0x0001 |
| 28 | |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 29 | struct wmfw_header { |
| 30 | char magic[4]; |
| 31 | __le32 len; |
| 32 | __le16 rev; |
| 33 | u8 core; |
| 34 | u8 ver; |
| 35 | } __packed; |
| 36 | |
| 37 | struct wmfw_footer { |
| 38 | __le64 timestamp; |
| 39 | __le32 checksum; |
| 40 | } __packed; |
| 41 | |
| 42 | struct wmfw_adsp1_sizes { |
| 43 | __le32 dm; |
| 44 | __le32 pm; |
| 45 | __le32 zm; |
| 46 | } __packed; |
| 47 | |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 48 | struct wmfw_adsp2_sizes { |
| 49 | __le32 xm; |
| 50 | __le32 ym; |
| 51 | __le32 pm; |
| 52 | __le32 zm; |
| 53 | } __packed; |
| 54 | |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 55 | struct wmfw_region { |
| 56 | union { |
| 57 | __be32 type; |
| 58 | __le32 offset; |
| 59 | }; |
| 60 | __le32 len; |
| 61 | u8 data[]; |
| 62 | } __packed; |
| 63 | |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 64 | struct wmfw_id_hdr { |
| 65 | __be32 core_id; |
| 66 | __be32 core_rev; |
| 67 | __be32 id; |
| 68 | __be32 ver; |
| 69 | } __packed; |
| 70 | |
| 71 | struct wmfw_adsp1_id_hdr { |
| 72 | struct wmfw_id_hdr fw; |
| 73 | __be32 zm; |
| 74 | __be32 dm; |
Charles Keepax | 3809f00 | 2015-04-13 13:27:54 +0100 | [diff] [blame] | 75 | __be32 n_algs; |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 76 | } __packed; |
| 77 | |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 78 | struct wmfw_adsp2_id_hdr { |
| 79 | struct wmfw_id_hdr fw; |
| 80 | __be32 zm; |
| 81 | __be32 xm; |
| 82 | __be32 ym; |
Charles Keepax | 3809f00 | 2015-04-13 13:27:54 +0100 | [diff] [blame] | 83 | __be32 n_algs; |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 84 | } __packed; |
| 85 | |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 86 | struct wmfw_alg_hdr { |
| 87 | __be32 id; |
| 88 | __be32 ver; |
| 89 | } __packed; |
| 90 | |
| 91 | struct wmfw_adsp1_alg_hdr { |
| 92 | struct wmfw_alg_hdr alg; |
| 93 | __be32 zm; |
| 94 | __be32 dm; |
| 95 | } __packed; |
| 96 | |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 97 | struct wmfw_adsp2_alg_hdr { |
| 98 | struct wmfw_alg_hdr alg; |
| 99 | __be32 zm; |
| 100 | __be32 xm; |
| 101 | __be32 ym; |
| 102 | } __packed; |
| 103 | |
Charles Keepax | 2323736 | 2015-04-13 13:28:02 +0100 | [diff] [blame] | 104 | struct wmfw_adsp_alg_data { |
| 105 | __le32 id; |
| 106 | u8 name[WMFW_MAX_ALG_NAME]; |
| 107 | u8 descr[WMFW_MAX_ALG_DESCR_NAME]; |
| 108 | __le32 ncoeff; |
| 109 | u8 data[]; |
| 110 | } __packed; |
| 111 | |
| 112 | struct wmfw_adsp_coeff_data { |
| 113 | struct { |
| 114 | __le16 offset; |
| 115 | __le16 type; |
| 116 | __le32 size; |
| 117 | } hdr; |
| 118 | u8 name[WMFW_MAX_COEFF_NAME]; |
| 119 | u8 descr[WMFW_MAX_COEFF_DESCR_NAME]; |
| 120 | __le16 ctl_type; |
| 121 | __le16 flags; |
| 122 | __le32 len; |
| 123 | u8 data[]; |
| 124 | } __packed; |
| 125 | |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 126 | struct wmfw_coeff_hdr { |
| 127 | u8 magic[4]; |
| 128 | __le32 len; |
Mark Brown | c712326 | 2013-01-16 16:59:04 +0900 | [diff] [blame] | 129 | union { |
| 130 | __be32 rev; |
| 131 | __le32 ver; |
| 132 | }; |
| 133 | union { |
| 134 | __be32 core; |
| 135 | __le32 core_ver; |
| 136 | }; |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 137 | u8 data[]; |
| 138 | } __packed; |
| 139 | |
| 140 | struct wmfw_coeff_item { |
Mark Brown | c712326 | 2013-01-16 16:59:04 +0900 | [diff] [blame] | 141 | __le16 offset; |
| 142 | __le16 type; |
Mark Brown | 6e87bad | 2012-10-05 19:43:18 +0100 | [diff] [blame] | 143 | __le32 id; |
| 144 | __le32 ver; |
| 145 | __le32 sr; |
| 146 | __le32 len; |
| 147 | u8 data[]; |
| 148 | } __packed; |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 149 | |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 150 | #define WMFW_ADSP1 1 |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 151 | #define WMFW_ADSP2 2 |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 152 | |
Charles Keepax | 2323736 | 2015-04-13 13:28:02 +0100 | [diff] [blame] | 153 | #define WMFW_ABSOLUTE 0xf0 |
| 154 | #define WMFW_ALGORITHM_DATA 0xf2 |
| 155 | #define WMFW_NAME_TEXT 0xfe |
| 156 | #define WMFW_INFO_TEXT 0xff |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 157 | |
| 158 | #define WMFW_ADSP1_PM 2 |
| 159 | #define WMFW_ADSP1_DM 3 |
| 160 | #define WMFW_ADSP1_ZM 4 |
| 161 | |
Mark Brown | 2159ad9 | 2012-10-11 11:54:02 +0900 | [diff] [blame] | 162 | #define WMFW_ADSP2_PM 2 |
| 163 | #define WMFW_ADSP2_ZM 4 |
| 164 | #define WMFW_ADSP2_XM 5 |
| 165 | #define WMFW_ADSP2_YM 6 |
| 166 | |
Mark Brown | e10f871 | 2012-10-04 16:31:52 +0100 | [diff] [blame] | 167 | #endif |