blob: e05924a4c5b50fd9bd52e4635cc7342074352a7a [file] [log] [blame]
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -08001/*
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -07002 * Copyright (c) 2013-2014, 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
42#define OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG (1 << 0)
43#define OFFLOAD_SEND_BASSBOOST_STRENGTH \
44 (OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG << 1)
45#define OFFLOAD_SEND_BASSBOOST_MODE \
46 (OFFLOAD_SEND_BASSBOOST_STRENGTH << 1)
47void offload_bassboost_set_device(struct bass_boost_params *bassboost,
48 uint32_t device);
49void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost,
50 bool enable);
51int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost);
52void offload_bassboost_set_strength(struct bass_boost_params *bassboost,
53 int strength);
54void offload_bassboost_set_mode(struct bass_boost_params *bassboost,
55 int mode);
56int offload_bassboost_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070057 struct bass_boost_params *bassboost,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080058 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070059int hw_acc_bassboost_send_params(int fd,
60 struct bass_boost_params *bassboost,
61 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080062
63#define OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG (1 << 0)
64#define OFFLOAD_SEND_VIRTUALIZER_STRENGTH \
65 (OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG << 1)
66#define OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE \
67 (OFFLOAD_SEND_VIRTUALIZER_STRENGTH << 1)
68#define OFFLOAD_SEND_VIRTUALIZER_GAIN_ADJUST \
69 (OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE << 1)
70void offload_virtualizer_set_device(struct virtualizer_params *virtualizer,
71 uint32_t device);
72void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer,
73 bool enable);
74int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer);
75void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer,
76 int strength);
77void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer,
78 int out_type);
79void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer,
80 int gain_adjust);
81int offload_virtualizer_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070082 struct virtualizer_params *virtualizer,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080083 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -070084int hw_acc_virtualizer_send_params(int fd,
85 struct virtualizer_params *virtualizer,
86 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -080087
88#define OFFLOAD_SEND_EQ_ENABLE_FLAG (1 << 0)
89#define OFFLOAD_SEND_EQ_PRESET \
90 (OFFLOAD_SEND_EQ_ENABLE_FLAG << 1)
91#define OFFLOAD_SEND_EQ_BANDS_LEVEL \
92 (OFFLOAD_SEND_EQ_PRESET << 1)
93void offload_eq_set_device(struct eq_params *eq, uint32_t device);
94void offload_eq_set_enable_flag(struct eq_params *eq, bool enable);
95int offload_eq_get_enable_flag(struct eq_params *eq);
96void offload_eq_set_preset(struct eq_params *eq, int preset);
97void offload_eq_set_bands_level(struct eq_params *eq, int num_bands,
98 const uint16_t *band_freq_list,
99 int *band_gain_list);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700100int offload_eq_send_params(struct mixer_ctl *ctl, struct eq_params *eq,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800101 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700102int hw_acc_eq_send_params(int fd, struct eq_params *eq,
103 unsigned param_send_flags);
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800104
105#define OFFLOAD_SEND_REVERB_ENABLE_FLAG (1 << 0)
106#define OFFLOAD_SEND_REVERB_MODE \
107 (OFFLOAD_SEND_REVERB_ENABLE_FLAG << 1)
108#define OFFLOAD_SEND_REVERB_PRESET \
109 (OFFLOAD_SEND_REVERB_MODE << 1)
110#define OFFLOAD_SEND_REVERB_WET_MIX \
111 (OFFLOAD_SEND_REVERB_PRESET << 1)
112#define OFFLOAD_SEND_REVERB_GAIN_ADJUST \
113 (OFFLOAD_SEND_REVERB_WET_MIX << 1)
114#define OFFLOAD_SEND_REVERB_ROOM_LEVEL \
115 (OFFLOAD_SEND_REVERB_GAIN_ADJUST << 1)
116#define OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL \
117 (OFFLOAD_SEND_REVERB_ROOM_LEVEL << 1)
118#define OFFLOAD_SEND_REVERB_DECAY_TIME \
119 (OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL << 1)
120#define OFFLOAD_SEND_REVERB_DECAY_HF_RATIO \
121 (OFFLOAD_SEND_REVERB_DECAY_TIME << 1)
122#define OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL \
123 (OFFLOAD_SEND_REVERB_DECAY_HF_RATIO << 1)
124#define OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY \
125 (OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL << 1)
126#define OFFLOAD_SEND_REVERB_LEVEL \
127 (OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY << 1)
128#define OFFLOAD_SEND_REVERB_DELAY \
129 (OFFLOAD_SEND_REVERB_LEVEL << 1)
130#define OFFLOAD_SEND_REVERB_DIFFUSION \
131 (OFFLOAD_SEND_REVERB_DELAY << 1)
132#define OFFLOAD_SEND_REVERB_DENSITY \
133 (OFFLOAD_SEND_REVERB_DIFFUSION << 1)
134void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device);
135void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable);
136int offload_reverb_get_enable_flag(struct reverb_params *reverb);
137void offload_reverb_set_mode(struct reverb_params *reverb, int mode);
138void offload_reverb_set_preset(struct reverb_params *reverb, int preset);
139void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix);
140void offload_reverb_set_gain_adjust(struct reverb_params *reverb,
141 int gain_adjust);
142void offload_reverb_set_room_level(struct reverb_params *reverb,
143 int room_level);
144void offload_reverb_set_room_hf_level(struct reverb_params *reverb,
145 int room_hf_level);
146void offload_reverb_set_decay_time(struct reverb_params *reverb,
147 int decay_time);
148void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb,
149 int decay_hf_ratio);
150void offload_reverb_set_reflections_level(struct reverb_params *reverb,
151 int reflections_level);
152void offload_reverb_set_reflections_delay(struct reverb_params *reverb,
153 int reflections_delay);
154void offload_reverb_set_reverb_level(struct reverb_params *reverb,
155 int reverb_level);
156void offload_reverb_set_delay(struct reverb_params *reverb, int delay);
157void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion);
158void offload_reverb_set_density(struct reverb_params *reverb, int density);
159int offload_reverb_send_params(struct mixer_ctl *ctl,
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700160 struct reverb_params *reverb,
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800161 unsigned param_send_flags);
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700162int hw_acc_reverb_send_params(int fd,
163 struct reverb_params *reverb,
164 unsigned param_send_flags);
165
166#define OFFLOAD_SEND_SOFT_VOLUME_ENABLE_FLAG (1 << 0)
167#define OFFLOAD_SEND_SOFT_VOLUME_GAIN_2CH \
168 (OFFLOAD_SEND_SOFT_VOLUME_ENABLE_FLAG << 1)
169#define OFFLOAD_SEND_SOFT_VOLUME_GAIN_MASTER \
170 (OFFLOAD_SEND_SOFT_VOLUME_GAIN_2CH << 1)
171void offload_soft_volume_set_enable(struct soft_volume_params *vol,
172 bool enable);
173void offload_soft_volume_set_gain_master(struct soft_volume_params *vol,
174 int gain);
175void offload_soft_volume_set_gain_2ch(struct soft_volume_params *vol,
176 int l_gain, int r_gain);
177int offload_soft_volume_send_params(struct mixer_ctl *ctl,
178 struct soft_volume_params vol,
179 unsigned param_send_flags);
180
181#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_ENABLE_FLAG (1 << 0)
182#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_2CH \
183 (OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_ENABLE_FLAG << 1)
184#define OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_MASTER \
185 (OFFLOAD_SEND_TRANSITION_SOFT_VOLUME_GAIN_2CH << 1)
186void offload_transition_soft_volume_set_enable(struct soft_volume_params *vol,
187 bool enable);
188void offload_transition_soft_volume_set_gain_master(struct soft_volume_params *vol,
189 int gain);
190void offload_transition_soft_volume_set_gain_2ch(struct soft_volume_params *vol,
191 int l_gain, int r_gain);
192int offload_transition_soft_volume_send_params(struct mixer_ctl *ctl,
193 struct soft_volume_params vol,
194 unsigned param_send_flags);
Alexy Josephd464f3b2014-11-18 16:14:41 -0800195
196#define OFFLOAD_SEND_HPX_STATE_ON (1 << 0)
197#define OFFLOAD_SEND_HPX_STATE_OFF (OFFLOAD_SEND_HPX_STATE_ON << 1)
198int offload_hpx_send_params(struct mixer_ctl *ctl, unsigned param_send_flags);
199int hw_acc_hpx_send_params(int fd, unsigned param_send_flags);
200
Subhash Chandra Bose Naripeddye40a7cd2014-06-03 19:42:41 -0700201#if __cplusplus
202} //extern "C"
203#endif
Subhash Chandra Bose Naripeddy3eedc002013-11-12 20:45:15 -0800204
205#endif /*OFFLOAD_EFFECT_API_H_*/