blob: 0c3f50acb8b146d80773151c2493ad6be0e09802 [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001/*
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/* Non-ALSA coefficient types start at 0x1000 */
30#define WMFW_CTL_TYPE_ACKED 0x1000 /* acked control */
31#define WMFW_CTL_TYPE_HOSTEVENT 0x1001 /* event control */
32#define WMFW_CTL_TYPE_HOST_BUFFER 0x1002 /* host buffer pointer */
33
34struct wmfw_header {
35 char magic[4];
36 __le32 len;
37 __le16 rev;
38 u8 core;
39 u8 ver;
40} __packed;
41
42struct wmfw_footer {
43 __le64 timestamp;
44 __le32 checksum;
45} __packed;
46
47struct wmfw_adsp1_sizes {
48 __le32 dm;
49 __le32 pm;
50 __le32 zm;
51} __packed;
52
53struct wmfw_adsp2_sizes {
54 __le32 xm;
55 __le32 ym;
56 __le32 pm;
57 __le32 zm;
58} __packed;
59
60struct wmfw_region {
61 union {
62 __be32 type;
63 __le32 offset;
64 };
65 __le32 len;
66 u8 data[];
67} __packed;
68
69struct wmfw_id_hdr {
70 __be32 core_id;
71 __be32 core_rev;
72 __be32 id;
73 __be32 ver;
74} __packed;
75
76struct wmfw_adsp1_id_hdr {
77 struct wmfw_id_hdr fw;
78 __be32 zm;
79 __be32 dm;
80 __be32 n_algs;
81} __packed;
82
83struct wmfw_adsp2_id_hdr {
84 struct wmfw_id_hdr fw;
85 __be32 zm;
86 __be32 xm;
87 __be32 ym;
88 __be32 n_algs;
89} __packed;
90
91struct wmfw_alg_hdr {
92 __be32 id;
93 __be32 ver;
94} __packed;
95
96struct wmfw_adsp1_alg_hdr {
97 struct wmfw_alg_hdr alg;
98 __be32 zm;
99 __be32 dm;
100} __packed;
101
102struct wmfw_adsp2_alg_hdr {
103 struct wmfw_alg_hdr alg;
104 __be32 zm;
105 __be32 xm;
106 __be32 ym;
107} __packed;
108
109struct wmfw_adsp_alg_data {
110 __le32 id;
111 u8 name[WMFW_MAX_ALG_NAME];
112 u8 descr[WMFW_MAX_ALG_DESCR_NAME];
113 __le32 ncoeff;
114 u8 data[];
115} __packed;
116
117struct wmfw_adsp_coeff_data {
118 struct {
119 __le16 offset;
120 __le16 type;
121 __le32 size;
122 } hdr;
123 u8 name[WMFW_MAX_COEFF_NAME];
124 u8 descr[WMFW_MAX_COEFF_DESCR_NAME];
125 __le16 ctl_type;
126 __le16 flags;
127 __le32 len;
128 u8 data[];
129} __packed;
130
131struct wmfw_coeff_hdr {
132 u8 magic[4];
133 __le32 len;
134 union {
135 __be32 rev;
136 __le32 ver;
137 };
138 union {
139 __be32 core;
140 __le32 core_ver;
141 };
142 u8 data[];
143} __packed;
144
145struct wmfw_coeff_item {
146 __le16 offset;
147 __le16 type;
148 __le32 id;
149 __le32 ver;
150 __le32 sr;
151 __le32 len;
152 u8 data[];
153} __packed;
154
155#define WMFW_ADSP1 1
156#define WMFW_ADSP2 2
157
158#define WMFW_ABSOLUTE 0xf0
159#define WMFW_ALGORITHM_DATA 0xf2
160#define WMFW_NAME_TEXT 0xfe
161#define WMFW_INFO_TEXT 0xff
162
163#define WMFW_ADSP1_PM 2
164#define WMFW_ADSP1_DM 3
165#define WMFW_ADSP1_ZM 4
166
167#define WMFW_ADSP2_PM 2
168#define WMFW_ADSP2_ZM 4
169#define WMFW_ADSP2_XM 5
170#define WMFW_ADSP2_YM 6
171
172#endif