Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 1 | /* |
Subhash Chandra Bose Naripeddy | e0a0712 | 2013-12-14 00:34:53 -0800 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. |
Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 3 | * Not a Contribution. |
| 4 | * |
| 5 | * Copyright (C) 2013 The Android Open Source Project |
| 6 | * |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | * you may not use this file except in compliance with the License. |
| 9 | * You may obtain a copy of the License at |
| 10 | * |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | * |
| 13 | * Unless required by applicable law or agreed to in writing, software |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | * See the License for the specific language governing permissions and |
| 17 | * limitations under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef AUDIO_EXTN_H |
| 21 | #define AUDIO_EXTN_H |
| 22 | |
| 23 | #include <cutils/str_parms.h> |
| 24 | |
| 25 | void audio_extn_set_parameters(struct audio_device *adev, |
| 26 | struct str_parms *parms); |
| 27 | |
Shiv Maliyappanahalli | 34b585f | 2013-10-01 15:49:05 -0700 | [diff] [blame] | 28 | void audio_extn_get_parameters(const struct audio_device *adev, |
| 29 | struct str_parms *query, |
| 30 | struct str_parms *reply); |
Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 31 | |
| 32 | #ifndef ANC_HEADSET_ENABLED |
| 33 | #define audio_extn_get_anc_enabled() (0) |
| 34 | #define audio_extn_should_use_fb_anc() (0) |
| 35 | #define audio_extn_should_use_handset_anc(in_channels) (0) |
| 36 | #else |
| 37 | bool audio_extn_get_anc_enabled(void); |
| 38 | bool audio_extn_should_use_fb_anc(void); |
| 39 | bool audio_extn_should_use_handset_anc(int in_channels); |
| 40 | #endif |
| 41 | |
| 42 | #ifndef AFE_PROXY_ENABLED |
Mingming Yin | 5bdb705 | 2014-03-05 17:45:03 -0800 | [diff] [blame^] | 43 | #define audio_extn_set_afe_proxy_channel_mixer(adev,channel_count) (0) |
| 44 | #define audio_extn_read_afe_proxy_channel_masks(out) (0) |
| 45 | #define audio_extn_get_afe_proxy_channel_count() (0) |
Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 46 | #else |
Mingming Yin | 5bdb705 | 2014-03-05 17:45:03 -0800 | [diff] [blame^] | 47 | int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev, |
| 48 | int channel_count); |
Apoorv Raghuvanshi | 947cb90 | 2013-12-09 13:45:39 -0800 | [diff] [blame] | 49 | int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out); |
Mingming Yin | 5bdb705 | 2014-03-05 17:45:03 -0800 | [diff] [blame^] | 50 | int32_t audio_extn_get_afe_proxy_channel_count(); |
| 51 | |
Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 52 | #endif |
| 53 | |
Apoorv Raghuvanshi | 5792d4b | 2013-10-07 18:40:05 -0700 | [diff] [blame] | 54 | #ifndef USB_HEADSET_ENABLED |
| 55 | #define audio_extn_usb_init(adev) (0) |
| 56 | #define audio_extn_usb_deinit() (0) |
| 57 | #define audio_extn_usb_start_playback(adev) (0) |
| 58 | #define audio_extn_usb_stop_playback() (0) |
| 59 | #define audio_extn_usb_start_capture(adev) (0) |
| 60 | #define audio_extn_usb_stop_capture() (0) |
| 61 | #define audio_extn_usb_set_proxy_sound_card(sndcard_idx) (0) |
| 62 | #define audio_extn_usb_is_proxy_inuse() (0) |
| 63 | #else |
| 64 | void audio_extn_usb_init(void *adev); |
| 65 | void audio_extn_usb_deinit(); |
| 66 | void audio_extn_usb_start_playback(void *adev); |
| 67 | void audio_extn_usb_stop_playback(); |
| 68 | void audio_extn_usb_start_capture(void *adev); |
| 69 | void audio_extn_usb_stop_capture(); |
| 70 | void audio_extn_usb_set_proxy_sound_card(uint32_t sndcard_idx); |
| 71 | bool audio_extn_usb_is_proxy_inuse(); |
| 72 | #endif |
| 73 | |
Apoorv Raghuvanshi | 6178a3f | 2013-10-19 12:38:54 -0700 | [diff] [blame] | 74 | #ifndef SSR_ENABLED |
| 75 | #define audio_extn_ssr_init(adev, in) (0) |
| 76 | #define audio_extn_ssr_deinit() (0) |
Mingming Yin | 49be803 | 2013-12-19 12:51:25 -0800 | [diff] [blame] | 77 | #define audio_extn_ssr_update_enabled() (0) |
Apoorv Raghuvanshi | 6178a3f | 2013-10-19 12:38:54 -0700 | [diff] [blame] | 78 | #define audio_extn_ssr_get_enabled() (0) |
| 79 | #define audio_extn_ssr_read(stream, buffer, bytes) (0) |
| 80 | #else |
| 81 | int32_t audio_extn_ssr_init(struct audio_device *adev, |
| 82 | struct stream_in *in); |
| 83 | int32_t audio_extn_ssr_deinit(); |
Mingming Yin | 49be803 | 2013-12-19 12:51:25 -0800 | [diff] [blame] | 84 | void audio_extn_ssr_update_enabled(); |
Apoorv Raghuvanshi | 6178a3f | 2013-10-19 12:38:54 -0700 | [diff] [blame] | 85 | bool audio_extn_ssr_get_enabled(); |
| 86 | int32_t audio_extn_ssr_read(struct audio_stream_in *stream, |
| 87 | void *buffer, size_t bytes); |
| 88 | #endif |
| 89 | |
Ravi Kumar Alamanda | 48c921d | 2013-10-29 06:07:44 -0700 | [diff] [blame] | 90 | #ifndef HW_VARIANTS_ENABLED |
| 91 | #define hw_info_init(snd_card_name) (0) |
| 92 | #define hw_info_deinit(hw_info) (0) |
| 93 | #define hw_info_append_hw_type(hw_info,\ |
| 94 | snd_device, device_name) (0) |
| 95 | #else |
| 96 | void *hw_info_init(const char *snd_card_name); |
| 97 | void hw_info_deinit(void *hw_info); |
| 98 | void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device, |
| 99 | char *device_name); |
| 100 | #endif |
| 101 | |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 102 | #ifndef AUDIO_LISTEN_ENABLED |
Kiran Kandi | de144c8 | 2013-11-20 15:58:32 -0800 | [diff] [blame] | 103 | #define audio_extn_listen_init(adev, snd_card) (0) |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 104 | #define audio_extn_listen_deinit(adev) (0) |
| 105 | #define audio_extn_listen_update_status(uc_info, event) (0) |
| 106 | #define audio_extn_listen_set_parameters(adev, parms) (0) |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 107 | #else |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 108 | enum listen_event_type { |
Kiran Kandi | de144c8 | 2013-11-20 15:58:32 -0800 | [diff] [blame] | 109 | LISTEN_EVENT_SND_DEVICE_FREE, |
| 110 | LISTEN_EVENT_SND_DEVICE_BUSY |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 111 | }; |
| 112 | typedef enum listen_event_type listen_event_type_t; |
| 113 | |
Kiran Kandi | de144c8 | 2013-11-20 15:58:32 -0800 | [diff] [blame] | 114 | int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card); |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 115 | void audio_extn_listen_deinit(struct audio_device *adev); |
Kiran Kandi | de144c8 | 2013-11-20 15:58:32 -0800 | [diff] [blame] | 116 | void audio_extn_listen_update_status(snd_device_t snd_device, |
| 117 | listen_event_type_t event); |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 118 | void audio_extn_listen_set_parameters(struct audio_device *adev, |
Kiran Kandi | de144c8 | 2013-11-20 15:58:32 -0800 | [diff] [blame] | 119 | struct str_parms *parms); |
Kiran Kandi | 910e186 | 2013-10-29 13:29:42 -0700 | [diff] [blame] | 120 | #endif /* AUDIO_LISTEN_ENABLED */ |
| 121 | |
Damir Didjusto | f1d46c7 | 2013-11-06 17:59:04 -0800 | [diff] [blame] | 122 | #ifndef AUXPCM_BT_ENABLED |
Apoorv Raghuvanshi | 84fa2fe | 2013-12-04 11:57:47 -0800 | [diff] [blame] | 123 | #define audio_extn_read_xml(adev, mixer_card, MIXER_XML_PATH, \ |
Damir Didjusto | f1d46c7 | 2013-11-06 17:59:04 -0800 | [diff] [blame] | 124 | MIXER_XML_PATH_AUXPCM) (-ENOSYS) |
| 125 | #else |
| 126 | int32_t audio_extn_read_xml(struct audio_device *adev, uint32_t mixer_card, |
| 127 | const char* mixer_xml_path, |
| 128 | const char* mixer_xml_path_auxpcm); |
| 129 | #endif /* AUXPCM_BT_ENABLED */ |
Gopikrishnaiah Anandan | f538cef | 2013-10-28 14:06:03 -0700 | [diff] [blame] | 130 | #ifndef SPKR_PROT_ENABLED |
| 131 | #define audio_extn_spkr_prot_init(adev) (0) |
| 132 | #define audio_extn_spkr_prot_start_processing(snd_device) (-EINVAL) |
| 133 | #define audio_extn_spkr_prot_stop_processing() (0) |
| 134 | #define audio_extn_spkr_prot_is_enabled() (false) |
| 135 | #else |
| 136 | void audio_extn_spkr_prot_init(void *adev); |
| 137 | int audio_extn_spkr_prot_start_processing(snd_device_t snd_device); |
| 138 | void audio_extn_spkr_prot_stop_processing(); |
| 139 | bool audio_extn_spkr_prot_is_enabled(); |
| 140 | #endif |
| 141 | |
Mingming Yin | e62d784 | 2013-10-25 16:26:03 -0700 | [diff] [blame] | 142 | #ifndef COMPRESS_CAPTURE_ENABLED |
| 143 | #define audio_extn_compr_cap_init(adev,in) (0) |
| 144 | #define audio_extn_compr_cap_enabled() (0) |
| 145 | #define audio_extn_compr_cap_format_supported(format) (0) |
| 146 | #define audio_extn_compr_cap_usecase_supported(usecase) (0) |
| 147 | #define audio_extn_compr_cap_get_buffer_size(format) (0) |
| 148 | #define audio_extn_compr_cap_read(in, buffer, bytes) (0) |
| 149 | #define audio_extn_compr_cap_deinit() (0) |
| 150 | #else |
| 151 | void audio_extn_compr_cap_init(struct audio_device *adev, |
| 152 | struct stream_in *in); |
| 153 | bool audio_extn_compr_cap_enabled(); |
| 154 | bool audio_extn_compr_cap_format_supported(audio_format_t format); |
| 155 | bool audio_extn_compr_cap_usecase_supported(audio_usecase_t usecase); |
| 156 | size_t audio_extn_compr_cap_get_buffer_size(audio_format_t format); |
| 157 | size_t audio_extn_compr_cap_read(struct stream_in *in, |
| 158 | void *buffer, size_t bytes); |
| 159 | void audio_extn_compr_cap_deinit(); |
| 160 | #endif |
| 161 | |
Subhash Chandra Bose Naripeddy | e0a0712 | 2013-12-14 00:34:53 -0800 | [diff] [blame] | 162 | #if defined(DS1_DOLBY_DDP_ENABLED) || defined(DS1_DOLBY_DAP_ENABLED) |
| 163 | void audio_extn_dolby_set_dmid(struct audio_device *adev); |
Mingming Yin | 9031010 | 2013-11-13 16:57:00 -0800 | [diff] [blame] | 164 | #else |
Subhash Chandra Bose Naripeddy | e0a0712 | 2013-12-14 00:34:53 -0800 | [diff] [blame] | 165 | #define audio_extn_dolby_set_dmid(adev) (0) |
| 166 | #endif |
| 167 | |
| 168 | #ifndef DS1_DOLBY_DDP_ENABLED |
| 169 | #define audio_extn_dolby_set_endpoint() (0) |
| 170 | #else |
| 171 | void audio_extn_dolby_set_endpoint(struct audio_device *adev); |
| 172 | #endif |
| 173 | |
| 174 | #ifndef DS1_DOLBY_DDP_ENABLED |
| 175 | #define audio_extn_ddp_set_parameters(adev, parms) (0) |
| 176 | #define audio_extn_is_dolby_format(format) (0) |
| 177 | #define audio_extn_dolby_get_snd_codec_id(format) (0) |
| 178 | #define audio_extn_dolby_send_ddp_endp_params(adev) (0) |
| 179 | #else |
| 180 | bool audio_extn_is_dolby_format(audio_format_t format); |
| 181 | int audio_extn_dolby_get_snd_codec_id(struct audio_device *adev, |
| 182 | struct stream_out *out, |
| 183 | audio_format_t format); |
| 184 | void audio_extn_ddp_set_parameters(struct audio_device *adev, |
| 185 | struct str_parms *parms); |
| 186 | void audio_extn_dolby_send_ddp_endp_params(struct audio_device *adev); |
Mingming Yin | 9031010 | 2013-11-13 16:57:00 -0800 | [diff] [blame] | 187 | #endif |
| 188 | |
Vimal Puthanveed | 37b4a1c | 2014-01-07 16:47:47 -0800 | [diff] [blame] | 189 | #ifndef HFP_ENABLED |
| 190 | #define audio_extn_hfp_is_active(adev) (0) |
Vimal Puthanveed | 739e715 | 2014-01-23 15:56:53 -0800 | [diff] [blame] | 191 | #define audio_extn_hfp_get_usecase() (0) |
Vimal Puthanveed | 37b4a1c | 2014-01-07 16:47:47 -0800 | [diff] [blame] | 192 | #else |
| 193 | bool audio_extn_hfp_is_active(struct audio_device *adev); |
Vimal Puthanveed | 739e715 | 2014-01-23 15:56:53 -0800 | [diff] [blame] | 194 | audio_usecase_t audio_extn_hfp_get_usecase(); |
Vimal Puthanveed | 37b4a1c | 2014-01-07 16:47:47 -0800 | [diff] [blame] | 195 | #endif |
| 196 | |
Vimal Puthanveed | 8fa9eab | 2014-01-07 16:47:47 -0800 | [diff] [blame] | 197 | #ifndef HFP_ENABLED |
| 198 | #define audio_extn_hfp_is_active(adev) (0) |
| 199 | #else |
| 200 | bool audio_extn_hfp_is_active(struct audio_device *adev); |
| 201 | #endif |
| 202 | |
Apoorv Raghuvanshi | 9eaf94e | 2013-10-04 16:13:44 -0700 | [diff] [blame] | 203 | #endif /* AUDIO_EXTN_H */ |