blob: ce0503a727b233e206cf0ef38540e92024cf19e2 [file] [log] [blame]
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08001/*
Dhananjay Kumar5f15ff92014-05-19 16:45:08 +08002 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08003
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above
10 * copyright notice, this list of conditions and the following
11 * disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 * * Neither the name of The Linux Foundation nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
24 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
26 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30#ifndef OFFLOAD_EFFECT_API_H_
31#define OFFLOAD_EFFECT_API_H_
32
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070033#if __cplusplus
34extern "C" {
35#endif
36
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080037int offload_update_mixer_and_effects_ctl(int card, int device_id,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070038 struct mixer **mixer,
39 struct mixer_ctl **ctl);
40void offload_close_mixer(struct mixer **mixer);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080041
Dhananjay Kumar5f15ff92014-05-19 16:45:08 +080042
43#define OFFLOAD_SEND_PBE_ENABLE_FLAG (1 << 0)
44#define OFFLOAD_SEND_PBE_CONFIG (OFFLOAD_SEND_PBE_ENABLE_FLAG << 1)
45void offload_pbe_set_device(struct pbe_params *pbe,
46 uint32_t device);
47void offload_pbe_set_enable_flag(struct pbe_params *pbe,
48 bool enable);
49int offload_pbe_get_enable_flag(struct pbe_params *pbe);
50
51int offload_pbe_send_params(struct mixer_ctl *ctl,
52 struct pbe_params *pbe,
53 unsigned param_send_flags);
54int hw_acc_pbe_send_params(int fd,
55 struct pbe_params *pbe,
56 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080057#define OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG (1 << 0)
58#define OFFLOAD_SEND_BASSBOOST_STRENGTH \
59 (OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG << 1)
60#define OFFLOAD_SEND_BASSBOOST_MODE \
61 (OFFLOAD_SEND_BASSBOOST_STRENGTH << 1)
62void offload_bassboost_set_device(struct bass_boost_params *bassboost,
63 uint32_t device);
64void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost,
65 bool enable);
66int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost);
67void offload_bassboost_set_strength(struct bass_boost_params *bassboost,
68 int strength);
69void offload_bassboost_set_mode(struct bass_boost_params *bassboost,
70 int mode);
71int offload_bassboost_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070072 struct bass_boost_params *bassboost,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080073 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070074int hw_acc_bassboost_send_params(int fd,
75 struct bass_boost_params *bassboost,
76 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080077
78#define OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG (1 << 0)
79#define OFFLOAD_SEND_VIRTUALIZER_STRENGTH \
80 (OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG << 1)
81#define OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE \
82 (OFFLOAD_SEND_VIRTUALIZER_STRENGTH << 1)
83#define OFFLOAD_SEND_VIRTUALIZER_GAIN_ADJUST \
84 (OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE << 1)
85void offload_virtualizer_set_device(struct virtualizer_params *virtualizer,
86 uint32_t device);
87void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer,
88 bool enable);
89int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer);
90void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer,
91 int strength);
92void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer,
93 int out_type);
94void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer,
95 int gain_adjust);
96int offload_virtualizer_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070097 struct virtualizer_params *virtualizer,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080098 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070099int hw_acc_virtualizer_send_params(int fd,
100 struct virtualizer_params *virtualizer,
101 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800102
103#define OFFLOAD_SEND_EQ_ENABLE_FLAG (1 << 0)
104#define OFFLOAD_SEND_EQ_PRESET \
105 (OFFLOAD_SEND_EQ_ENABLE_FLAG << 1)
106#define OFFLOAD_SEND_EQ_BANDS_LEVEL \
107 (OFFLOAD_SEND_EQ_PRESET << 1)
108void offload_eq_set_device(struct eq_params *eq, uint32_t device);
109void offload_eq_set_enable_flag(struct eq_params *eq, bool enable);
110int offload_eq_get_enable_flag(struct eq_params *eq);
111void offload_eq_set_preset(struct eq_params *eq, int preset);
112void offload_eq_set_bands_level(struct eq_params *eq, int num_bands,
113 const uint16_t *band_freq_list,
114 int *band_gain_list);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700115int offload_eq_send_params(struct mixer_ctl *ctl, struct eq_params *eq,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800116 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700117int hw_acc_eq_send_params(int fd, struct eq_params *eq,
118 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800119
120#define OFFLOAD_SEND_REVERB_ENABLE_FLAG (1 << 0)
121#define OFFLOAD_SEND_REVERB_MODE \
122 (OFFLOAD_SEND_REVERB_ENABLE_FLAG << 1)
123#define OFFLOAD_SEND_REVERB_PRESET \
124 (OFFLOAD_SEND_REVERB_MODE << 1)
125#define OFFLOAD_SEND_REVERB_WET_MIX \
126 (OFFLOAD_SEND_REVERB_PRESET << 1)
127#define OFFLOAD_SEND_REVERB_GAIN_ADJUST \
128 (OFFLOAD_SEND_REVERB_WET_MIX << 1)
129#define OFFLOAD_SEND_REVERB_ROOM_LEVEL \
130 (OFFLOAD_SEND_REVERB_GAIN_ADJUST << 1)
131#define OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL \
132 (OFFLOAD_SEND_REVERB_ROOM_LEVEL << 1)
133#define OFFLOAD_SEND_REVERB_DECAY_TIME \
134 (OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL << 1)
135#define OFFLOAD_SEND_REVERB_DECAY_HF_RATIO \
136 (OFFLOAD_SEND_REVERB_DECAY_TIME << 1)
137#define OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL \
138 (OFFLOAD_SEND_REVERB_DECAY_HF_RATIO << 1)
139#define OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY \
140 (OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL << 1)
141#define OFFLOAD_SEND_REVERB_LEVEL \
142 (OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY << 1)
143#define OFFLOAD_SEND_REVERB_DELAY \
144 (OFFLOAD_SEND_REVERB_LEVEL << 1)
145#define OFFLOAD_SEND_REVERB_DIFFUSION \
146 (OFFLOAD_SEND_REVERB_DELAY << 1)
147#define OFFLOAD_SEND_REVERB_DENSITY \
148 (OFFLOAD_SEND_REVERB_DIFFUSION << 1)
149void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device);
150void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable);
151int offload_reverb_get_enable_flag(struct reverb_params *reverb);
152void offload_reverb_set_mode(struct reverb_params *reverb, int mode);
153void offload_reverb_set_preset(struct reverb_params *reverb, int preset);
154void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix);
155void offload_reverb_set_gain_adjust(struct reverb_params *reverb,
156 int gain_adjust);
157void offload_reverb_set_room_level(struct reverb_params *reverb,
158 int room_level);
159void offload_reverb_set_room_hf_level(struct reverb_params *reverb,
160 int room_hf_level);
161void offload_reverb_set_decay_time(struct reverb_params *reverb,
162 int decay_time);
163void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb,
164 int decay_hf_ratio);
165void offload_reverb_set_reflections_level(struct reverb_params *reverb,
166 int reflections_level);
167void offload_reverb_set_reflections_delay(struct reverb_params *reverb,
168 int reflections_delay);
169void offload_reverb_set_reverb_level(struct reverb_params *reverb,
170 int reverb_level);
171void offload_reverb_set_delay(struct reverb_params *reverb, int delay);
172void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion);
173void offload_reverb_set_density(struct reverb_params *reverb, int density);
174int offload_reverb_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700175 struct reverb_params *reverb,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800176 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700177int hw_acc_reverb_send_params(int fd,
178 struct reverb_params *reverb,
179 unsigned param_send_flags);
180
181#define OFFLOAD_SEND_SOFT_VOLUME_ENABLE_FLAG (1 << 0)
182#define OFFLOAD_SEND_SOFT_VOLUME_GAIN_2CH \
183 (OFFLOAD_SEND_SOFT_VOLUME_ENABLE_FLAG << 1)
184#define OFFLOAD_SEND_SOFT_VOLUME_GAIN_MASTER \
185 (OFFLOAD_SEND_SOFT_VOLUME_GAIN_2CH << 1)
186void offload_soft_volume_set_enable(struct soft_volume_params *vol,
187 bool enable);
188void offload_soft_volume_set_gain_master(struct soft_volume_params *vol,
189 int gain);
190void offload_soft_volume_set_gain_2ch(struct soft_volume_params *vol,
191 int l_gain, int r_gain);
192int offload_soft_volume_send_params(struct mixer_ctl *ctl,
193 struct soft_volume_params vol,
194 unsigned param_send_flags);
195
196#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_ENABLE_FLAG (1 << 0)
197#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_2CH \
198 (OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_ENABLE_FLAG << 1)
199#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_MASTER \
200 (OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_2CH << 1)
201void offload_transition_soft_volume_set_enable(struct soft_volume_params *vol,
202 bool enable);
203void offload_transition_soft_volume_set_gain_master(struct soft_volume_params *vol,
204 int gain);
205void offload_transition_soft_volume_set_gain_2ch(struct soft_volume_params *vol,
206 int l_gain, int r_gain);
207int offload_transition_soft_volume_send_params(struct mixer_ctl *ctl,
208 struct soft_volume_params vol,
209 unsigned param_send_flags);
Alexy Josephd464f3b2014-11-18 16:14:41 -0800210
211#define OFFLOAD_SEND_HPX_STATE_ON (1 << 0)
212#define OFFLOAD_SEND_HPX_STATE_OFF (OFFLOAD_SEND_HPX_STATE_ON << 1)
213int offload_hpx_send_params(struct mixer_ctl *ctl, unsigned param_send_flags);
214int hw_acc_hpx_send_params(int fd, unsigned param_send_flags);
215
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700216#if __cplusplus
217} //extern "C"
218#endif
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800219
220#endif /*OFFLOAD_EFFECT_API_H_*/