blob: 986f2ac579e8d8b672e76735b7f7b77056c2c210 [file] [log] [blame]
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +02001/* Copyright (c) 2012-2019, 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);
Dieter Lueckinga8b8e3b2018-09-28 14:29:17 +020038int q6core_get_avcs_api_version_per_service(uint32_t service_id);
Vignesh Kulothungana3f8bf62018-02-21 14:17:48 -080039
Asish Bhattacharya8e2277f2017-07-20 18:31:55 +053040#define ADSP_CMD_SET_DTS_EAGLE_DATA_ID 0x00012919
41#define DTS_EAGLE_LICENSE_ID 0x00028346
42struct adsp_dts_eagle {
43 struct apr_hdr hdr;
44 uint32_t id;
45 uint32_t overwrite;
46 uint32_t size;
47 char data[];
48};
49int core_dts_eagle_set(int size, char *data);
50int core_dts_eagle_get(int id, int size, char *data);
51
52#define ADSP_CMD_SET_DOLBY_MANUFACTURER_ID 0x00012918
53
54struct adsp_dolby_manufacturer_id {
55 struct apr_hdr hdr;
56 int manufacturer_id;
57};
58
59uint32_t core_set_dolby_manufacturer_id(int manufacturer_id);
60
61/* Dolby Surround1 Module License ID. This ID is used as an identifier
62 * for DS1 license via ADSP generic license mechanism.
63 * Please refer AVCS_CMD_SET_LICENSE for more details.
64 */
65#define DOLBY_DS1_LICENSE_ID 0x00000001
66
67#define AVCS_CMD_SET_LICENSE 0x00012919
68struct avcs_cmd_set_license {
69 struct apr_hdr hdr;
70 uint32_t id; /**< A unique ID used to refer to this license */
71 uint32_t overwrite;
72 /* 0 = do not overwrite an existing license with this id.
73 * 1 = overwrite an existing license with this id.
74 */
75 uint32_t size;
76 /**< Size in bytes of the license data following this header. */
77 /* uint8_t* data , data and padding follows this structure
78 * total packet size needs to be multiple of 4 Bytes
79 */
80
81};
82
83#define AVCS_CMD_GET_LICENSE_VALIDATION_RESULT 0x0001291A
84struct avcs_cmd_get_license_validation_result {
85 struct apr_hdr hdr;
86 uint32_t id; /**< A unique ID used to refer to this license */
87};
88
89#define AVCS_CMDRSP_GET_LICENSE_VALIDATION_RESULT 0x0001291B
90struct avcs_cmdrsp_get_license_validation_result {
91 uint32_t result;
92 /* ADSP_EOK if the license validation result was successfully retrieved.
93 * ADSP_ENOTEXIST if there is no license with the given id.
94 * ADSP_ENOTIMPL if there is no validation function for a license
95 * with this id.
96 */
97 uint32_t size;
98 /* Length in bytes of the result that follows this structure*/
99};
100
101/* Set Q6 topologies */
102/*
103 * Registers custom topologies in the aDSP for
104 * use in audio, voice, AFE and LSM.
105 */
106
107
108#define AVCS_CMD_SHARED_MEM_MAP_REGIONS 0x00012924
109#define AVCS_CMDRSP_SHARED_MEM_MAP_REGIONS 0x00012925
110#define AVCS_CMD_SHARED_MEM_UNMAP_REGIONS 0x00012926
111
112
113#define AVCS_CMD_REGISTER_TOPOLOGIES 0x00012923
114
115/* The payload for the AVCS_CMD_REGISTER_TOPOLOGIES command */
116struct avcs_cmd_register_topologies {
117 struct apr_hdr hdr;
118 uint32_t payload_addr_lsw;
119 /* Lower 32 bits of the topology buffer address. */
120
121 uint32_t payload_addr_msw;
122 /* Upper 32 bits of the topology buffer address. */
123
124 uint32_t mem_map_handle;
125 /* Unique identifier for an address.
126 * -This memory map handle is returned by the aDSP through the
127 * memory map command.
128 * -NULL mem_map_handle is interpreted as in-band parameter
129 * passing.
130 * -Client has the flexibility to choose in-band or out-of-band.
131 * -Out-of-band is recommended in this case.
132 */
133
134 uint32_t payload_size;
135 /* Size in bytes of the valid data in the topology buffer. */
136} __packed;
137
138
139#define AVCS_CMD_DEREGISTER_TOPOLOGIES 0x0001292a
140
141/* The payload for the AVCS_CMD_DEREGISTER_TOPOLOGIES command */
142struct avcs_cmd_deregister_topologies {
143 struct apr_hdr hdr;
144 uint32_t payload_addr_lsw;
145 /* Lower 32 bits of the topology buffer address. */
146
147 uint32_t payload_addr_msw;
148 /* Upper 32 bits of the topology buffer address. */
149
150 uint32_t mem_map_handle;
151 /* Unique identifier for an address.
152 * -This memory map handle is returned by the aDSP through the
153 * memory map command.
154 * -NULL mem_map_handle is interpreted as in-band parameter
155 * passing.
156 * -Client has the flexibility to choose in-band or out-of-band.
157 * -Out-of-band is recommended in this case.
158 */
159
160 uint32_t payload_size;
161 /* Size in bytes of the valid data in the topology buffer. */
162
163 uint32_t mode;
164 /* 1: Deregister selected topologies
165 * 2: Deregister all topologies
166 */
167} __packed;
168
169#define AVCS_MODE_DEREGISTER_ALL_CUSTOM_TOPOLOGIES 2
170
171
172int32_t core_set_license(uint32_t key, uint32_t module_id);
173int32_t core_get_license_status(uint32_t module_id);
174
175#endif /* __Q6CORE_H__ */