blob: 7613d60d62ea32d6d639a065b75eb2656c70dae7 [file] [log] [blame]
Mark Browne10f8712012-10-04 16:31:52 +01001/*
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 Keepax23237362015-04-13 13:28:02 +010018#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 Keepax26c22a12015-04-20 13:52:45 +010024#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 Browne10f8712012-10-04 16:31:52 +010029struct wmfw_header {
30 char magic[4];
31 __le32 len;
32 __le16 rev;
33 u8 core;
34 u8 ver;
35} __packed;
36
37struct wmfw_footer {
38 __le64 timestamp;
39 __le32 checksum;
40} __packed;
41
42struct wmfw_adsp1_sizes {
43 __le32 dm;
44 __le32 pm;
45 __le32 zm;
46} __packed;
47
Mark Brown2159ad92012-10-11 11:54:02 +090048struct wmfw_adsp2_sizes {
49 __le32 xm;
50 __le32 ym;
51 __le32 pm;
52 __le32 zm;
53} __packed;
54
Mark Browne10f8712012-10-04 16:31:52 +010055struct wmfw_region {
56 union {
57 __be32 type;
58 __le32 offset;
59 };
60 __le32 len;
61 u8 data[];
62} __packed;
63
Mark Brown6e87bad2012-10-05 19:43:18 +010064struct wmfw_id_hdr {
65 __be32 core_id;
66 __be32 core_rev;
67 __be32 id;
68 __be32 ver;
69} __packed;
70
71struct wmfw_adsp1_id_hdr {
72 struct wmfw_id_hdr fw;
73 __be32 zm;
74 __be32 dm;
Charles Keepax3809f002015-04-13 13:27:54 +010075 __be32 n_algs;
Mark Brown6e87bad2012-10-05 19:43:18 +010076} __packed;
77
Mark Brown2159ad92012-10-11 11:54:02 +090078struct wmfw_adsp2_id_hdr {
79 struct wmfw_id_hdr fw;
80 __be32 zm;
81 __be32 xm;
82 __be32 ym;
Charles Keepax3809f002015-04-13 13:27:54 +010083 __be32 n_algs;
Mark Brown2159ad92012-10-11 11:54:02 +090084} __packed;
85
Mark Brown6e87bad2012-10-05 19:43:18 +010086struct wmfw_alg_hdr {
87 __be32 id;
88 __be32 ver;
89} __packed;
90
91struct wmfw_adsp1_alg_hdr {
92 struct wmfw_alg_hdr alg;
93 __be32 zm;
94 __be32 dm;
95} __packed;
96
Mark Brown2159ad92012-10-11 11:54:02 +090097struct wmfw_adsp2_alg_hdr {
98 struct wmfw_alg_hdr alg;
99 __be32 zm;
100 __be32 xm;
101 __be32 ym;
102} __packed;
103
Charles Keepax23237362015-04-13 13:28:02 +0100104struct 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
112struct 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 Brown6e87bad2012-10-05 19:43:18 +0100126struct wmfw_coeff_hdr {
127 u8 magic[4];
128 __le32 len;
Mark Brownc7123262013-01-16 16:59:04 +0900129 union {
130 __be32 rev;
131 __le32 ver;
132 };
133 union {
134 __be32 core;
135 __le32 core_ver;
136 };
Mark Brown6e87bad2012-10-05 19:43:18 +0100137 u8 data[];
138} __packed;
139
140struct wmfw_coeff_item {
Mark Brownc7123262013-01-16 16:59:04 +0900141 __le16 offset;
142 __le16 type;
Mark Brown6e87bad2012-10-05 19:43:18 +0100143 __le32 id;
144 __le32 ver;
145 __le32 sr;
146 __le32 len;
147 u8 data[];
148} __packed;
Mark Brown2159ad92012-10-11 11:54:02 +0900149
Mark Browne10f8712012-10-04 16:31:52 +0100150#define WMFW_ADSP1 1
Mark Brown2159ad92012-10-11 11:54:02 +0900151#define WMFW_ADSP2 2
Mark Browne10f8712012-10-04 16:31:52 +0100152
Charles Keepax23237362015-04-13 13:28:02 +0100153#define WMFW_ABSOLUTE 0xf0
154#define WMFW_ALGORITHM_DATA 0xf2
155#define WMFW_NAME_TEXT 0xfe
156#define WMFW_INFO_TEXT 0xff
Mark Browne10f8712012-10-04 16:31:52 +0100157
158#define WMFW_ADSP1_PM 2
159#define WMFW_ADSP1_DM 3
160#define WMFW_ADSP1_ZM 4
161
Mark Brown2159ad92012-10-11 11:54:02 +0900162#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 Browne10f8712012-10-04 16:31:52 +0100167#endif