blob: 5fc124d6fc9cdfb217de784d989075ea5f12be38 [file] [log] [blame]
Naresh Tannirue3b18452014-03-04 14:44:27 +05301/*
Rohit Kumarbe6935f2017-01-20 14:58:34 +05302 * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved.
Naresh Tannirudb72d1e2014-03-05 17:33:47 +05303 * Not a Contribution.
4 *
Naresh Tannirue3b18452014-03-04 14:44:27 +05305 * 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 QCOM_AUDIO_PLATFORM_H
21#define QCOM_AUDIO_PLATFORM_H
Vidyakumar Athota21b3bb92014-04-25 11:08:08 -070022#include <sound/voice_params.h>
Naresh Tannirue3b18452014-03-04 14:44:27 +053023
Naresh Tannirudb72d1e2014-03-05 17:33:47 +053024enum {
25 FLUENCE_NONE,
26 FLUENCE_DUAL_MIC = 0x1,
27 FLUENCE_QUAD_MIC = 0x2,
28};
29
Karthik Reddy Kattad9fff862014-07-21 21:07:21 +053030enum {
31 FLUENCE_ENDFIRE = 0x1,
32 FLUENCE_BROADSIDE = 0x2,
33};
34
Chaithanya Krishna Bacharaju9955b162016-05-25 16:25:53 +053035enum {
36 SOURCE_MONO_MIC = 0x1, /* Target contains 1 mic */
37 SOURCE_DUAL_MIC = 0x2, /* Target contains 2 mics */
38 SOURCE_THREE_MIC = 0x4, /* Target contains 3 mics */
39 SOURCE_QUAD_MIC = 0x8, /* Target contains 4 mics */
40};
41
Rohit kumarf4120402016-08-05 19:19:48 +053042enum {
43 SPKR_1,
44 SPKR_2
45};
46
Preetam Singh Ranawat2d0e4632015-02-02 12:40:59 +053047#define PLATFORM_IMAGE_NAME "modem"
48
Naresh Tannirue3b18452014-03-04 14:44:27 +053049/*
50 * Below are the devices for which is back end is same, SLIMBUS_0_RX.
51 * All these devices are handled by the internal HW codec. We can
Preetam Singh Ranawatc61f8672015-06-18 23:20:28 +053052 * enable any one of these devices at any time. An exception here is
53 * 44.1k headphone which uses different backend. This is filtered
54 * as different hal internal device in the code but remains same
55 * as standard android device AUDIO_DEVICE_OUT_WIRED_HEADPHONE
56 * for other layers.
Naresh Tannirue3b18452014-03-04 14:44:27 +053057 */
58#define AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND \
59 (AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | \
Naresh Tanniru9c4ba542015-11-06 18:01:09 +053060 AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE|\
61 AUDIO_DEVICE_OUT_LINE)
Naresh Tannirue3b18452014-03-04 14:44:27 +053062
Narsinga Rao Chellaf99003c2015-07-08 19:38:38 -070063/*
64 * Below are the input devices for which back end is same, SLIMBUS_0_TX.
65 * All these devices are handled by the internal HW codec. We can
66 * enable any one of these devices at any time
67 */
68#define AUDIO_DEVICE_IN_ALL_CODEC_BACKEND \
69 (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC | \
70 AUDIO_DEVICE_IN_WIRED_HEADSET | AUDIO_DEVICE_IN_VOICE_CALL) & ~AUDIO_DEVICE_BIT_IN
71
Naresh Tannirue3b18452014-03-04 14:44:27 +053072/* Sound devices specific to the platform
73 * The DEVICE_OUT_* and DEVICE_IN_* should be mapped to these sound
74 * devices to enable corresponding mixer paths
75 */
76enum {
77 SND_DEVICE_NONE = 0,
78
79 /* Playback devices */
80 SND_DEVICE_MIN,
81 SND_DEVICE_OUT_BEGIN = SND_DEVICE_MIN,
82 SND_DEVICE_OUT_HANDSET = SND_DEVICE_OUT_BEGIN,
83 SND_DEVICE_OUT_SPEAKER,
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +053084 SND_DEVICE_OUT_SPEAKER_EXTERNAL_1,
85 SND_DEVICE_OUT_SPEAKER_EXTERNAL_2,
Naresh Tannirue3b18452014-03-04 14:44:27 +053086 SND_DEVICE_OUT_SPEAKER_REVERSE,
Preetam Singh Ranawatc7f7f5c2015-04-02 12:19:58 +053087 SND_DEVICE_OUT_SPEAKER_WSA,
Banajit Goswami20cdd212015-09-11 01:11:30 -070088 SND_DEVICE_OUT_SPEAKER_VBAT,
Naresh Tanniru9c4ba542015-11-06 18:01:09 +053089 SND_DEVICE_OUT_LINE,
Naresh Tannirue3b18452014-03-04 14:44:27 +053090 SND_DEVICE_OUT_HEADPHONES,
Preetam Singh Ranawat3e5b9e72016-11-10 16:12:25 +053091 SND_DEVICE_OUT_HEADPHONES_DSD,
Apoorv Raghuvanshi21492162015-02-19 18:19:36 -080092 SND_DEVICE_OUT_HEADPHONES_44_1,
Naresh Tannirue3b18452014-03-04 14:44:27 +053093 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES,
Naresh Tanniru9c4ba542015-11-06 18:01:09 +053094 SND_DEVICE_OUT_SPEAKER_AND_LINE,
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +053095 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_1,
96 SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES_EXTERNAL_2,
Naresh Tannirue3b18452014-03-04 14:44:27 +053097 SND_DEVICE_OUT_VOICE_HANDSET,
98 SND_DEVICE_OUT_VOICE_SPEAKER,
Preetam Singh Ranawatc7f7f5c2015-04-02 12:19:58 +053099 SND_DEVICE_OUT_VOICE_SPEAKER_WSA,
Banajit Goswami20cdd212015-09-11 01:11:30 -0700100 SND_DEVICE_OUT_VOICE_SPEAKER_VBAT,
Rohit kumarf4120402016-08-05 19:19:48 +0530101 SND_DEVICE_OUT_VOICE_SPEAKER_2,
102 SND_DEVICE_OUT_VOICE_SPEAKER_2_WSA,
103 SND_DEVICE_OUT_VOICE_SPEAKER_2_VBAT,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530104 SND_DEVICE_OUT_VOICE_HEADPHONES,
Naresh Tanniru9c4ba542015-11-06 18:01:09 +0530105 SND_DEVICE_OUT_VOICE_LINE,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530106 SND_DEVICE_OUT_HDMI,
107 SND_DEVICE_OUT_SPEAKER_AND_HDMI,
Shiv Maliyappanahallic0656402016-09-03 14:13:26 -0700108 SND_DEVICE_OUT_DISPLAY_PORT,
109 SND_DEVICE_OUT_SPEAKER_AND_DISPLAY_PORT,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530110 SND_DEVICE_OUT_BT_SCO,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530111 SND_DEVICE_OUT_BT_SCO_WB,
Naresh Tanniru9d027a62015-03-13 01:32:10 +0530112 SND_DEVICE_OUT_BT_A2DP,
113 SND_DEVICE_OUT_SPEAKER_AND_BT_A2DP,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530114 SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES,
115 SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES,
116 SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET,
Preetam Singh Ranawat7112f3b2015-02-26 16:51:58 +0530117 SND_DEVICE_OUT_VOICE_TX,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530118 SND_DEVICE_OUT_AFE_PROXY,
119 SND_DEVICE_OUT_USB_HEADSET,
Ashish Jain3e37a702016-11-25 12:27:15 +0530120 SND_DEVICE_OUT_USB_HEADPHONES,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530121 SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET,
122 SND_DEVICE_OUT_TRANSMISSION_FM,
123 SND_DEVICE_OUT_ANC_HEADSET,
124 SND_DEVICE_OUT_ANC_FB_HEADSET,
125 SND_DEVICE_OUT_VOICE_ANC_HEADSET,
126 SND_DEVICE_OUT_VOICE_ANC_FB_HEADSET,
127 SND_DEVICE_OUT_SPEAKER_AND_ANC_HEADSET,
128 SND_DEVICE_OUT_ANC_HANDSET,
129 SND_DEVICE_OUT_SPEAKER_PROTECTED,
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530130 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED,
Rohit kumarf4120402016-08-05 19:19:48 +0530131 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED,
Banajit Goswami20cdd212015-09-11 01:11:30 -0700132 SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT,
133 SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED_VBAT,
Rohit kumarf4120402016-08-05 19:19:48 +0530134 SND_DEVICE_OUT_VOICE_SPEAKER_2_PROTECTED_VBAT,
Rohit Kumarbe6935f2017-01-20 14:58:34 +0530135 SND_DEVICE_OUT_SPEAKER_PROTECTED_RAS,
136 SND_DEVICE_OUT_SPEAKER_PROTECTED_VBAT_RAS,
Naresh Tanniruc0517bc2014-10-26 15:30:55 +0530137#ifdef RECORD_PLAY_CONCURRENCY
138 SND_DEVICE_OUT_VOIP_HANDSET,
139 SND_DEVICE_OUT_VOIP_SPEAKER,
140 SND_DEVICE_OUT_VOIP_HEADPHONES,
141#endif
Naresh Tannirue3b18452014-03-04 14:44:27 +0530142 SND_DEVICE_OUT_END,
143
144 /*
145 * Note: IN_BEGIN should be same as OUT_END because total number of devices
146 * SND_DEVICES_MAX should not exceed MAX_RX + MAX_TX devices.
147 */
148 /* Capture devices */
149 SND_DEVICE_IN_BEGIN = SND_DEVICE_OUT_END,
150 SND_DEVICE_IN_HANDSET_MIC = SND_DEVICE_IN_BEGIN,
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530151 SND_DEVICE_IN_HANDSET_MIC_EXTERNAL,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530152 SND_DEVICE_IN_HANDSET_MIC_AEC,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530153 SND_DEVICE_IN_HANDSET_MIC_NS,
154 SND_DEVICE_IN_HANDSET_MIC_AEC_NS,
155 SND_DEVICE_IN_HANDSET_DMIC,
156 SND_DEVICE_IN_HANDSET_DMIC_AEC,
157 SND_DEVICE_IN_HANDSET_DMIC_NS,
158 SND_DEVICE_IN_HANDSET_DMIC_AEC_NS,
159 SND_DEVICE_IN_SPEAKER_MIC,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530160 SND_DEVICE_IN_SPEAKER_MIC_AEC,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530161 SND_DEVICE_IN_SPEAKER_MIC_NS,
162 SND_DEVICE_IN_SPEAKER_MIC_AEC_NS,
163 SND_DEVICE_IN_SPEAKER_DMIC,
164 SND_DEVICE_IN_SPEAKER_DMIC_AEC,
165 SND_DEVICE_IN_SPEAKER_DMIC_NS,
166 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS,
167 SND_DEVICE_IN_HEADSET_MIC,
168 SND_DEVICE_IN_HEADSET_MIC_FLUENCE,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530169 SND_DEVICE_IN_VOICE_SPEAKER_MIC,
170 SND_DEVICE_IN_VOICE_HEADSET_MIC,
171 SND_DEVICE_IN_HDMI_MIC,
172 SND_DEVICE_IN_BT_SCO_MIC,
Vicky Sehrawate240e5d2014-08-12 17:17:04 -0700173 SND_DEVICE_IN_BT_SCO_MIC_NREC,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530174 SND_DEVICE_IN_BT_SCO_MIC_WB,
Vicky Sehrawate240e5d2014-08-12 17:17:04 -0700175 SND_DEVICE_IN_BT_SCO_MIC_WB_NREC,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530176 SND_DEVICE_IN_CAMCORDER_MIC,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530177 SND_DEVICE_IN_VOICE_DMIC,
178 SND_DEVICE_IN_VOICE_SPEAKER_DMIC,
179 SND_DEVICE_IN_VOICE_SPEAKER_QMIC,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530180 SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC,
181 SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC,
182 SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC,
183 SND_DEVICE_IN_VOICE_REC_MIC,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530184 SND_DEVICE_IN_VOICE_REC_MIC_NS,
185 SND_DEVICE_IN_VOICE_REC_DMIC_STEREO,
186 SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE,
Preetam Singh Ranawat7112f3b2015-02-26 16:51:58 +0530187 SND_DEVICE_IN_VOICE_RX,
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530188 SND_DEVICE_IN_USB_HEADSET_MIC,
189 SND_DEVICE_IN_CAPTURE_FM,
190 SND_DEVICE_IN_AANC_HANDSET_MIC,
191 SND_DEVICE_IN_QUAD_MIC,
192 SND_DEVICE_IN_HANDSET_STEREO_DMIC,
193 SND_DEVICE_IN_SPEAKER_STEREO_DMIC,
194 SND_DEVICE_IN_CAPTURE_VI_FEEDBACK,
Rohit kumarf4120402016-08-05 19:19:48 +0530195 SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_1,
196 SND_DEVICE_IN_CAPTURE_VI_FEEDBACK_MONO_2,
Karthik Reddy Kattad9fff862014-07-21 21:07:21 +0530197 SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
198 SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE,
199 SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
200 SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
201 SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
Sidipotu Ashok3bcca232014-11-07 14:41:58 +0530202 SND_DEVICE_IN_VOICE_FLUENCE_DMIC_AANC,
Karthik Reddy Kattad71b94b2015-01-19 14:06:53 +0530203 SND_DEVICE_IN_HANDSET_QMIC,
204 SND_DEVICE_IN_SPEAKER_QMIC_AEC,
205 SND_DEVICE_IN_SPEAKER_QMIC_NS,
206 SND_DEVICE_IN_SPEAKER_QMIC_AEC_NS,
Shiv Maliyappanahalli5a10aea2015-07-02 10:36:23 -0700207 SND_DEVICE_IN_THREE_MIC,
Chaithanya Krishna Bacharaju9955b162016-05-25 16:25:53 +0530208 SND_DEVICE_IN_HANDSET_TMIC,
Ben Rombergera4d76db2016-10-13 15:26:02 -0700209 SND_DEVICE_IN_VOICE_REC_TMIC,
Chaithanya Krishna Bacharaju24f86f32016-05-26 16:34:53 +0530210 SND_DEVICE_IN_UNPROCESSED_MIC,
211 SND_DEVICE_IN_UNPROCESSED_STEREO_MIC,
212 SND_DEVICE_IN_UNPROCESSED_THREE_MIC,
213 SND_DEVICE_IN_UNPROCESSED_QUAD_MIC,
214 SND_DEVICE_IN_UNPROCESSED_HEADSET_MIC,
Naresh Tannirue3b18452014-03-04 14:44:27 +0530215 SND_DEVICE_IN_END,
216
217 SND_DEVICE_MAX = SND_DEVICE_IN_END,
218
219};
Preetam Singh Ranawatcb6212e2016-07-19 18:33:53 +0530220#define INPUT_SAMPLING_RATE_DSD64 2822400
221#define INPUT_SAMPLING_RATE_DSD128 5644800
Naresh Tannirue3b18452014-03-04 14:44:27 +0530222#define DEFAULT_OUTPUT_SAMPLING_RATE 48000
Preetam Singh Ranawatc61f8672015-06-18 23:20:28 +0530223#define OUTPUT_SAMPLING_RATE_44100 44100
Preetam Singh Ranawatcb6212e2016-07-19 18:33:53 +0530224#define OUTPUT_SAMPLING_RATE_DSD64 176400
225#define OUTPUT_SAMPLING_RATE_DSD128 352800
Preetam Singh Ranawatc61f8672015-06-18 23:20:28 +0530226#define MAX_PORT 6
227#define ALL_CODEC_BACKEND_PORT 0
228#define HEADPHONE_44_1_BACKEND_PORT 5
Apoorv Raghuvanshi21492162015-02-19 18:19:36 -0800229enum {
230 DEFAULT_CODEC_BACKEND,
Sidipotu Ashok9f0b16e2016-04-28 13:48:28 +0530231 SLIMBUS_0_RX = DEFAULT_CODEC_BACKEND,
Preetam Singh Ranawatcb6212e2016-07-19 18:33:53 +0530232 DSD_NATIVE_BACKEND,
233 SLIMBUS_2_RX = DSD_NATIVE_BACKEND,
Apoorv Raghuvanshi21492162015-02-19 18:19:36 -0800234 HEADPHONE_44_1_BACKEND,
Sidipotu Ashok9f0b16e2016-04-28 13:48:28 +0530235 SLIMBUS_5_RX = HEADPHONE_44_1_BACKEND,
236 HEADPHONE_BACKEND,
237 SLIMBUS_6_RX = HEADPHONE_BACKEND,
238 HDMI_RX_BACKEND,
Shiv Maliyappanahallic0656402016-09-03 14:13:26 -0700239 DISP_PORT_RX_BACKEND,
Kuirong Wanga9f7cee2016-03-07 11:21:52 -0800240 USB_AUDIO_RX_BACKEND,
Kuirong Wang0b947f72016-09-29 11:03:09 -0700241 MAX_RX_CODEC_BACKENDS = USB_AUDIO_RX_BACKEND,
242 /* TX BE follows RX BE */
243 SLIMBUS_0_TX,
244 DEFAULT_CODEC_TX_BACKEND = SLIMBUS_0_TX,
245 USB_AUDIO_TX_BACKEND,
Dhanalakshmi Siddanib678a802016-12-03 11:51:41 +0530246 BT_SCO_TX_BACKEND,
Apoorv Raghuvanshi21492162015-02-19 18:19:36 -0800247 MAX_CODEC_BACKENDS
248};
Kuirong Wang0b947f72016-09-29 11:03:09 -0700249
Preetam Singh Ranawatc61f8672015-06-18 23:20:28 +0530250#define AUDIO_PARAMETER_KEY_NATIVE_AUDIO "audio.nat.codec.enabled"
Sidipotu Ashoke6f78cb2015-11-05 14:42:20 +0530251#define AUDIO_PARAMETER_KEY_NATIVE_AUDIO_MODE "native_audio_mode"
Naresh Tannirue3b18452014-03-04 14:44:27 +0530252
Ashish Jainf1eaa582016-05-23 20:54:24 +0530253#define AUDIO_PARAMETER_KEY_TRUE_32_BIT "true_32_bit"
254
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530255#define ALL_SESSION_VSID 0xFFFFFFFF
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530256#define DEFAULT_MUTE_RAMP_DURATION_MS 20
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530257#define DEFAULT_VOLUME_RAMP_DURATION_MS 20
258#define MIXER_PATH_MAX_LENGTH 100
Sidipotu Ashoke6f78cb2015-11-05 14:42:20 +0530259#define SND_CARD_MAX_LENGTH 100
260#define CODEC_VERSION_MAX_LENGTH 100
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530261
262#define MAX_VOL_INDEX 5
263#define MIN_VOL_INDEX 0
264#define percent_to_index(val, min, max) \
265 ((val) * ((max) - (min)) * 0.01 + (min) + .5)
266
Naresh Tannirue3b18452014-03-04 14:44:27 +0530267/*
268 * tinyAlsa library interprets period size as number of frames
269 * one frame = channel_count * sizeof (pcm sample)
270 * so if format = 16-bit PCM and channels = Stereo, frame size = 2 ch * 2 = 4 bytes
271 * DEEP_BUFFER_OUTPUT_PERIOD_SIZE = 1024 means 1024 * 4 = 4096 bytes
272 * We should take care of returning proper size when AudioFlinger queries for
273 * the buffer size of an input/output stream
274 */
Alexy Joseph029faa22015-06-18 14:22:14 -0700275#define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 1920
Ashish Jain058165c2016-09-28 23:18:48 +0530276#define DEEP_BUFFER_OUTPUT_PERIOD_DURATION 40 /* 40 millisecs */
Alexy Joseph029faa22015-06-18 14:22:14 -0700277#define DEEP_BUFFER_OUTPUT_PERIOD_COUNT 2
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530278#define LOW_LATENCY_OUTPUT_PERIOD_SIZE 240
Naresh Tannirue3b18452014-03-04 14:44:27 +0530279#define LOW_LATENCY_OUTPUT_PERIOD_COUNT 2
280
Ravi Kumar Alamandadc9bb152014-09-08 15:59:58 -0700281#define LOW_LATENCY_CAPTURE_SAMPLE_RATE 48000
282#define LOW_LATENCY_CAPTURE_PERIOD_SIZE 240
Sharad Sangle896e7b12014-11-07 17:06:29 +0530283#define LOW_LATENCY_CAPTURE_USE_CASE 1
Ravi Kumar Alamandadc9bb152014-09-08 15:59:58 -0700284
Naresh Tannirue3b18452014-03-04 14:44:27 +0530285#define HDMI_MULTI_PERIOD_SIZE 336
286#define HDMI_MULTI_PERIOD_COUNT 8
287#define HDMI_MULTI_DEFAULT_CHANNEL_COUNT 6
288#define HDMI_MULTI_PERIOD_BYTES (HDMI_MULTI_PERIOD_SIZE * HDMI_MULTI_DEFAULT_CHANNEL_COUNT * 2)
289
Ashish Jainf1eaa582016-05-23 20:54:24 +0530290
291/* Used in calculating fragment size for pcm offload */
292#define PCM_OFFLOAD_BUFFER_DURATION 40 /* 40 millisecs */
293
294/* MAX PCM fragment size cannot be increased further due
295 * to flinger's cblk size of 1mb,and it has to be a multiple of
296 * 24 - lcm of channels supported by DSP
297 */
298#define MAX_PCM_OFFLOAD_FRAGMENT_SIZE (240 * 1024)
299#define MIN_PCM_OFFLOAD_FRAGMENT_SIZE 512
300
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530301#define AUDIO_CAPTURE_PERIOD_DURATION_MSEC 20
302#define AUDIO_CAPTURE_PERIOD_COUNT 2
303
304#define DEVICE_NAME_MAX_SIZE 128
305#define HW_INFO_ARRAY_MAX_SIZE 32
306
307#define DEEP_BUFFER_PCM_DEVICE 0
308#define AUDIO_RECORD_PCM_DEVICE 0
309#define MULTIMEDIA2_PCM_DEVICE 1
Naresh Tanniru3a7dbe72015-06-25 20:08:01 -0700310#define MULTIMEDIA3_PCM_DEVICE 4
Shiv Maliyappanahallic0656402016-09-03 14:13:26 -0700311#define MULTIMEDIA9_PCM_DEVICE 32
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530312#define FM_PLAYBACK_PCM_DEVICE 5
313#define FM_CAPTURE_PCM_DEVICE 6
314#define HFP_PCM_RX 5
Satya Krishna Pindiproli640c91e2014-03-14 11:09:09 +0530315#define HFP_SCO_RX 17
316#define HFP_ASM_RX_TX 18
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530317
318#define INCALL_MUSIC_UPLINK_PCM_DEVICE 1
319#define INCALL_MUSIC_UPLINK2_PCM_DEVICE 16
320#define SPKR_PROT_CALIB_RX_PCM_DEVICE 5
Laxminath Kasam999caa42015-05-08 18:17:23 +0530321#define SPKR_PROT_CALIB_TX_PCM_DEVICE 26
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530322#define PLAYBACK_OFFLOAD_DEVICE 9
Naresh Tanniru06f99432015-08-26 14:01:20 -0700323#define PLAYBACK_OFFLOAD_DEVICE2 24
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530324#define COMPRESS_VOIP_CALL_PCM_DEVICE 3
325
Banajit Goswami88d6cc52014-04-10 17:59:02 -0700326/* Define macro for Internal FM volume mixer */
Dhananjay Kumard3ab9f42016-07-20 17:05:47 +0530327#ifdef PLATFORM_MSMFALCON
328#define FM_RX_VOLUME "SLIMBUS_8 LOOPBACK Volume"
329#else
Banajit Goswami88d6cc52014-04-10 17:59:02 -0700330#define FM_RX_VOLUME "Internal FM RX Volume"
Dhananjay Kumard3ab9f42016-07-20 17:05:47 +0530331#endif
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530332
333#define LOWLATENCY_PCM_DEVICE 12
334#define EC_REF_RX "I2S_RX"
335#define COMPRESS_CAPTURE_DEVICE 19
336
337#define VOICE_CALL_PCM_DEVICE 2
338#define VOICE2_CALL_PCM_DEVICE 13
339#define VOLTE_CALL_PCM_DEVICE 15
Karthik Reddy Katta561d4ba2016-06-23 13:41:18 +0530340#define QCHAT_CALL_PCM_DEVICE 37
Karthik Reddy Katta3b0a60c2014-04-06 14:52:37 +0530341#define VOWLAN_CALL_PCM_DEVICE 16
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530342
Preetam Singh Ranawat7112f3b2015-02-26 16:51:58 +0530343#define AFE_PROXY_PLAYBACK_PCM_DEVICE 7
344#define AFE_PROXY_RECORD_PCM_DEVICE 8
345
Chaithanya Krishna Bacharaju9955b162016-05-25 16:25:53 +0530346#define PLATFORM_MAX_MIC_COUNT "input_mic_max_count"
347#define PLATFORM_DEFAULT_MIC_COUNT 2
348
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530349#define LIB_CSD_CLIENT "libcsd-client.so"
350/* CSD-CLIENT related functions */
351typedef int (*init_t)();
352typedef int (*deinit_t)();
353typedef int (*disable_device_t)();
354typedef int (*enable_device_config_t)(int, int);
355typedef int (*enable_device_t)(int, int, uint32_t);
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530356typedef int (*volume_t)(uint32_t, int, uint16_t);
357typedef int (*mic_mute_t)(uint32_t, int, uint16_t);
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530358typedef int (*slow_talk_t)(uint32_t, uint8_t);
359typedef int (*start_voice_t)(uint32_t);
360typedef int (*stop_voice_t)(uint32_t);
361typedef int (*start_playback_t)(uint32_t);
362typedef int (*stop_playback_t)(uint32_t);
Vidyakumar Athota21b3bb92014-04-25 11:08:08 -0700363typedef int (*set_lch_t)(uint32_t, enum voice_lch_mode);
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530364typedef int (*start_record_t)(uint32_t, int);
365typedef int (*stop_record_t)(uint32_t);
366/* CSD Client structure */
367struct csd_data {
368 void *csd_client;
369 init_t init;
370 deinit_t deinit;
371 disable_device_t disable_device;
372 enable_device_config_t enable_device_config;
373 enable_device_t enable_device;
374 volume_t volume;
375 mic_mute_t mic_mute;
376 slow_talk_t slow_talk;
377 start_voice_t start_voice;
378 stop_voice_t stop_voice;
379 start_playback_t start_playback;
380 stop_playback_t stop_playback;
Vidyakumar Athota21b3bb92014-04-25 11:08:08 -0700381 set_lch_t set_lch;
Naresh Tannirudb72d1e2014-03-05 17:33:47 +0530382 start_record_t start_record;
383 stop_record_t stop_record;
384};
Naresh Tannirue3b18452014-03-04 14:44:27 +0530385
Preetam Singh Ranawat2d0e4632015-02-02 12:40:59 +0530386int platform_get_subsys_image_name (char *buf);
387
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530388/* HDMI Passthrough defines */
389enum {
390 LEGACY_PCM = 0,
391 PASSTHROUGH,
Preetam Singh Ranawatcb6212e2016-07-19 18:33:53 +0530392 PASSTHROUGH_CONVERT,
393 PASSTHROUGH_DSD
Preetam Singh Ranawat8bde2c52015-03-20 12:00:49 +0530394};
395/*
396 * ID for setting mute and lateny on the device side
397 * through Device PP Params mixer control.
398 */
399#define DEVICE_PARAM_MUTE_ID 0
400#define DEVICE_PARAM_LATENCY_ID 1
Karthik Reddy Kattae4078ed2015-04-21 11:46:15 +0530401
402#define ENUM_TO_STRING(X) #X
403
404struct audio_device_to_audio_interface {
405 audio_devices_t device;
406 char device_name[100];
407 char interface_name[100];
408};
Ashish Jaind84fd6a2016-07-27 12:33:25 +0530409
410struct audio_backend_cfg {
411 unsigned int sample_rate;
412 unsigned int channels;
413 unsigned int bit_width;
414 bool passthrough_enabled;
415 audio_format_t format;
416};
417
Naresh Tannirue3b18452014-03-04 14:44:27 +0530418#endif // QCOM_AUDIO_PLATFORM_H