blob: 03a7b31af52d3ab6156f69b9105c7fb73b1cb099 [file] [log] [blame]
Vignesh Kulothungana3f8bf62018-02-21 14:17:48 -08001/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +05302 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef __Q6CORE_H__
14#define __Q6CORE_H__
Laxminath Kasam605b42f2017-08-01 22:02:15 +053015#include <ipc/apr.h>
Laxminath Kasam38070be2017-08-17 18:21:59 +053016#include <dsp/apr_audio-v2.h>
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053017
18
19
20#define AVCS_CMD_ADSP_EVENT_GET_STATE 0x0001290C
21#define AVCS_CMDRSP_ADSP_EVENT_GET_STATE 0x0001290D
22
23bool q6core_is_adsp_ready(void);
24
Laxminath Kasam38070be2017-08-17 18:21:59 +053025int q6core_get_service_version(uint32_t service_id,
26 struct avcs_fwk_ver_info *ver_info,
27 size_t size);
Siena Richard2d0102d2017-09-05 11:15:45 -070028size_t q6core_get_fwk_version_size(uint32_t service_id);
Laxminath Kasam38070be2017-08-17 18:21:59 +053029
Vignesh Kulothungana3f8bf62018-02-21 14:17:48 -080030struct audio_uevent_data {
31 struct kobject kobj;
32 struct kobj_type ktype;
33};
34
35int q6core_init_uevent_data(struct audio_uevent_data *uevent_data, char *name);
36void q6core_destroy_uevent_data(struct audio_uevent_data *uevent_data);
37int q6core_send_uevent(struct audio_uevent_data *uevent_data, char *name);
38
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053039#define ADSP_CMD_SET_DTS_EAGLE_DATA_ID 0x00012919
40#define DTS_EAGLE_LICENSE_ID 0x00028346
41struct adsp_dts_eagle {
42 struct apr_hdr hdr;
43 uint32_t id;
44 uint32_t overwrite;
45 uint32_t size;
46 char data[];
47};
48int core_dts_eagle_set(int size, char *data);
49int core_dts_eagle_get(int id, int size, char *data);
50
51#define ADSP_CMD_SET_DOLBY_MANUFACTURER_ID 0x00012918
52
53struct adsp_dolby_manufacturer_id {
54 struct apr_hdr hdr;
55 int manufacturer_id;
56};
57
58uint32_t core_set_dolby_manufacturer_id(int manufacturer_id);
59
60/* Dolby Surround1 Module License ID. This ID is used as an identifier
61 * for DS1 license via ADSP generic license mechanism.
62 * Please refer AVCS_CMD_SET_LICENSE for more details.
63 */
64#define DOLBY_DS1_LICENSE_ID 0x00000001
65
66#define AVCS_CMD_SET_LICENSE 0x00012919
67struct avcs_cmd_set_license {
68 struct apr_hdr hdr;
69 uint32_t id; /**< A unique ID used to refer to this license */
70 uint32_t overwrite;
71 /* 0 = do not overwrite an existing license with this id.
72 * 1 = overwrite an existing license with this id.
73 */
74 uint32_t size;
75 /**< Size in bytes of the license data following this header. */
76 /* uint8_t* data , data and padding follows this structure
77 * total packet size needs to be multiple of 4 Bytes
78 */
79
80};
81
82#define AVCS_CMD_GET_LICENSE_VALIDATION_RESULT 0x0001291A
83struct avcs_cmd_get_license_validation_result {
84 struct apr_hdr hdr;
85 uint32_t id; /**< A unique ID used to refer to this license */
86};
87
88#define AVCS_CMDRSP_GET_LICENSE_VALIDATION_RESULT 0x0001291B
89struct avcs_cmdrsp_get_license_validation_result {
90 uint32_t result;
91 /* ADSP_EOK if the license validation result was successfully retrieved.
92 * ADSP_ENOTEXIST if there is no license with the given id.
93 * ADSP_ENOTIMPL if there is no validation function for a license
94 * with this id.
95 */
96 uint32_t size;
97 /* Length in bytes of the result that follows this structure*/
98};
99
100/* Set Q6 topologies */
101/*
102 * Registers custom topologies in the aDSP for
103 * use in audio, voice, AFE and LSM.
104 */
105
106
107#define AVCS_CMD_SHARED_MEM_MAP_REGIONS 0x00012924
108#define AVCS_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00012925
109#define AVCS_CMD_SHARED_MEM_UNMAP_REGIONS 0x00012926
110
111
112#define AVCS_CMD_REGISTER_TOPOLOGIES 0x00012923
113
114/* The payload for the AVCS_CMD_REGISTER_TOPOLOGIES command */
115struct avcs_cmd_register_topologies {
116 struct apr_hdr hdr;
117 uint32_t payload_addr_lsw;
118 /* Lower 32 bits of the topology buffer address. */
119
120 uint32_t payload_addr_msw;
121 /* Upper 32 bits of the topology buffer address. */
122
123 uint32_t mem_map_handle;
124 /* Unique identifier for an address.
125 * -This memory map handle is returned by the aDSP through the
126 * memory map command.
127 * -NULL mem_map_handle is interpreted as in-band parameter
128 * passing.
129 * -Client has the flexibility to choose in-band or out-of-band.
130 * -Out-of-band is recommended in this case.
131 */
132
133 uint32_t payload_size;
134 /* Size in bytes of the valid data in the topology buffer. */
135} __packed;
136
137
138#define AVCS_CMD_DEREGISTER_TOPOLOGIES 0x0001292a
139
140/* The payload for the AVCS_CMD_DEREGISTER_TOPOLOGIES command */
141struct avcs_cmd_deregister_topologies {
142 struct apr_hdr hdr;
143 uint32_t payload_addr_lsw;
144 /* Lower 32 bits of the topology buffer address. */
145
146 uint32_t payload_addr_msw;
147 /* Upper 32 bits of the topology buffer address. */
148
149 uint32_t mem_map_handle;
150 /* Unique identifier for an address.
151 * -This memory map handle is returned by the aDSP through the
152 * memory map command.
153 * -NULL mem_map_handle is interpreted as in-band parameter
154 * passing.
155 * -Client has the flexibility to choose in-band or out-of-band.
156 * -Out-of-band is recommended in this case.
157 */
158
159 uint32_t payload_size;
160 /* Size in bytes of the valid data in the topology buffer. */
161
162 uint32_t mode;
163 /* 1: Deregister selected topologies
164 * 2: Deregister all topologies
165 */
166} __packed;
167
168#define AVCS_MODE_DEREGISTER_ALL_CUSTOM_TOPOLOGIES 2
169
170
171int32_t core_set_license(uint32_t key, uint32_t module_id);
172int32_t core_get_license_status(uint32_t module_id);
173
174#endif /* __Q6CORE_H__ */