hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/* SPDX-License-Identifier: GPL-2.0+ */
 
#ifndef __AW_ACF_BIN_H__
#define __AW_ACF_BIN_H__
 
#include "aw_device.h"
 
#define AW_PROJECT_NAME_MAX        (24)
#define AW_CUSTOMER_NAME_MAX        (16)
#define AW_CFG_VERSION_MAX        (4)
#define AW_TBL_VERSION_MAX        (4)
#define AW_DDE_DEVICE_TYPE        (0)
#define AW_DDE_SKT_TYPE            (1)
#define AW_DDE_DEFAULT_TYPE        (2)
 
#define AW_REG_ADDR_BYTE        (1)
#define AW_REG_DATA_BYTE        (1)
 
#define AW_ACF_FILE_ID            (0xa15f908)
#define AW_PROFILE_STR_MAX         (32)
#define AW_POWER_OFF_NAME_SUPPORT_COUNT    (5)
 
enum aw_cfg_hdr_version {
   AW_ACF_HDR_VER_0_0_0_1 = 0x00000001,
   AW_ACF_HDR_VER_1_0_0_0 = 0x01000000,
};
 
enum aw_acf_dde_type_id {
   AW_DEV_NONE_TYPE_ID = 0xFFFFFFFF,
   AW_DDE_DEV_TYPE_ID = 0x00000000,
   AW_DDE_SKT_TYPE_ID = 0x00000001,
   AW_DDE_DEV_DEFAULT_TYPE_ID = 0x00000002,
   AW_DDE_TYPE_MAX,
};
 
enum aw_raw_data_type_id {
   AW_BIN_TYPE_REG = 0x00000000,
   AW_BIN_TYPE_DSP,
   AW_BIN_TYPE_DSP_CFG,
   AW_BIN_TYPE_DSP_FW,
   AW_BIN_TYPE_HDR_REG,
   AW_BIN_TYPE_HDR_DSP_CFG,
   AW_BIN_TYPE_HDR_DSP_FW,
   AW_BIN_TYPE_MUTLBIN,
   AW_SKT_UI_PROJECT,
   AW_DSP_CFG,
   AW_MONITOR,
   AW_BIN_TYPE_MAX,
};
 
enum {
   AW_DEV_TYPE_OK = 0,
   AW_DEV_TYPE_NONE = 1,
};
 
enum aw_profile_status {
   AW_PROFILE_WAIT = 0,
   AW_PROFILE_OK,
};
 
enum aw_acf_load_status {
   AW_ACF_WAIT = 0,
   AW_ACF_UPDATE,
};
 
enum aw_bin_dev_profile_id {
   AW_PROFILE_MUSIC = 0x0000,
   AW_PROFILE_VOICE,
   AW_PROFILE_VOIP,
   AW_PROFILE_RINGTONE,
   AW_PROFILE_RINGTONE_HS,
   AW_PROFILE_LOWPOWER,
   AW_PROFILE_BYPASS,
   AW_PROFILE_MMI,
   AW_PROFILE_FM,
   AW_PROFILE_NOTIFICATION,
   AW_PROFILE_RECEIVER,
   AW_PROFILE_OFF,
   AW_PROFILE_MAX,
};
 
struct aw_acf_hdr {
   int32_t a_id;                /* acf file ID 0xa15f908 */
   char project[AW_PROJECT_NAME_MAX];    /* project name */
   char custom[AW_CUSTOMER_NAME_MAX];    /* custom name :huawei xiaomi vivo oppo */
   uint8_t version[AW_CFG_VERSION_MAX];    /* author update version */
   int32_t author_id;            /* author id */
   int32_t ddt_size;            /* sub section table entry size */
   int32_t dde_num;            /* sub section table entry num */
   int32_t ddt_offset;            /* sub section table offset in file */
   int32_t hdr_version;            /* sub section table version */
   int32_t reserve[3];            /* Reserved Bits */
};
 
struct aw_acf_dde {
   int32_t type;                /* dde type id */
   char dev_name[AW_CUSTOMER_NAME_MAX];    /* customer dev name */
   int16_t dev_index;            /* dev id */
   int16_t dev_bus;            /* dev bus id */
   int16_t dev_addr;            /* dev addr id */
   int16_t dev_profile;            /* dev profile id */
   int32_t data_type;            /* data type id */
   int32_t data_size;            /* dde data size in block */
   int32_t data_offset;            /* dde data offset in block */
   int32_t data_crc;            /* dde data crc checkout */
   int32_t reserve[5];            /* Reserved Bits */
};
 
struct aw_acf_dde_v_1_0_0_0 {
   uint32_t type;                /* DDE type id */
   char dev_name[AW_CUSTOMER_NAME_MAX];    /* customer dev name */
   uint16_t dev_index;            /* dev id */
   uint16_t dev_bus;            /* dev bus id */
   uint16_t dev_addr;            /* dev addr id */
   uint16_t dev_profile;            /* dev profile id*/
   uint32_t data_type;            /* data type id */
   uint32_t data_size;            /* dde data size in block */
   uint32_t data_offset;            /* dde data offset in block */
   uint32_t data_crc;            /* dde data crc checkout */
   char dev_profile_str[AW_PROFILE_STR_MAX];    /* dde custom profile name */
   uint32_t chip_id;            /* dde custom product chip id */
   uint32_t reserve[4];
};
 
struct aw_data_with_header {
   uint32_t check_sum;
   uint32_t header_ver;
   uint32_t bin_data_type;
   uint32_t bin_data_ver;
   uint32_t bin_data_size;
   uint32_t ui_ver;
   char product[8];
   uint32_t addr_byte_len;
   uint32_t data_byte_len;
   uint32_t device_addr;
   uint32_t reserve[4];
};
 
struct aw_data_container {
   uint32_t len;
   uint8_t *data;
};
 
struct aw_prof_desc {
   uint32_t prof_st;
   char *prof_name;
   char dev_name[AW_CUSTOMER_NAME_MAX];
   struct aw_data_container data_container;
};
 
struct aw_all_prof_info {
   struct aw_prof_desc prof_desc[AW_PROFILE_MAX];
};
 
struct aw_prof_info {
   int count;
   int status;
   int prof_type;
   char (*prof_name_list)[AW_PROFILE_STR_MAX];
   struct aw_prof_desc *prof_desc;
};
 
struct acf_bin_info {
   int load_count;
   int fw_size;
   int16_t dev_index;
   char *fw_data;
   int product_cnt;
   const char **product_tab;
   struct aw_device *aw_dev;
 
   struct aw_acf_hdr acf_hdr;
   struct aw_prof_info prof_info;
};
 
 
void aw_acf_profile_free(struct device *dev,
       struct acf_bin_info *acf_info);
int aw_acf_parse(struct device *dev, struct acf_bin_info *acf_info);
struct aw_prof_desc *aw_acf_get_prof_desc_form_name(struct device *dev,
           struct acf_bin_info *acf_info, char *profile_name);
int aw_acf_get_prof_index_form_name(struct device *dev,
           struct acf_bin_info *acf_info, char *profile_name);
char *aw_acf_get_prof_name_form_index(struct device *dev,
           struct acf_bin_info *acf_info, int index);
int aw_acf_get_profile_count(struct device *dev,
           struct acf_bin_info *acf_info);
int aw_acf_check_profile_is_off(struct device *dev,
           struct acf_bin_info *acf_info, char *profile_name);
char *aw_acf_get_prof_off_name(struct device *dev,
           struct acf_bin_info *acf_info);
void aw_acf_init(struct aw_device *aw_dev, struct acf_bin_info *acf_info, int index);
 
 
#endif