blob: 02935bd9d1468f3b35d34d573035594dae630a00 [file] [log] [blame]
Eric Laurentb23d5282013-05-14 15:27:20 -07001/*
Vineeta Srivastava4b89e372014-06-19 14:21:42 -07002 * Copyright (C) 2013-2014 The Android Open Source Project
Eric Laurentb23d5282013-05-14 15:27:20 -07003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#define LOG_TAG "msm8960_platform"
18/*#define LOG_NDEBUG 0*/
19#define LOG_NDDEBUG 0
20
21#include <stdlib.h>
22#include <dlfcn.h>
23#include <cutils/log.h>
24#include <cutils/properties.h>
25#include <audio_hw.h>
26#include <platform_api.h>
27#include "platform.h"
28
29#define LIB_ACDB_LOADER "libacdbloader.so"
30#define LIB_CSD_CLIENT "libcsd-client.so"
31
32#define DUALMIC_CONFIG_NONE 0 /* Target does not contain 2 mics */
33#define DUALMIC_CONFIG_ENDFIRE 1
34#define DUALMIC_CONFIG_BROADSIDE 2
35
36/*
37 * This is the sysfs path for the HDMI audio data block
38 */
39#define AUDIO_DATA_BLOCK_PATH "/sys/class/graphics/fb1/audio_data_block"
sangwoo1b9f4b32013-06-21 18:22:55 -070040#define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
Eric Laurentb23d5282013-05-14 15:27:20 -070041
42/*
43 * This file will have a maximum of 38 bytes:
44 *
45 * 4 bytes: number of audio blocks
46 * 4 bytes: total length of Short Audio Descriptor (SAD) blocks
47 * Maximum 10 * 3 bytes: SAD blocks
48 */
49#define MAX_SAD_BLOCKS 10
50#define SAD_BLOCK_SIZE 3
51
52/* EDID format ID for LPCM audio */
53#define EDID_FORMAT_LPCM 1
54
55struct audio_block_header
56{
57 int reserved;
58 int length;
59};
60
61
62typedef void (*acdb_deallocate_t)();
63typedef int (*acdb_init_t)();
64typedef void (*acdb_send_audio_cal_t)(int, int);
65typedef void (*acdb_send_voice_cal_t)(int, int);
66
67typedef int (*csd_client_init_t)();
68typedef int (*csd_client_deinit_t)();
69typedef int (*csd_disable_device_t)();
70typedef int (*csd_enable_device_t)(int, int, uint32_t);
71typedef int (*csd_volume_t)(int);
72typedef int (*csd_mic_mute_t)(int);
73typedef int (*csd_start_voice_t)();
74typedef int (*csd_stop_voice_t)();
75
76
77/* Audio calibration related functions */
78struct platform_data {
79 struct audio_device *adev;
80 bool fluence_in_spkr_mode;
81 bool fluence_in_voice_call;
82 bool fluence_in_voice_rec;
83 int dualmic_config;
84
85 void *acdb_handle;
86 acdb_init_t acdb_init;
87 acdb_deallocate_t acdb_deallocate;
88 acdb_send_audio_cal_t acdb_send_audio_cal;
89 acdb_send_voice_cal_t acdb_send_voice_cal;
90
91 /* CSD Client related functions for voice call */
92 void *csd_client;
93 csd_client_init_t csd_client_init;
94 csd_client_deinit_t csd_client_deinit;
95 csd_disable_device_t csd_disable_device;
96 csd_enable_device_t csd_enable_device;
97 csd_volume_t csd_volume;
98 csd_mic_mute_t csd_mic_mute;
99 csd_start_voice_t csd_start_voice;
100 csd_stop_voice_t csd_stop_voice;
101};
102
103static const int pcm_device_table[AUDIO_USECASE_MAX][2] = {
104 [USECASE_AUDIO_PLAYBACK_DEEP_BUFFER] = {0, 0},
105 [USECASE_AUDIO_PLAYBACK_LOW_LATENCY] = {14, 14},
106 [USECASE_AUDIO_PLAYBACK_MULTI_CH] = {1, 1},
107 [USECASE_AUDIO_RECORD] = {0, 0},
108 [USECASE_AUDIO_RECORD_LOW_LATENCY] = {14, 14},
109 [USECASE_VOICE_CALL] = {12, 12},
110};
111
112/* Array to store sound devices */
113static const char * const device_table[SND_DEVICE_MAX] = {
114 [SND_DEVICE_NONE] = "none",
115 /* Playback sound devices */
116 [SND_DEVICE_OUT_HANDSET] = "handset",
117 [SND_DEVICE_OUT_SPEAKER] = "speaker",
118 [SND_DEVICE_OUT_SPEAKER_REVERSE] = "speaker-reverse",
119 [SND_DEVICE_OUT_HEADPHONES] = "headphones",
120 [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = "speaker-and-headphones",
121 [SND_DEVICE_OUT_VOICE_SPEAKER] = "voice-speaker",
122 [SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones",
123 [SND_DEVICE_OUT_HDMI] = "hdmi",
124 [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi",
125 [SND_DEVICE_OUT_BT_SCO] = "bt-sco-headset",
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700126 [SND_DEVICE_OUT_BT_SCO_WB] = "bt-sco-headset-wb",
Eric Laurentb23d5282013-05-14 15:27:20 -0700127 [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = "voice-handset-tmus",
128 [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = "voice-tty-full-headphones",
129 [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = "voice-tty-vco-headphones",
130 [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = "voice-tty-hco-handset",
131
132 /* Capture sound devices */
133 [SND_DEVICE_IN_HANDSET_MIC] = "handset-mic",
134 [SND_DEVICE_IN_SPEAKER_MIC] = "speaker-mic",
135 [SND_DEVICE_IN_HEADSET_MIC] = "headset-mic",
136 [SND_DEVICE_IN_HANDSET_MIC_AEC] = "handset-mic",
137 [SND_DEVICE_IN_SPEAKER_MIC_AEC] = "voice-speaker-mic",
138 [SND_DEVICE_IN_HEADSET_MIC_AEC] = "headset-mic",
139 [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = "voice-speaker-mic",
140 [SND_DEVICE_IN_VOICE_HEADSET_MIC] = "voice-headset-mic",
141 [SND_DEVICE_IN_HDMI_MIC] = "hdmi-mic",
142 [SND_DEVICE_IN_BT_SCO_MIC] = "bt-sco-mic",
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700143 [SND_DEVICE_IN_BT_SCO_MIC_WB] = "bt-sco-mic-wb",
Eric Laurentb23d5282013-05-14 15:27:20 -0700144 [SND_DEVICE_IN_CAMCORDER_MIC] = "camcorder-mic",
145 [SND_DEVICE_IN_VOICE_DMIC_EF] = "voice-dmic-ef",
146 [SND_DEVICE_IN_VOICE_DMIC_BS] = "voice-dmic-bs",
147 [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = "voice-dmic-ef-tmus",
148 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = "voice-speaker-dmic-ef",
149 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = "voice-speaker-dmic-bs",
150 [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = "voice-tty-full-headset-mic",
151 [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = "voice-tty-vco-handset-mic",
152 [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = "voice-tty-hco-headset-mic",
153 [SND_DEVICE_IN_VOICE_REC_MIC] = "voice-rec-mic",
154 [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = "voice-rec-dmic-ef",
155 [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = "voice-rec-dmic-bs",
156 [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = "voice-rec-dmic-ef-fluence",
157 [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = "voice-rec-dmic-bs-fluence",
158};
159
160/* ACDB IDs (audio DSP path configuration IDs) for each sound device */
161static const int acdb_device_table[SND_DEVICE_MAX] = {
162 [SND_DEVICE_NONE] = -1,
163 [SND_DEVICE_OUT_HANDSET] = 7,
164 [SND_DEVICE_OUT_SPEAKER] = 14,
165 [SND_DEVICE_OUT_SPEAKER_REVERSE] = 14,
166 [SND_DEVICE_OUT_HEADPHONES] = 10,
167 [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = 10,
168 [SND_DEVICE_OUT_VOICE_SPEAKER] = 14,
169 [SND_DEVICE_OUT_VOICE_HEADPHONES] = 10,
170 [SND_DEVICE_OUT_HDMI] = 18,
171 [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = 14,
172 [SND_DEVICE_OUT_BT_SCO] = 22,
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700173 [SND_DEVICE_OUT_BT_SCO_WB] = 39,
Eric Laurentb23d5282013-05-14 15:27:20 -0700174 [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = 81,
175 [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = 17,
176 [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = 17,
177 [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = 37,
178
179 [SND_DEVICE_IN_HANDSET_MIC] = 4,
180 [SND_DEVICE_IN_SPEAKER_MIC] = 4,
181 [SND_DEVICE_IN_HEADSET_MIC] = 8,
182 [SND_DEVICE_IN_HANDSET_MIC_AEC] = 40,
183 [SND_DEVICE_IN_SPEAKER_MIC_AEC] = 42,
184 [SND_DEVICE_IN_HEADSET_MIC_AEC] = 47,
185 [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = 11,
186 [SND_DEVICE_IN_VOICE_HEADSET_MIC] = 8,
187 [SND_DEVICE_IN_HDMI_MIC] = 4,
188 [SND_DEVICE_IN_BT_SCO_MIC] = 21,
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700189 [SND_DEVICE_IN_BT_SCO_MIC_WB] = 38,
Eric Laurentb23d5282013-05-14 15:27:20 -0700190 [SND_DEVICE_IN_CAMCORDER_MIC] = 61,
191 [SND_DEVICE_IN_VOICE_DMIC_EF] = 6,
192 [SND_DEVICE_IN_VOICE_DMIC_BS] = 5,
193 [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = 91,
194 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = 13,
195 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = 12,
196 [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = 16,
197 [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = 36,
198 [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = 16,
199 [SND_DEVICE_IN_VOICE_REC_MIC] = 62,
200 /* TODO: Update with proper acdb ids */
201 [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = 62,
202 [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = 62,
203 [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = 6,
204 [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = 5,
205};
206
Haynes Mathew George7ff216f2013-09-11 19:51:41 -0700207#define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL)
208#define LOW_LATENCY_PLATFORM_DELAY (13*1000LL)
209
Eric Laurentb23d5282013-05-14 15:27:20 -0700210static pthread_once_t check_op_once_ctl = PTHREAD_ONCE_INIT;
211static bool is_tmus = false;
212
213static void check_operator()
214{
215 char value[PROPERTY_VALUE_MAX];
216 int mccmnc;
217 property_get("gsm.sim.operator.numeric",value,"0");
218 mccmnc = atoi(value);
219 ALOGD("%s: tmus mccmnc %d", __func__, mccmnc);
220 switch(mccmnc) {
221 /* TMUS MCC(310), MNC(490, 260, 026) */
222 case 310490:
223 case 310260:
224 case 310026:
225 is_tmus = true;
226 break;
227 }
228}
229
230bool is_operator_tmus()
231{
232 pthread_once(&check_op_once_ctl, check_operator);
233 return is_tmus;
234}
235
236static int set_echo_reference(struct mixer *mixer, const char* ec_ref)
237{
238 struct mixer_ctl *ctl;
239 const char *mixer_ctl_name = "EC_REF_RX";
240
241 ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name);
242 if (!ctl) {
243 ALOGE("%s: Could not get ctl for mixer cmd - %s",
244 __func__, mixer_ctl_name);
245 return -EINVAL;
246 }
247 ALOGV("Setting EC Reference: %s", ec_ref);
248 mixer_ctl_set_enum_by_string(ctl, ec_ref);
249 return 0;
250}
251
252void *platform_init(struct audio_device *adev)
253{
254 char platform[PROPERTY_VALUE_MAX];
255 char baseband[PROPERTY_VALUE_MAX];
256 char value[PROPERTY_VALUE_MAX];
257 struct platform_data *my_data;
258
sangwoo1b9f4b32013-06-21 18:22:55 -0700259 adev->mixer = mixer_open(MIXER_CARD);
260
261 if (!adev->mixer) {
262 ALOGE("Unable to open the mixer, aborting.");
263 return NULL;
264 }
265
266 adev->audio_route = audio_route_init(MIXER_CARD, MIXER_XML_PATH);
267 if (!adev->audio_route) {
268 ALOGE("%s: Failed to init audio route controls, aborting.", __func__);
269 return NULL;
270 }
271
Eric Laurentb23d5282013-05-14 15:27:20 -0700272 my_data = calloc(1, sizeof(struct platform_data));
273
274 my_data->adev = adev;
275 my_data->dualmic_config = DUALMIC_CONFIG_NONE;
276 my_data->fluence_in_spkr_mode = false;
277 my_data->fluence_in_voice_call = false;
278 my_data->fluence_in_voice_rec = false;
279
280 property_get("persist.audio.dualmic.config",value,"");
281 if (!strcmp("broadside", value)) {
282 my_data->dualmic_config = DUALMIC_CONFIG_BROADSIDE;
283 adev->acdb_settings |= DMIC_FLAG;
284 } else if (!strcmp("endfire", value)) {
285 my_data->dualmic_config = DUALMIC_CONFIG_ENDFIRE;
286 adev->acdb_settings |= DMIC_FLAG;
287 }
288
289 if (my_data->dualmic_config != DUALMIC_CONFIG_NONE) {
290 property_get("persist.audio.fluence.voicecall",value,"");
291 if (!strcmp("true", value)) {
292 my_data->fluence_in_voice_call = true;
293 }
294
295 property_get("persist.audio.fluence.voicerec",value,"");
296 if (!strcmp("true", value)) {
297 my_data->fluence_in_voice_rec = true;
298 }
299
300 property_get("persist.audio.fluence.speaker",value,"");
301 if (!strcmp("true", value)) {
302 my_data->fluence_in_spkr_mode = true;
303 }
304 }
305
306 my_data->acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW);
307 if (my_data->acdb_handle == NULL) {
308 ALOGE("%s: DLOPEN failed for %s", __func__, LIB_ACDB_LOADER);
309 } else {
310 ALOGV("%s: DLOPEN successful for %s", __func__, LIB_ACDB_LOADER);
311 my_data->acdb_deallocate = (acdb_deallocate_t)dlsym(my_data->acdb_handle,
312 "acdb_loader_deallocate_ACDB");
313 my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
314 "acdb_loader_send_audio_cal");
315 if (!my_data->acdb_send_audio_cal)
316 ALOGW("%s: Could not find the symbol acdb_send_audio_cal from %s",
317 __func__, LIB_ACDB_LOADER);
318 my_data->acdb_send_voice_cal = (acdb_send_voice_cal_t)dlsym(my_data->acdb_handle,
319 "acdb_loader_send_voice_cal");
320 my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
321 "acdb_loader_init_ACDB");
322 if (my_data->acdb_init == NULL)
323 ALOGE("%s: dlsym error %s for acdb_loader_init_ACDB", __func__, dlerror());
324 else
325 my_data->acdb_init();
326 }
327
328 /* If platform is Fusion3, load CSD Client specific symbols
329 * Voice call is handled by MDM and apps processor talks to
330 * MDM through CSD Client
331 */
332 property_get("ro.board.platform", platform, "");
333 property_get("ro.baseband", baseband, "");
334 if (!strcmp("msm8960", platform) && !strcmp("mdm", baseband)) {
335 my_data->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW);
336 if (my_data->csd_client == NULL)
337 ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT);
338 }
339
340 if (my_data->csd_client) {
341 ALOGV("%s: DLOPEN successful for %s", __func__, LIB_CSD_CLIENT);
342 my_data->csd_client_deinit = (csd_client_deinit_t)dlsym(my_data->csd_client,
343 "csd_client_deinit");
344 my_data->csd_disable_device = (csd_disable_device_t)dlsym(my_data->csd_client,
345 "csd_client_disable_device");
346 my_data->csd_enable_device = (csd_enable_device_t)dlsym(my_data->csd_client,
347 "csd_client_enable_device");
348 my_data->csd_start_voice = (csd_start_voice_t)dlsym(my_data->csd_client,
349 "csd_client_start_voice");
350 my_data->csd_stop_voice = (csd_stop_voice_t)dlsym(my_data->csd_client,
351 "csd_client_stop_voice");
352 my_data->csd_volume = (csd_volume_t)dlsym(my_data->csd_client,
353 "csd_client_volume");
354 my_data->csd_mic_mute = (csd_mic_mute_t)dlsym(my_data->csd_client,
355 "csd_client_mic_mute");
356 my_data->csd_client_init = (csd_client_init_t)dlsym(my_data->csd_client,
357 "csd_client_init");
358
359 if (my_data->csd_client_init == NULL) {
360 ALOGE("%s: dlsym error %s for csd_client_init", __func__, dlerror());
361 } else {
362 my_data->csd_client_init();
363 }
364 }
365
366 return my_data;
367}
368
369void platform_deinit(void *platform)
370{
371 free(platform);
372}
373
374const char *platform_get_snd_device_name(snd_device_t snd_device)
375{
376 if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX)
377 return device_table[snd_device];
378 else
379 return "";
380}
381
Ravi Kumar Alamanda299760a2013-11-01 17:29:09 -0500382void platform_add_backend_name(void *platform __unused, char *mixer_path,
383 snd_device_t snd_device)
Eric Laurentb23d5282013-05-14 15:27:20 -0700384{
385 if (snd_device == SND_DEVICE_IN_BT_SCO_MIC)
386 strcat(mixer_path, " bt-sco");
387 else if(snd_device == SND_DEVICE_OUT_BT_SCO)
388 strcat(mixer_path, " bt-sco");
389 else if (snd_device == SND_DEVICE_OUT_HDMI)
390 strcat(mixer_path, " hdmi");
391 else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI)
392 strcat(mixer_path, " speaker-and-hdmi");
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700393 else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB ||
394 snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB)
395 strcat(mixer_path, " bt-sco-wb");
Eric Laurentb23d5282013-05-14 15:27:20 -0700396}
397
398int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type)
399{
400 int device_id;
401 if (device_type == PCM_PLAYBACK)
402 device_id = pcm_device_table[usecase][0];
403 else
404 device_id = pcm_device_table[usecase][1];
405 return device_id;
406}
407
Haynes Mathew George5bc18842014-06-16 16:36:20 -0700408int platform_get_snd_device_index(char *snd_device_index_name)
409{
410 return -ENODEV;
411}
412
413int platform_set_snd_device_acdb_id(snd_device_t snd_device, unsigned int acdb_id)
414{
415 return -ENODEV;
416}
417
Eric Laurentb23d5282013-05-14 15:27:20 -0700418int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
419{
420 struct platform_data *my_data = (struct platform_data *)platform;
421 int acdb_dev_id, acdb_dev_type;
422
423 acdb_dev_id = acdb_device_table[snd_device];
424 if (acdb_dev_id < 0) {
425 ALOGE("%s: Could not find acdb id for device(%d)",
426 __func__, snd_device);
427 return -EINVAL;
428 }
429 if (my_data->acdb_send_audio_cal) {
Eric Laurent994a6932013-07-17 11:51:42 -0700430 ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
Eric Laurentb23d5282013-05-14 15:27:20 -0700431 __func__, snd_device, acdb_dev_id);
432 if (snd_device >= SND_DEVICE_OUT_BEGIN &&
433 snd_device < SND_DEVICE_OUT_END)
434 acdb_dev_type = ACDB_DEV_TYPE_OUT;
435 else
436 acdb_dev_type = ACDB_DEV_TYPE_IN;
437 my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
438 }
439 return 0;
440}
441
442int platform_switch_voice_call_device_pre(void *platform)
443{
444 struct platform_data *my_data = (struct platform_data *)platform;
445 int ret = 0;
446
447 if (my_data->csd_client != NULL) {
448 /* This must be called before disabling the mixer controls on APQ side */
449 if (my_data->csd_disable_device == NULL) {
450 ALOGE("%s: dlsym error for csd_disable_device", __func__);
451 } else {
452 ret = my_data->csd_disable_device();
453 if (ret < 0) {
454 ALOGE("%s: csd_client_disable_device, failed, error %d",
455 __func__, ret);
456 }
457 }
458 }
459 return ret;
460}
461
462int platform_switch_voice_call_device_post(void *platform,
463 snd_device_t out_snd_device,
464 snd_device_t in_snd_device)
465{
466 struct platform_data *my_data = (struct platform_data *)platform;
467 int acdb_rx_id, acdb_tx_id;
468 int ret = 0;
469
470 if (my_data->csd_client) {
471 if (my_data->csd_enable_device == NULL) {
472 ALOGE("%s: dlsym error for csd_enable_device",
473 __func__);
474 } else {
475 acdb_rx_id = acdb_device_table[out_snd_device];
476 acdb_tx_id = acdb_device_table[in_snd_device];
477
478 if (acdb_rx_id > 0 || acdb_tx_id > 0) {
479 ret = my_data->csd_enable_device(acdb_rx_id, acdb_tx_id,
480 my_data->adev->acdb_settings);
481 if (ret < 0) {
482 ALOGE("%s: csd_enable_device, failed, error %d",
483 __func__, ret);
484 }
485 } else {
486 ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__,
487 acdb_rx_id, acdb_tx_id);
488 }
489 }
490 }
491
492 return ret;
493}
494
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700495int platform_start_voice_call(void *platform, uint32_t vsid __unused)
Eric Laurentb23d5282013-05-14 15:27:20 -0700496{
497 struct platform_data *my_data = (struct platform_data *)platform;
498 int ret = 0;
499
500 if (my_data->csd_client) {
501 if (my_data->csd_start_voice == NULL) {
502 ALOGE("dlsym error for csd_client_start_voice");
503 ret = -ENOSYS;
504 } else {
505 ret = my_data->csd_start_voice();
506 if (ret < 0) {
507 ALOGE("%s: csd_start_voice error %d\n", __func__, ret);
508 }
509 }
510 }
511
512 return ret;
513}
514
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700515int platform_stop_voice_call(void *platform, uint32_t vsid __unused)
Eric Laurentb23d5282013-05-14 15:27:20 -0700516{
517 struct platform_data *my_data = (struct platform_data *)platform;
518 int ret = 0;
519
520 if (my_data->csd_client) {
521 if (my_data->csd_stop_voice == NULL) {
522 ALOGE("dlsym error for csd_stop_voice");
523 } else {
524 ret = my_data->csd_stop_voice();
525 if (ret < 0) {
526 ALOGE("%s: csd_stop_voice error %d\n", __func__, ret);
527 }
528 }
529 }
530
531 return ret;
532}
533
534int platform_set_voice_volume(void *platform, int volume)
535{
536 struct platform_data *my_data = (struct platform_data *)platform;
537 int ret = 0;
538
539 if (my_data->csd_client) {
540 if (my_data->csd_volume == NULL) {
541 ALOGE("%s: dlsym error for csd_volume", __func__);
542 } else {
543 ret = my_data->csd_volume(volume);
544 if (ret < 0) {
545 ALOGE("%s: csd_volume error %d", __func__, ret);
546 }
547 }
548 } else {
549 ALOGE("%s: No CSD Client present", __func__);
550 }
551
552 return ret;
553}
554
555int platform_set_mic_mute(void *platform, bool state)
556{
557 struct platform_data *my_data = (struct platform_data *)platform;
558 int ret = 0;
559
560 if (my_data->adev->mode == AUDIO_MODE_IN_CALL) {
561 if (my_data->csd_client) {
562 if (my_data->csd_mic_mute == NULL) {
563 ALOGE("%s: dlsym error for csd_mic_mute", __func__);
564 } else {
565 ret = my_data->csd_mic_mute(state);
566 if (ret < 0) {
567 ALOGE("%s: csd_mic_mute error %d", __func__, ret);
568 }
569 }
570 } else {
571 ALOGE("%s: No CSD Client present", __func__);
572 }
573 }
574
575 return ret;
576}
577
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700578int platform_set_device_mute(void *platform __unused, bool state __unused, char *dir __unused)
579{
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700580 ALOGE("%s: Not implemented", __func__);
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700581 return -ENOSYS;
582}
583
Eric Laurentb23d5282013-05-14 15:27:20 -0700584snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices)
585{
586 struct platform_data *my_data = (struct platform_data *)platform;
587 struct audio_device *adev = my_data->adev;
588 audio_mode_t mode = adev->mode;
589 snd_device_t snd_device = SND_DEVICE_NONE;
590
591 ALOGV("%s: enter: output devices(%#x)", __func__, devices);
592 if (devices == AUDIO_DEVICE_NONE ||
593 devices & AUDIO_DEVICE_BIT_IN) {
594 ALOGV("%s: Invalid output devices (%#x)", __func__, devices);
595 goto exit;
596 }
597
598 if (mode == AUDIO_MODE_IN_CALL) {
599 if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
600 devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700601 if (adev->voice.tty_mode == TTY_MODE_FULL)
Eric Laurentb23d5282013-05-14 15:27:20 -0700602 snd_device = SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES;
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700603 else if (adev->voice.tty_mode == TTY_MODE_VCO)
Eric Laurentb23d5282013-05-14 15:27:20 -0700604 snd_device = SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES;
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700605 else if (adev->voice.tty_mode == TTY_MODE_HCO)
Eric Laurentb23d5282013-05-14 15:27:20 -0700606 snd_device = SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET;
607 else
608 snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES;
609 } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700610 if (adev->bt_wb_speech_enabled) {
611 snd_device = SND_DEVICE_OUT_BT_SCO_WB;
612 } else {
613 snd_device = SND_DEVICE_OUT_BT_SCO;
614 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700615 } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
616 snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
617 } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
618 if (is_operator_tmus())
619 snd_device = SND_DEVICE_OUT_VOICE_HANDSET_TMUS;
620 else
621 snd_device = SND_DEVICE_OUT_HANDSET;
622 }
623 if (snd_device != SND_DEVICE_NONE) {
624 goto exit;
625 }
626 }
627
628 if (popcount(devices) == 2) {
629 if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
630 AUDIO_DEVICE_OUT_SPEAKER)) {
631 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
632 } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
633 AUDIO_DEVICE_OUT_SPEAKER)) {
634 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
635 } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL |
636 AUDIO_DEVICE_OUT_SPEAKER)) {
637 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI;
638 } else {
639 ALOGE("%s: Invalid combo device(%#x)", __func__, devices);
640 goto exit;
641 }
642 if (snd_device != SND_DEVICE_NONE) {
643 goto exit;
644 }
645 }
646
647 if (popcount(devices) != 1) {
648 ALOGE("%s: Invalid output devices(%#x)", __func__, devices);
649 goto exit;
650 }
651
652 if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
653 devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
654 snd_device = SND_DEVICE_OUT_HEADPHONES;
655 } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
656 if (adev->speaker_lr_swap)
657 snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE;
658 else
659 snd_device = SND_DEVICE_OUT_SPEAKER;
660 } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700661 if (adev->bt_wb_speech_enabled) {
662 snd_device = SND_DEVICE_OUT_BT_SCO_WB;
663 } else {
664 snd_device = SND_DEVICE_OUT_BT_SCO;
665 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700666 } else if (devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
667 snd_device = SND_DEVICE_OUT_HDMI ;
668 } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
669 snd_device = SND_DEVICE_OUT_HANDSET;
670 } else {
671 ALOGE("%s: Unknown device(s) %#x", __func__, devices);
672 }
673exit:
674 ALOGV("%s: exit: snd_device(%s)", __func__, device_table[snd_device]);
675 return snd_device;
676}
677
678snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_device)
679{
680 struct platform_data *my_data = (struct platform_data *)platform;
681 struct audio_device *adev = my_data->adev;
682 audio_source_t source = (adev->active_input == NULL) ?
683 AUDIO_SOURCE_DEFAULT : adev->active_input->source;
684
685 audio_mode_t mode = adev->mode;
686 audio_devices_t in_device = ((adev->active_input == NULL) ?
687 AUDIO_DEVICE_NONE : adev->active_input->device)
688 & ~AUDIO_DEVICE_BIT_IN;
689 audio_channel_mask_t channel_mask = (adev->active_input == NULL) ?
690 AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
691 snd_device_t snd_device = SND_DEVICE_NONE;
692
693 ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
694 __func__, out_device, in_device);
695 if (mode == AUDIO_MODE_IN_CALL) {
696 if (out_device == AUDIO_DEVICE_NONE) {
697 ALOGE("%s: No output device set for voice call", __func__);
698 goto exit;
699 }
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700700 if (adev->voice.tty_mode != TTY_MODE_OFF) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700701 if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
702 out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700703 switch (adev->voice.tty_mode) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700704 case TTY_MODE_FULL:
705 snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC;
706 break;
707 case TTY_MODE_VCO:
708 snd_device = SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC;
709 break;
710 case TTY_MODE_HCO:
711 snd_device = SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC;
712 break;
713 default:
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700714 ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->voice.tty_mode);
Eric Laurentb23d5282013-05-14 15:27:20 -0700715 }
716 goto exit;
717 }
718 }
719 if (out_device & AUDIO_DEVICE_OUT_EARPIECE ||
720 out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
721 if (my_data->fluence_in_voice_call == false) {
722 snd_device = SND_DEVICE_IN_HANDSET_MIC;
723 } else {
724 if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) {
725 if (is_operator_tmus())
726 snd_device = SND_DEVICE_IN_VOICE_DMIC_EF_TMUS;
727 else
728 snd_device = SND_DEVICE_IN_VOICE_DMIC_EF;
729 } else if(my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE)
730 snd_device = SND_DEVICE_IN_VOICE_DMIC_BS;
731 else
732 snd_device = SND_DEVICE_IN_HANDSET_MIC;
733 }
734 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
735 snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC;
736 } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) {
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700737 if (adev->bt_wb_speech_enabled) {
738 snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB;
739 } else {
740 snd_device = SND_DEVICE_IN_BT_SCO_MIC;
741 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700742 } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
743 if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode &&
744 my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) {
745 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF;
746 } else if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode &&
747 my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) {
748 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS;
749 } else {
750 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
751 }
752 }
753 } else if (source == AUDIO_SOURCE_CAMCORDER) {
754 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
755 in_device & AUDIO_DEVICE_IN_BACK_MIC) {
756 snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
757 }
758 } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
759 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
760 if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) {
761 if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK)
762 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF;
763 else if (my_data->fluence_in_voice_rec)
764 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE;
765 } else if (my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) {
766 if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK)
767 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS;
768 else if (my_data->fluence_in_voice_rec)
769 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE;
770 }
771
772 if (snd_device == SND_DEVICE_NONE) {
773 snd_device = SND_DEVICE_IN_VOICE_REC_MIC;
774 }
775 }
776 } else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION) {
777 if (out_device & AUDIO_DEVICE_OUT_SPEAKER)
778 in_device = AUDIO_DEVICE_IN_BACK_MIC;
779 if (adev->active_input) {
780 if (adev->active_input->enable_aec) {
781 if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
782 snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC;
783 } else if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
784 snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC;
785 } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) {
786 snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC;
787 }
788 set_echo_reference(adev->mixer, "SLIM_RX");
789 } else
790 set_echo_reference(adev->mixer, "NONE");
791 }
792 } else if (source == AUDIO_SOURCE_DEFAULT) {
793 goto exit;
794 }
795
796
797 if (snd_device != SND_DEVICE_NONE) {
798 goto exit;
799 }
800
801 if (in_device != AUDIO_DEVICE_NONE &&
802 !(in_device & AUDIO_DEVICE_IN_VOICE_CALL) &&
803 !(in_device & AUDIO_DEVICE_IN_COMMUNICATION)) {
804 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
805 snd_device = SND_DEVICE_IN_HANDSET_MIC;
806 } else if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
807 snd_device = SND_DEVICE_IN_SPEAKER_MIC;
808 } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) {
809 snd_device = SND_DEVICE_IN_HEADSET_MIC;
810 } else if (in_device & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700811 if (adev->bt_wb_speech_enabled) {
812 snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB;
813 } else {
814 snd_device = SND_DEVICE_IN_BT_SCO_MIC;
815 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700816 } else if (in_device & AUDIO_DEVICE_IN_AUX_DIGITAL) {
817 snd_device = SND_DEVICE_IN_HDMI_MIC;
818 } else {
819 ALOGE("%s: Unknown input device(s) %#x", __func__, in_device);
820 ALOGW("%s: Using default handset-mic", __func__);
821 snd_device = SND_DEVICE_IN_HANDSET_MIC;
822 }
823 } else {
824 if (out_device & AUDIO_DEVICE_OUT_EARPIECE) {
825 snd_device = SND_DEVICE_IN_HANDSET_MIC;
826 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
827 snd_device = SND_DEVICE_IN_HEADSET_MIC;
828 } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
829 snd_device = SND_DEVICE_IN_SPEAKER_MIC;
830 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
831 snd_device = SND_DEVICE_IN_HANDSET_MIC;
832 } else if (out_device & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) {
Ravi Kumar Alamanda9f306542014-04-02 15:11:49 -0700833 if (adev->bt_wb_speech_enabled) {
834 snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB;
835 } else {
836 snd_device = SND_DEVICE_IN_BT_SCO_MIC;
837 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700838 } else if (out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
839 snd_device = SND_DEVICE_IN_HDMI_MIC;
840 } else {
841 ALOGE("%s: Unknown output device(s) %#x", __func__, out_device);
842 ALOGW("%s: Using default handset-mic", __func__);
843 snd_device = SND_DEVICE_IN_HANDSET_MIC;
844 }
845 }
846exit:
847 ALOGV("%s: exit: in_snd_device(%s)", __func__, device_table[snd_device]);
848 return snd_device;
849}
850
851int platform_set_hdmi_channels(void *platform, int channel_count)
852{
853 struct platform_data *my_data = (struct platform_data *)platform;
854 struct audio_device *adev = my_data->adev;
855 struct mixer_ctl *ctl;
856 const char *channel_cnt_str = NULL;
857 const char *mixer_ctl_name = "HDMI_RX Channels";
858 switch (channel_count) {
859 case 8:
860 channel_cnt_str = "Eight"; break;
861 case 7:
862 channel_cnt_str = "Seven"; break;
863 case 6:
864 channel_cnt_str = "Six"; break;
865 case 5:
866 channel_cnt_str = "Five"; break;
867 case 4:
868 channel_cnt_str = "Four"; break;
869 case 3:
870 channel_cnt_str = "Three"; break;
871 default:
872 channel_cnt_str = "Two"; break;
873 }
874 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
875 if (!ctl) {
876 ALOGE("%s: Could not get ctl for mixer cmd - %s",
877 __func__, mixer_ctl_name);
878 return -EINVAL;
879 }
880 ALOGV("HDMI channel count: %s", channel_cnt_str);
881 mixer_ctl_set_enum_by_string(ctl, channel_cnt_str);
882 return 0;
883}
884
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700885int platform_edid_get_max_channels(void *platform __unused)
Eric Laurentb23d5282013-05-14 15:27:20 -0700886{
887 FILE *file;
888 struct audio_block_header header;
889 char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE];
890 char *sad = block;
891 int num_audio_blocks;
892 int channel_count;
893 int max_channels = 0;
894 int i;
895
896 file = fopen(AUDIO_DATA_BLOCK_PATH, "rb");
897 if (file == NULL) {
898 ALOGE("Unable to open '%s'", AUDIO_DATA_BLOCK_PATH);
899 return 0;
900 }
901
902 /* Read audio block header */
903 fread(&header, 1, sizeof(header), file);
904
905 /* Read SAD blocks, clamping the maximum size for safety */
906 if (header.length > (int)sizeof(block))
907 header.length = (int)sizeof(block);
908 fread(&block, header.length, 1, file);
909
910 fclose(file);
911
912 /* Calculate the number of SAD blocks */
913 num_audio_blocks = header.length / SAD_BLOCK_SIZE;
914
915 for (i = 0; i < num_audio_blocks; i++) {
916 /* Only consider LPCM blocks */
917 if ((sad[0] >> 3) != EDID_FORMAT_LPCM)
918 continue;
919
920 channel_count = (sad[0] & 0x7) + 1;
921 if (channel_count > max_channels)
922 max_channels = channel_count;
923
924 /* Advance to next block */
925 sad += 3;
926 }
927
928 return max_channels;
929}
Haynes Mathew George7ff216f2013-09-11 19:51:41 -0700930
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700931int platform_set_incall_recording_session_id(void *platform __unused,
932 uint32_t session_id __unused, int rec_mode __unused)
933{
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700934 ALOGE("%s: Not implemented", __func__);
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700935 return -ENOSYS;
936}
937
938int platform_stop_incall_recording_usecase(void *platform __unused)
939{
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700940 ALOGE("%s: Not implemented", __func__);
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700941 return -ENOSYS;
942}
943
944int platform_start_incall_music_usecase(void *platform __unused)
945{
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700946 ALOGE("%s: Not implemented", __func__);
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700947 return -ENOSYS;
948}
949
950int platform_stop_incall_music_usecase(void *platform __unused)
951{
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700952 ALOGE("%s: Not implemented", __func__);
Vineeta Srivastava4b89e372014-06-19 14:21:42 -0700953 return -ENOSYS;
954}
955
Haynes Mathew George7ff216f2013-09-11 19:51:41 -0700956/* Delay in Us */
957int64_t platform_render_latency(audio_usecase_t usecase)
958{
959 switch (usecase) {
960 case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER:
961 return DEEP_BUFFER_PLATFORM_DELAY;
962 case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
963 return LOW_LATENCY_PLATFORM_DELAY;
964 default:
965 return 0;
966 }
967}
Ravi Kumar Alamanda83281a92014-05-19 18:14:57 -0700968
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700969int platform_switch_voice_call_enable_device_config(void *platform __unused,
970 snd_device_t out_snd_device __unused,
971 snd_device_t in_snd_device __unused)
Ravi Kumar Alamanda83281a92014-05-19 18:14:57 -0700972{
973 return 0;
974}
975
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700976int platform_switch_voice_call_usecase_route_post(void *platform __unused,
977 snd_device_t out_snd_device __unused,
978 snd_device_t in_snd_device __unused)
Ravi Kumar Alamanda83281a92014-05-19 18:14:57 -0700979{
980 return 0;
981}
Haynes Mathew George24ca9ad2014-06-18 15:14:18 -0700982
983int platform_get_sample_rate(void *platform __unused, uint32_t *rate __unused)
984{
985 return -ENOSYS;
986}