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