blob: af0b2856c78182750c3368c5cfe20972319093bd [file] [log] [blame]
Apoorv Raghuvanshi9eaf94e2013-10-04 16:13:44 -07001/*
Subhash Chandra Bose Naripeddye0a07122013-12-14 00:34:53 -08002 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Apoorv Raghuvanshi9eaf94e2013-10-04 16:13:44 -07003 * 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
25void audio_extn_set_parameters(struct audio_device *adev,
26 struct str_parms *parms);
27
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -070028void audio_extn_get_parameters(const struct audio_device *adev,
29 struct str_parms *query,
30 struct str_parms *reply);
Apoorv Raghuvanshi9eaf94e2013-10-04 16:13:44 -070031
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
37bool audio_extn_get_anc_enabled(void);
38bool audio_extn_should_use_fb_anc(void);
39bool audio_extn_should_use_handset_anc(int in_channels);
40#endif
41
42#ifndef AFE_PROXY_ENABLED
Mingming Yin5bdb7052014-03-05 17:45:03 -080043#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 Raghuvanshi9eaf94e2013-10-04 16:13:44 -070046#else
Mingming Yin5bdb7052014-03-05 17:45:03 -080047int32_t audio_extn_set_afe_proxy_channel_mixer(struct audio_device *adev,
48 int channel_count);
Apoorv Raghuvanshi947cb902013-12-09 13:45:39 -080049int32_t audio_extn_read_afe_proxy_channel_masks(struct stream_out *out);
Mingming Yin5bdb7052014-03-05 17:45:03 -080050int32_t audio_extn_get_afe_proxy_channel_count();
51
Apoorv Raghuvanshi9eaf94e2013-10-04 16:13:44 -070052#endif
53
Apoorv Raghuvanshi5792d4b2013-10-07 18:40:05 -070054#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
64void audio_extn_usb_init(void *adev);
65void audio_extn_usb_deinit();
66void audio_extn_usb_start_playback(void *adev);
67void audio_extn_usb_stop_playback();
68void audio_extn_usb_start_capture(void *adev);
69void audio_extn_usb_stop_capture();
70void audio_extn_usb_set_proxy_sound_card(uint32_t sndcard_idx);
71bool audio_extn_usb_is_proxy_inuse();
72#endif
73
Apoorv Raghuvanshi6178a3f2013-10-19 12:38:54 -070074#ifndef SSR_ENABLED
75#define audio_extn_ssr_init(adev, in) (0)
76#define audio_extn_ssr_deinit() (0)
Mingming Yin49be8032013-12-19 12:51:25 -080077#define audio_extn_ssr_update_enabled() (0)
Apoorv Raghuvanshi6178a3f2013-10-19 12:38:54 -070078#define audio_extn_ssr_get_enabled() (0)
79#define audio_extn_ssr_read(stream, buffer, bytes) (0)
80#else
81int32_t audio_extn_ssr_init(struct audio_device *adev,
82 struct stream_in *in);
83int32_t audio_extn_ssr_deinit();
Mingming Yin49be8032013-12-19 12:51:25 -080084void audio_extn_ssr_update_enabled();
Apoorv Raghuvanshi6178a3f2013-10-19 12:38:54 -070085bool audio_extn_ssr_get_enabled();
86int32_t audio_extn_ssr_read(struct audio_stream_in *stream,
87 void *buffer, size_t bytes);
88#endif
89
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070090#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
96void *hw_info_init(const char *snd_card_name);
97void hw_info_deinit(void *hw_info);
98void hw_info_append_hw_type(void *hw_info, snd_device_t snd_device,
99 char *device_name);
100#endif
101
Kiran Kandi910e1862013-10-29 13:29:42 -0700102#ifndef AUDIO_LISTEN_ENABLED
Kiran Kandide144c82013-11-20 15:58:32 -0800103#define audio_extn_listen_init(adev, snd_card) (0)
Kiran Kandi910e1862013-10-29 13:29:42 -0700104#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 Kandi910e1862013-10-29 13:29:42 -0700107#else
Kiran Kandi910e1862013-10-29 13:29:42 -0700108enum listen_event_type {
Kiran Kandide144c82013-11-20 15:58:32 -0800109 LISTEN_EVENT_SND_DEVICE_FREE,
110 LISTEN_EVENT_SND_DEVICE_BUSY
Kiran Kandi910e1862013-10-29 13:29:42 -0700111};
112typedef enum listen_event_type listen_event_type_t;
113
Kiran Kandide144c82013-11-20 15:58:32 -0800114int audio_extn_listen_init(struct audio_device *adev, unsigned int snd_card);
Kiran Kandi910e1862013-10-29 13:29:42 -0700115void audio_extn_listen_deinit(struct audio_device *adev);
Kiran Kandide144c82013-11-20 15:58:32 -0800116void audio_extn_listen_update_status(snd_device_t snd_device,
117 listen_event_type_t event);
Kiran Kandi910e1862013-10-29 13:29:42 -0700118void audio_extn_listen_set_parameters(struct audio_device *adev,
Kiran Kandide144c82013-11-20 15:58:32 -0800119 struct str_parms *parms);
Kiran Kandi910e1862013-10-29 13:29:42 -0700120#endif /* AUDIO_LISTEN_ENABLED */
121
Damir Didjustof1d46c72013-11-06 17:59:04 -0800122#ifndef AUXPCM_BT_ENABLED
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800123#define audio_extn_read_xml(adev, mixer_card, MIXER_XML_PATH, \
Damir Didjustof1d46c72013-11-06 17:59:04 -0800124 MIXER_XML_PATH_AUXPCM) (-ENOSYS)
125#else
126int32_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 Anandanf538cef2013-10-28 14:06:03 -0700130#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
136void audio_extn_spkr_prot_init(void *adev);
137int audio_extn_spkr_prot_start_processing(snd_device_t snd_device);
138void audio_extn_spkr_prot_stop_processing();
139bool audio_extn_spkr_prot_is_enabled();
140#endif
141
Mingming Yine62d7842013-10-25 16:26:03 -0700142#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
151void audio_extn_compr_cap_init(struct audio_device *adev,
152 struct stream_in *in);
153bool audio_extn_compr_cap_enabled();
154bool audio_extn_compr_cap_format_supported(audio_format_t format);
155bool audio_extn_compr_cap_usecase_supported(audio_usecase_t usecase);
156size_t audio_extn_compr_cap_get_buffer_size(audio_format_t format);
157size_t audio_extn_compr_cap_read(struct stream_in *in,
158 void *buffer, size_t bytes);
159void audio_extn_compr_cap_deinit();
160#endif
161
Subhash Chandra Bose Naripeddye0a07122013-12-14 00:34:53 -0800162#if defined(DS1_DOLBY_DDP_ENABLED) || defined(DS1_DOLBY_DAP_ENABLED)
163void audio_extn_dolby_set_dmid(struct audio_device *adev);
Mingming Yin90310102013-11-13 16:57:00 -0800164#else
Subhash Chandra Bose Naripeddye0a07122013-12-14 00:34:53 -0800165#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
171void 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
180bool audio_extn_is_dolby_format(audio_format_t format);
181int audio_extn_dolby_get_snd_codec_id(struct audio_device *adev,
182 struct stream_out *out,
183 audio_format_t format);
184void audio_extn_ddp_set_parameters(struct audio_device *adev,
185 struct str_parms *parms);
186void audio_extn_dolby_send_ddp_endp_params(struct audio_device *adev);
Mingming Yin90310102013-11-13 16:57:00 -0800187#endif
188
Vimal Puthanveed37b4a1c2014-01-07 16:47:47 -0800189#ifndef HFP_ENABLED
190#define audio_extn_hfp_is_active(adev) (0)
Vimal Puthanveed739e7152014-01-23 15:56:53 -0800191#define audio_extn_hfp_get_usecase() (0)
Vimal Puthanveed37b4a1c2014-01-07 16:47:47 -0800192#else
193bool audio_extn_hfp_is_active(struct audio_device *adev);
Vimal Puthanveed739e7152014-01-23 15:56:53 -0800194audio_usecase_t audio_extn_hfp_get_usecase();
Vimal Puthanveed37b4a1c2014-01-07 16:47:47 -0800195#endif
196
Vimal Puthanveed8fa9eab2014-01-07 16:47:47 -0800197#ifndef HFP_ENABLED
198#define audio_extn_hfp_is_active(adev) (0)
199#else
200bool audio_extn_hfp_is_active(struct audio_device *adev);
201#endif
202
Apoorv Raghuvanshi9eaf94e2013-10-04 16:13:44 -0700203#endif /* AUDIO_EXTN_H */