Kyle Swenson | 8d8f654 | 2021-03-15 11:02:55 -0600 | [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 | |
| 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 | |
| 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 | |
| 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 | |
| 48 | struct wmfw_adsp2_sizes { |
| 49 | __le32 xm; |
| 50 | __le32 ym; |
| 51 | __le32 pm; |
| 52 | __le32 zm; |
| 53 | } __packed; |
| 54 | |
| 55 | struct wmfw_region { |
| 56 | union { |
| 57 | __be32 type; |
| 58 | __le32 offset; |
| 59 | }; |
| 60 | __le32 len; |
| 61 | u8 data[]; |
| 62 | } __packed; |
| 63 | |
| 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; |
| 75 | __be32 n_algs; |
| 76 | } __packed; |
| 77 | |
| 78 | struct wmfw_adsp2_id_hdr { |
| 79 | struct wmfw_id_hdr fw; |
| 80 | __be32 zm; |
| 81 | __be32 xm; |
| 82 | __be32 ym; |
| 83 | __be32 n_algs; |
| 84 | } __packed; |
| 85 | |
| 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 | |
| 97 | struct wmfw_adsp2_alg_hdr { |
| 98 | struct wmfw_alg_hdr alg; |
| 99 | __be32 zm; |
| 100 | __be32 xm; |
| 101 | __be32 ym; |
| 102 | } __packed; |
| 103 | |
| 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 | |
| 126 | struct wmfw_coeff_hdr { |
| 127 | u8 magic[4]; |
| 128 | __le32 len; |
| 129 | union { |
| 130 | __be32 rev; |
| 131 | __le32 ver; |
| 132 | }; |
| 133 | union { |
| 134 | __be32 core; |
| 135 | __le32 core_ver; |
| 136 | }; |
| 137 | u8 data[]; |
| 138 | } __packed; |
| 139 | |
| 140 | struct wmfw_coeff_item { |
| 141 | __le16 offset; |
| 142 | __le16 type; |
| 143 | __le32 id; |
| 144 | __le32 ver; |
| 145 | __le32 sr; |
| 146 | __le32 len; |
| 147 | u8 data[]; |
| 148 | } __packed; |
| 149 | |
| 150 | #define WMFW_ADSP1 1 |
| 151 | #define WMFW_ADSP2 2 |
| 152 | |
| 153 | #define WMFW_ABSOLUTE 0xf0 |
| 154 | #define WMFW_ALGORITHM_DATA 0xf2 |
| 155 | #define WMFW_NAME_TEXT 0xfe |
| 156 | #define WMFW_INFO_TEXT 0xff |
| 157 | |
| 158 | #define WMFW_ADSP1_PM 2 |
| 159 | #define WMFW_ADSP1_DM 3 |
| 160 | #define WMFW_ADSP1_ZM 4 |
| 161 | |
| 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 | |
| 167 | #endif |