1 /*
2  * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
3 
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 
33 int offload_update_mixer_and_effects_ctl(int card, int device_id,
34                                          struct mixer *mixer,
35                                          struct mixer_ctl *ctl);
36 void offload_close_mixer(struct mixer *mixer);
37 
38 
39 #define OFFLOAD_SEND_PBE_ENABLE_FLAG      (1 << 0)
40 #define OFFLOAD_SEND_PBE_CONFIG           (OFFLOAD_SEND_PBE_ENABLE_FLAG << 1)
41 void offload_pbe_set_device(struct pbe_params *pbe,
42                             uint32_t device);
43 void offload_pbe_set_enable_flag(struct pbe_params *pbe,
44                                  bool enable);
45 int offload_pbe_get_enable_flag(struct pbe_params *pbe);
46 
47 int offload_pbe_send_params(struct mixer_ctl *ctl,
48                             struct pbe_params *pbe,
49                             unsigned param_send_flags);
50 int hw_acc_pbe_send_params(int fd,
51                            struct pbe_params *pbe,
52                            unsigned param_send_flags);
53 #define OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG      (1 << 0)
54 #define OFFLOAD_SEND_BASSBOOST_STRENGTH         \
55                                           (OFFLOAD_SEND_BASSBOOST_ENABLE_FLAG << 1)
56 #define OFFLOAD_SEND_BASSBOOST_MODE             \
57                                           (OFFLOAD_SEND_BASSBOOST_STRENGTH << 1)
58 void offload_bassboost_set_device(struct bass_boost_params *bassboost,
59                                   uint32_t device);
60 void offload_bassboost_set_enable_flag(struct bass_boost_params *bassboost,
61                                        bool enable);
62 int offload_bassboost_get_enable_flag(struct bass_boost_params *bassboost);
63 void offload_bassboost_set_strength(struct bass_boost_params *bassboost,
64                                     int strength);
65 void offload_bassboost_set_mode(struct bass_boost_params *bassboost,
66                                 int mode);
67 int offload_bassboost_send_params(struct mixer_ctl *ctl,
68                                   struct bass_boost_params bassboost,
69                                   unsigned param_send_flags);
70 
71 #define OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG    (1 << 0)
72 #define OFFLOAD_SEND_VIRTUALIZER_STRENGTH       \
73                                           (OFFLOAD_SEND_VIRTUALIZER_ENABLE_FLAG << 1)
74 #define OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE       \
75                                           (OFFLOAD_SEND_VIRTUALIZER_STRENGTH << 1)
76 #define OFFLOAD_SEND_VIRTUALIZER_GAIN_ADJUST    \
77                                           (OFFLOAD_SEND_VIRTUALIZER_OUT_TYPE << 1)
78 void offload_virtualizer_set_device(struct virtualizer_params *virtualizer,
79                                     uint32_t device);
80 void offload_virtualizer_set_enable_flag(struct virtualizer_params *virtualizer,
81                                          bool enable);
82 int offload_virtualizer_get_enable_flag(struct virtualizer_params *virtualizer);
83 void offload_virtualizer_set_strength(struct virtualizer_params *virtualizer,
84                                       int strength);
85 void offload_virtualizer_set_out_type(struct virtualizer_params *virtualizer,
86                                       int out_type);
87 void offload_virtualizer_set_gain_adjust(struct virtualizer_params *virtualizer,
88                                          int gain_adjust);
89 int offload_virtualizer_send_params(struct mixer_ctl *ctl,
90                                   struct virtualizer_params virtualizer,
91                                   unsigned param_send_flags);
92 
93 #define OFFLOAD_SEND_EQ_ENABLE_FLAG             (1 << 0)
94 #define OFFLOAD_SEND_EQ_PRESET                  \
95                                           (OFFLOAD_SEND_EQ_ENABLE_FLAG << 1)
96 #define OFFLOAD_SEND_EQ_BANDS_LEVEL             \
97                                           (OFFLOAD_SEND_EQ_PRESET << 1)
98 void offload_eq_set_device(struct eq_params *eq, uint32_t device);
99 void offload_eq_set_enable_flag(struct eq_params *eq, bool enable);
100 int offload_eq_get_enable_flag(struct eq_params *eq);
101 void offload_eq_set_preset(struct eq_params *eq, int preset);
102 void offload_eq_set_bands_level(struct eq_params *eq, int num_bands,
103                                 const uint16_t *band_freq_list,
104                                 int *band_gain_list);
105 int offload_eq_send_params(struct mixer_ctl *ctl, struct eq_params eq,
106                            unsigned param_send_flags);
107 
108 #define OFFLOAD_SEND_REVERB_ENABLE_FLAG         (1 << 0)
109 #define OFFLOAD_SEND_REVERB_MODE                \
110                                           (OFFLOAD_SEND_REVERB_ENABLE_FLAG << 1)
111 #define OFFLOAD_SEND_REVERB_PRESET              \
112                                           (OFFLOAD_SEND_REVERB_MODE << 1)
113 #define OFFLOAD_SEND_REVERB_WET_MIX             \
114                                           (OFFLOAD_SEND_REVERB_PRESET << 1)
115 #define OFFLOAD_SEND_REVERB_GAIN_ADJUST	        \
116                                           (OFFLOAD_SEND_REVERB_WET_MIX << 1)
117 #define OFFLOAD_SEND_REVERB_ROOM_LEVEL	        \
118                                           (OFFLOAD_SEND_REVERB_GAIN_ADJUST << 1)
119 #define OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL       \
120                                           (OFFLOAD_SEND_REVERB_ROOM_LEVEL << 1)
121 #define OFFLOAD_SEND_REVERB_DECAY_TIME          \
122                                           (OFFLOAD_SEND_REVERB_ROOM_HF_LEVEL << 1)
123 #define OFFLOAD_SEND_REVERB_DECAY_HF_RATIO      \
124                                           (OFFLOAD_SEND_REVERB_DECAY_TIME << 1)
125 #define OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL   \
126                                           (OFFLOAD_SEND_REVERB_DECAY_HF_RATIO << 1)
127 #define OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY   \
128                                           (OFFLOAD_SEND_REVERB_REFLECTIONS_LEVEL << 1)
129 #define OFFLOAD_SEND_REVERB_LEVEL               \
130                                           (OFFLOAD_SEND_REVERB_REFLECTIONS_DELAY << 1)
131 #define OFFLOAD_SEND_REVERB_DELAY               \
132                                           (OFFLOAD_SEND_REVERB_LEVEL << 1)
133 #define OFFLOAD_SEND_REVERB_DIFFUSION           \
134                                           (OFFLOAD_SEND_REVERB_DELAY << 1)
135 #define OFFLOAD_SEND_REVERB_DENSITY             \
136                                           (OFFLOAD_SEND_REVERB_DIFFUSION << 1)
137 void offload_reverb_set_device(struct reverb_params *reverb, uint32_t device);
138 void offload_reverb_set_enable_flag(struct reverb_params *reverb, bool enable);
139 int offload_reverb_get_enable_flag(struct reverb_params *reverb);
140 void offload_reverb_set_mode(struct reverb_params *reverb, int mode);
141 void offload_reverb_set_preset(struct reverb_params *reverb, int preset);
142 void offload_reverb_set_wet_mix(struct reverb_params *reverb, int wet_mix);
143 void offload_reverb_set_gain_adjust(struct reverb_params *reverb,
144                                     int gain_adjust);
145 void offload_reverb_set_room_level(struct reverb_params *reverb,
146                                    int room_level);
147 void offload_reverb_set_room_hf_level(struct reverb_params *reverb,
148                                       int room_hf_level);
149 void offload_reverb_set_decay_time(struct reverb_params *reverb,
150                                    int decay_time);
151 void offload_reverb_set_decay_hf_ratio(struct reverb_params *reverb,
152                                        int decay_hf_ratio);
153 void offload_reverb_set_reflections_level(struct reverb_params *reverb,
154                                           int reflections_level);
155 void offload_reverb_set_reflections_delay(struct reverb_params *reverb,
156                                           int reflections_delay);
157 void offload_reverb_set_reverb_level(struct reverb_params *reverb,
158                                      int reverb_level);
159 void offload_reverb_set_delay(struct reverb_params *reverb, int delay);
160 void offload_reverb_set_diffusion(struct reverb_params *reverb, int diffusion);
161 void offload_reverb_set_density(struct reverb_params *reverb, int density);
162 int offload_reverb_send_params(struct mixer_ctl *ctl,
163                                struct reverb_params reverb,
164                                unsigned param_send_flags);
165 
166 #endif /*OFFLOAD_EFFECT_API_H_*/
167