blob: 55149887521b032e886ce811c1dd3d5ac21b03d5 [file] [log] [blame]
Eric Laurentb23d5282013-05-14 15:27:20 -07001/*
Ben Rombergera1673712014-01-10 13:49:02 -08002 * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -07003 * Not a contribution.
4 *
Eric Laurentb23d5282013-05-14 15:27:20 -07005 * 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#define LOG_TAG "msm8960_platform"
21/*#define LOG_NDEBUG 0*/
22#define LOG_NDDEBUG 0
23
24#include <stdlib.h>
25#include <dlfcn.h>
26#include <cutils/log.h>
27#include <cutils/properties.h>
28#include <audio_hw.h>
29#include <platform_api.h>
30#include "platform.h"
31
32#define LIB_ACDB_LOADER "libacdbloader.so"
33#define LIB_CSD_CLIENT "libcsd-client.so"
34
Eric Laurentb23d5282013-05-14 15:27:20 -070035/*
36 * This is the sysfs path for the HDMI audio data block
37 */
38#define AUDIO_DATA_BLOCK_PATH "/sys/class/graphics/fb1/audio_data_block"
sangwoo1b9f4b32013-06-21 18:22:55 -070039#define MIXER_XML_PATH "/system/etc/mixer_paths.xml"
Eric Laurentb23d5282013-05-14 15:27:20 -070040
41/*
42 * This file will have a maximum of 38 bytes:
43 *
44 * 4 bytes: number of audio blocks
45 * 4 bytes: total length of Short Audio Descriptor (SAD) blocks
46 * Maximum 10 * 3 bytes: SAD blocks
47 */
48#define MAX_SAD_BLOCKS 10
49#define SAD_BLOCK_SIZE 3
50
51/* EDID format ID for LPCM audio */
52#define EDID_FORMAT_LPCM 1
53
54struct audio_block_header
55{
56 int reserved;
57 int length;
58};
59
60
61typedef void (*acdb_deallocate_t)();
62typedef int (*acdb_init_t)();
63typedef void (*acdb_send_audio_cal_t)(int, int);
64typedef void (*acdb_send_voice_cal_t)(int, int);
65
66typedef int (*csd_client_init_t)();
67typedef int (*csd_client_deinit_t)();
68typedef int (*csd_disable_device_t)();
69typedef int (*csd_enable_device_t)(int, int, uint32_t);
70typedef int (*csd_volume_t)(int);
71typedef int (*csd_mic_mute_t)(int);
72typedef int (*csd_start_voice_t)();
73typedef int (*csd_stop_voice_t)();
74
75
Eric Laurentb23d5282013-05-14 15:27:20 -070076struct platform_data {
77 struct audio_device *adev;
78 bool fluence_in_spkr_mode;
79 bool fluence_in_voice_call;
80 bool fluence_in_voice_rec;
Mingming Yin8e5a4f62013-10-07 15:23:41 -070081 int fluence_type;
Eric Laurentb23d5282013-05-14 15:27:20 -070082 int dualmic_config;
83
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -070084 void *hw_info;
85
86 /* Audio calibration related functions */
Eric Laurentb23d5282013-05-14 15:27:20 -070087 void *acdb_handle;
88 acdb_init_t acdb_init;
89 acdb_deallocate_t acdb_deallocate;
90 acdb_send_audio_cal_t acdb_send_audio_cal;
91 acdb_send_voice_cal_t acdb_send_voice_cal;
92
93 /* CSD Client related functions for voice call */
94 void *csd_client;
95 csd_client_init_t csd_client_init;
96 csd_client_deinit_t csd_client_deinit;
97 csd_disable_device_t csd_disable_device;
98 csd_enable_device_t csd_enable_device;
99 csd_volume_t csd_volume;
100 csd_mic_mute_t csd_mic_mute;
101 csd_start_voice_t csd_start_voice;
102 csd_stop_voice_t csd_stop_voice;
103};
104
105static const int pcm_device_table[AUDIO_USECASE_MAX][2] = {
106 [USECASE_AUDIO_PLAYBACK_DEEP_BUFFER] = {0, 0},
107 [USECASE_AUDIO_PLAYBACK_LOW_LATENCY] = {14, 14},
108 [USECASE_AUDIO_PLAYBACK_MULTI_CH] = {1, 1},
109 [USECASE_AUDIO_RECORD] = {0, 0},
110 [USECASE_AUDIO_RECORD_LOW_LATENCY] = {14, 14},
111 [USECASE_VOICE_CALL] = {12, 12},
112};
113
114/* Array to store sound devices */
115static const char * const device_table[SND_DEVICE_MAX] = {
116 [SND_DEVICE_NONE] = "none",
117 /* Playback sound devices */
118 [SND_DEVICE_OUT_HANDSET] = "handset",
119 [SND_DEVICE_OUT_SPEAKER] = "speaker",
120 [SND_DEVICE_OUT_SPEAKER_REVERSE] = "speaker-reverse",
121 [SND_DEVICE_OUT_HEADPHONES] = "headphones",
122 [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = "speaker-and-headphones",
123 [SND_DEVICE_OUT_VOICE_SPEAKER] = "voice-speaker",
124 [SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones",
125 [SND_DEVICE_OUT_HDMI] = "hdmi",
126 [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi",
127 [SND_DEVICE_OUT_BT_SCO] = "bt-sco-headset",
Eric Laurentb23d5282013-05-14 15:27:20 -0700128 [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",
143 [SND_DEVICE_IN_CAMCORDER_MIC] = "camcorder-mic",
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700144 [SND_DEVICE_IN_VOICE_DMIC] = "voice-dmic-ef",
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700145 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC] = "voice-speaker-dmic-ef",
Eric Laurentb23d5282013-05-14 15:27:20 -0700146 [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = "voice-tty-full-headset-mic",
147 [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = "voice-tty-vco-handset-mic",
148 [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = "voice-tty-hco-headset-mic",
149 [SND_DEVICE_IN_VOICE_REC_MIC] = "voice-rec-mic",
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700150 [SND_DEVICE_IN_VOICE_REC_DMIC] = "voice-rec-dmic-ef",
151 [SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE] = "voice-rec-dmic-ef-fluence",
Eric Laurentb23d5282013-05-14 15:27:20 -0700152};
153
154/* ACDB IDs (audio DSP path configuration IDs) for each sound device */
155static const int acdb_device_table[SND_DEVICE_MAX] = {
156 [SND_DEVICE_NONE] = -1,
157 [SND_DEVICE_OUT_HANDSET] = 7,
158 [SND_DEVICE_OUT_SPEAKER] = 14,
159 [SND_DEVICE_OUT_SPEAKER_REVERSE] = 14,
160 [SND_DEVICE_OUT_HEADPHONES] = 10,
161 [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = 10,
162 [SND_DEVICE_OUT_VOICE_SPEAKER] = 14,
163 [SND_DEVICE_OUT_VOICE_HEADPHONES] = 10,
164 [SND_DEVICE_OUT_HDMI] = 18,
165 [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = 14,
166 [SND_DEVICE_OUT_BT_SCO] = 22,
Eric Laurentb23d5282013-05-14 15:27:20 -0700167 [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = 17,
168 [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = 17,
169 [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = 37,
170
171 [SND_DEVICE_IN_HANDSET_MIC] = 4,
172 [SND_DEVICE_IN_SPEAKER_MIC] = 4,
173 [SND_DEVICE_IN_HEADSET_MIC] = 8,
174 [SND_DEVICE_IN_HANDSET_MIC_AEC] = 40,
175 [SND_DEVICE_IN_SPEAKER_MIC_AEC] = 42,
176 [SND_DEVICE_IN_HEADSET_MIC_AEC] = 47,
177 [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = 11,
178 [SND_DEVICE_IN_VOICE_HEADSET_MIC] = 8,
179 [SND_DEVICE_IN_HDMI_MIC] = 4,
180 [SND_DEVICE_IN_BT_SCO_MIC] = 21,
181 [SND_DEVICE_IN_CAMCORDER_MIC] = 61,
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700182 [SND_DEVICE_IN_VOICE_DMIC] = 6,
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700183 [SND_DEVICE_IN_VOICE_SPEAKER_DMIC] = 13,
Eric Laurentb23d5282013-05-14 15:27:20 -0700184 [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = 16,
185 [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = 36,
186 [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = 16,
187 [SND_DEVICE_IN_VOICE_REC_MIC] = 62,
188 /* TODO: Update with proper acdb ids */
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700189 [SND_DEVICE_IN_VOICE_REC_DMIC] = 62,
190 [SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE] = 6,
Eric Laurentb23d5282013-05-14 15:27:20 -0700191};
192
Haynes Mathew George7ff216f2013-09-11 19:51:41 -0700193#define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL)
194#define LOW_LATENCY_PLATFORM_DELAY (13*1000LL)
195
Anish Kumar674837a2014-04-17 12:42:20 -0700196static void set_echo_reference(struct audio_device *adev, bool enable)
Eric Laurentb23d5282013-05-14 15:27:20 -0700197{
Anish Kumar674837a2014-04-17 12:42:20 -0700198 if (enable)
199 audio_route_apply_and_update_path(adev->audio_route, "echo-reference");
200 else
201 audio_route_reset_and_update_path(adev->audio_route, "echo-reference");
Eric Laurentb23d5282013-05-14 15:27:20 -0700202
Anish Kumar674837a2014-04-17 12:42:20 -0700203 ALOGV("Setting EC Reference: %d", enable);
Eric Laurentb23d5282013-05-14 15:27:20 -0700204}
205
206void *platform_init(struct audio_device *adev)
207{
208 char platform[PROPERTY_VALUE_MAX];
209 char baseband[PROPERTY_VALUE_MAX];
210 char value[PROPERTY_VALUE_MAX];
211 struct platform_data *my_data;
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700212 const char *snd_card_name;
Eric Laurentb23d5282013-05-14 15:27:20 -0700213
sangwoo1b9f4b32013-06-21 18:22:55 -0700214 adev->mixer = mixer_open(MIXER_CARD);
215
216 if (!adev->mixer) {
217 ALOGE("Unable to open the mixer, aborting.");
218 return NULL;
219 }
220
221 adev->audio_route = audio_route_init(MIXER_CARD, MIXER_XML_PATH);
222 if (!adev->audio_route) {
223 ALOGE("%s: Failed to init audio route controls, aborting.", __func__);
224 return NULL;
225 }
226
Eric Laurentb23d5282013-05-14 15:27:20 -0700227 my_data = calloc(1, sizeof(struct platform_data));
228
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700229 snd_card_name = mixer_get_name(adev->mixer);
230 my_data->hw_info = hw_info_init(snd_card_name);
231 if (!my_data->hw_info) {
232 ALOGE("%s: Failed to init hardware info", __func__);
233 }
234
Eric Laurentb23d5282013-05-14 15:27:20 -0700235 my_data->adev = adev;
Eric Laurentb23d5282013-05-14 15:27:20 -0700236 my_data->fluence_in_spkr_mode = false;
237 my_data->fluence_in_voice_call = false;
238 my_data->fluence_in_voice_rec = false;
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700239 my_data->fluence_type = FLUENCE_NONE;
Eric Laurentb23d5282013-05-14 15:27:20 -0700240
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700241 property_get("ro.qc.sdk.audio.fluencetype", value, "");
242 if (!strncmp("fluencepro", value, sizeof("fluencepro"))) {
243 my_data->fluence_type = FLUENCE_QUAD_MIC;
244 } else if (!strncmp("fluence", value, sizeof("fluence"))) {
245 my_data->fluence_type = FLUENCE_DUAL_MIC;
246 } else {
247 my_data->fluence_type = FLUENCE_NONE;
Eric Laurentb23d5282013-05-14 15:27:20 -0700248 }
249
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700250 if (my_data->fluence_type != FLUENCE_NONE) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700251 property_get("persist.audio.fluence.voicecall",value,"");
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700252 if (!strncmp("true", value, sizeof("true"))) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700253 my_data->fluence_in_voice_call = true;
254 }
255
256 property_get("persist.audio.fluence.voicerec",value,"");
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700257 if (!strncmp("true", value, sizeof("true"))) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700258 my_data->fluence_in_voice_rec = true;
259 }
260
261 property_get("persist.audio.fluence.speaker",value,"");
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700262 if (!strncmp("true", value, sizeof("true"))) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700263 my_data->fluence_in_spkr_mode = true;
264 }
265 }
266
267 my_data->acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW);
268 if (my_data->acdb_handle == NULL) {
269 ALOGE("%s: DLOPEN failed for %s", __func__, LIB_ACDB_LOADER);
270 } else {
271 ALOGV("%s: DLOPEN successful for %s", __func__, LIB_ACDB_LOADER);
272 my_data->acdb_deallocate = (acdb_deallocate_t)dlsym(my_data->acdb_handle,
273 "acdb_loader_deallocate_ACDB");
274 my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle,
275 "acdb_loader_send_audio_cal");
276 if (!my_data->acdb_send_audio_cal)
277 ALOGW("%s: Could not find the symbol acdb_send_audio_cal from %s",
278 __func__, LIB_ACDB_LOADER);
279 my_data->acdb_send_voice_cal = (acdb_send_voice_cal_t)dlsym(my_data->acdb_handle,
280 "acdb_loader_send_voice_cal");
281 my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle,
282 "acdb_loader_init_ACDB");
283 if (my_data->acdb_init == NULL)
284 ALOGE("%s: dlsym error %s for acdb_loader_init_ACDB", __func__, dlerror());
285 else
286 my_data->acdb_init();
287 }
288
289 /* If platform is Fusion3, load CSD Client specific symbols
290 * Voice call is handled by MDM and apps processor talks to
291 * MDM through CSD Client
292 */
293 property_get("ro.board.platform", platform, "");
294 property_get("ro.baseband", baseband, "");
295 if (!strcmp("msm8960", platform) && !strcmp("mdm", baseband)) {
296 my_data->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW);
297 if (my_data->csd_client == NULL)
298 ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT);
299 }
300
301 if (my_data->csd_client) {
302 ALOGV("%s: DLOPEN successful for %s", __func__, LIB_CSD_CLIENT);
303 my_data->csd_client_deinit = (csd_client_deinit_t)dlsym(my_data->csd_client,
304 "csd_client_deinit");
305 my_data->csd_disable_device = (csd_disable_device_t)dlsym(my_data->csd_client,
306 "csd_client_disable_device");
307 my_data->csd_enable_device = (csd_enable_device_t)dlsym(my_data->csd_client,
308 "csd_client_enable_device");
309 my_data->csd_start_voice = (csd_start_voice_t)dlsym(my_data->csd_client,
310 "csd_client_start_voice");
311 my_data->csd_stop_voice = (csd_stop_voice_t)dlsym(my_data->csd_client,
312 "csd_client_stop_voice");
313 my_data->csd_volume = (csd_volume_t)dlsym(my_data->csd_client,
314 "csd_client_volume");
315 my_data->csd_mic_mute = (csd_mic_mute_t)dlsym(my_data->csd_client,
316 "csd_client_mic_mute");
317 my_data->csd_client_init = (csd_client_init_t)dlsym(my_data->csd_client,
318 "csd_client_init");
319
320 if (my_data->csd_client_init == NULL) {
321 ALOGE("%s: dlsym error %s for csd_client_init", __func__, dlerror());
322 } else {
323 my_data->csd_client_init();
324 }
325 }
326
327 return my_data;
328}
329
330void platform_deinit(void *platform)
331{
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700332 struct platform_data *my_data = (struct platform_data *)platform;
333
334 hw_info_deinit(my_data->hw_info);
Eric Laurentb23d5282013-05-14 15:27:20 -0700335 free(platform);
336}
337
338const char *platform_get_snd_device_name(snd_device_t snd_device)
339{
340 if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX)
341 return device_table[snd_device];
342 else
343 return "";
344}
345
Ravi Kumar Alamanda48c921d2013-10-29 06:07:44 -0700346int platform_get_snd_device_name_extn(void *platform, snd_device_t snd_device,
347 char *device_name)
348{
349 struct platform_data *my_data = (struct platform_data *)platform;
350
351 if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX) {
352 strlcpy(device_name, device_table[snd_device], DEVICE_NAME_MAX_SIZE);
353 hw_info_append_hw_type(my_data->hw_info, snd_device, device_name);
354 } else {
355 strlcpy(device_name, "", DEVICE_NAME_MAX_SIZE);
356 return -EINVAL;
357 }
358
359 return 0;
360}
361
Eric Laurentb23d5282013-05-14 15:27:20 -0700362void platform_add_backend_name(char *mixer_path, snd_device_t snd_device)
363{
364 if (snd_device == SND_DEVICE_IN_BT_SCO_MIC)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700365 strlcat(mixer_path, " bt-sco", MIXER_PATH_MAX_LENGTH);
366 else if (snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB)
367 strlcat(mixer_path, " bt-sco-wb", MIXER_PATH_MAX_LENGTH);
Eric Laurentb23d5282013-05-14 15:27:20 -0700368 else if(snd_device == SND_DEVICE_OUT_BT_SCO)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700369 strlcat(mixer_path, " bt-sco", MIXER_PATH_MAX_LENGTH);
370 else if(snd_device == SND_DEVICE_OUT_BT_SCO_WB)
371 strlcat(mixer_path, " bt-sco-wb", MIXER_PATH_MAX_LENGTH);
Eric Laurentb23d5282013-05-14 15:27:20 -0700372 else if (snd_device == SND_DEVICE_OUT_HDMI)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700373 strlcat(mixer_path, " hdmi", MIXER_PATH_MAX_LENGTH);
Eric Laurentb23d5282013-05-14 15:27:20 -0700374 else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700375 strlcat(mixer_path, " speaker-and-hdmi", MIXER_PATH_MAX_LENGTH);
Eric Laurentb23d5282013-05-14 15:27:20 -0700376}
377
378int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type)
379{
380 int device_id;
381 if (device_type == PCM_PLAYBACK)
382 device_id = pcm_device_table[usecase][0];
383 else
384 device_id = pcm_device_table[usecase][1];
385 return device_id;
386}
387
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530388int platform_set_snd_device_acdb_id(snd_device_t snd_device __unused,
389 unsigned int acdb_id __unused)
Ben Rombergera1673712014-01-10 13:49:02 -0800390{
391 return -ENODEV;
392}
393
Eric Laurentb23d5282013-05-14 15:27:20 -0700394int platform_send_audio_calibration(void *platform, snd_device_t snd_device)
395{
396 struct platform_data *my_data = (struct platform_data *)platform;
397 int acdb_dev_id, acdb_dev_type;
398
399 acdb_dev_id = acdb_device_table[snd_device];
400 if (acdb_dev_id < 0) {
401 ALOGE("%s: Could not find acdb id for device(%d)",
402 __func__, snd_device);
403 return -EINVAL;
404 }
405 if (my_data->acdb_send_audio_cal) {
Eric Laurent994a6932013-07-17 11:51:42 -0700406 ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)",
Eric Laurentb23d5282013-05-14 15:27:20 -0700407 __func__, snd_device, acdb_dev_id);
408 if (snd_device >= SND_DEVICE_OUT_BEGIN &&
409 snd_device < SND_DEVICE_OUT_END)
410 acdb_dev_type = ACDB_DEV_TYPE_OUT;
411 else
412 acdb_dev_type = ACDB_DEV_TYPE_IN;
413 my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type);
414 }
415 return 0;
416}
417
418int platform_switch_voice_call_device_pre(void *platform)
419{
420 struct platform_data *my_data = (struct platform_data *)platform;
421 int ret = 0;
422
423 if (my_data->csd_client != NULL) {
424 /* This must be called before disabling the mixer controls on APQ side */
425 if (my_data->csd_disable_device == NULL) {
426 ALOGE("%s: dlsym error for csd_disable_device", __func__);
427 } else {
428 ret = my_data->csd_disable_device();
429 if (ret < 0) {
430 ALOGE("%s: csd_client_disable_device, failed, error %d",
431 __func__, ret);
432 }
433 }
434 }
435 return ret;
436}
437
438int platform_switch_voice_call_device_post(void *platform,
439 snd_device_t out_snd_device,
440 snd_device_t in_snd_device)
441{
442 struct platform_data *my_data = (struct platform_data *)platform;
443 int acdb_rx_id, acdb_tx_id;
444 int ret = 0;
445
446 if (my_data->csd_client) {
447 if (my_data->csd_enable_device == NULL) {
448 ALOGE("%s: dlsym error for csd_enable_device",
449 __func__);
450 } else {
451 acdb_rx_id = acdb_device_table[out_snd_device];
452 acdb_tx_id = acdb_device_table[in_snd_device];
453
454 if (acdb_rx_id > 0 || acdb_tx_id > 0) {
455 ret = my_data->csd_enable_device(acdb_rx_id, acdb_tx_id,
456 my_data->adev->acdb_settings);
457 if (ret < 0) {
458 ALOGE("%s: csd_enable_device, failed, error %d",
459 __func__, ret);
460 }
461 } else {
462 ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__,
463 acdb_rx_id, acdb_tx_id);
464 }
465 }
466 }
467
468 return ret;
469}
470
471int platform_start_voice_call(void *platform)
472{
473 struct platform_data *my_data = (struct platform_data *)platform;
474 int ret = 0;
475
476 if (my_data->csd_client) {
477 if (my_data->csd_start_voice == NULL) {
478 ALOGE("dlsym error for csd_client_start_voice");
479 ret = -ENOSYS;
480 } else {
481 ret = my_data->csd_start_voice();
482 if (ret < 0) {
483 ALOGE("%s: csd_start_voice error %d\n", __func__, ret);
484 }
485 }
486 }
487
488 return ret;
489}
490
491int platform_stop_voice_call(void *platform)
492{
493 struct platform_data *my_data = (struct platform_data *)platform;
494 int ret = 0;
495
496 if (my_data->csd_client) {
497 if (my_data->csd_stop_voice == NULL) {
498 ALOGE("dlsym error for csd_stop_voice");
499 } else {
500 ret = my_data->csd_stop_voice();
501 if (ret < 0) {
502 ALOGE("%s: csd_stop_voice error %d\n", __func__, ret);
503 }
504 }
505 }
506
507 return ret;
508}
509
510int platform_set_voice_volume(void *platform, int volume)
511{
512 struct platform_data *my_data = (struct platform_data *)platform;
513 int ret = 0;
514
515 if (my_data->csd_client) {
516 if (my_data->csd_volume == NULL) {
517 ALOGE("%s: dlsym error for csd_volume", __func__);
518 } else {
519 ret = my_data->csd_volume(volume);
520 if (ret < 0) {
521 ALOGE("%s: csd_volume error %d", __func__, ret);
522 }
523 }
524 } else {
525 ALOGE("%s: No CSD Client present", __func__);
526 }
527
528 return ret;
529}
530
531int platform_set_mic_mute(void *platform, bool state)
532{
533 struct platform_data *my_data = (struct platform_data *)platform;
534 int ret = 0;
535
536 if (my_data->adev->mode == AUDIO_MODE_IN_CALL) {
537 if (my_data->csd_client) {
538 if (my_data->csd_mic_mute == NULL) {
539 ALOGE("%s: dlsym error for csd_mic_mute", __func__);
540 } else {
541 ret = my_data->csd_mic_mute(state);
542 if (ret < 0) {
543 ALOGE("%s: csd_mic_mute error %d", __func__, ret);
544 }
545 }
546 } else {
547 ALOGE("%s: No CSD Client present", __func__);
548 }
549 }
550
551 return ret;
552}
553
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530554int platform_set_device_mute(void *platform __unused, bool state __unused,
555 char *dir __unused)
Shiv Maliyappanahalli575c1552014-03-07 15:31:55 -0800556{
557 LOGE("%s: Not implemented", __func__);
558 return -ENOSYS;
559}
560
Eric Laurentb23d5282013-05-14 15:27:20 -0700561snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices)
562{
563 struct platform_data *my_data = (struct platform_data *)platform;
564 struct audio_device *adev = my_data->adev;
565 audio_mode_t mode = adev->mode;
566 snd_device_t snd_device = SND_DEVICE_NONE;
567
568 ALOGV("%s: enter: output devices(%#x)", __func__, devices);
569 if (devices == AUDIO_DEVICE_NONE ||
570 devices & AUDIO_DEVICE_BIT_IN) {
571 ALOGV("%s: Invalid output devices (%#x)", __func__, devices);
572 goto exit;
573 }
574
575 if (mode == AUDIO_MODE_IN_CALL) {
576 if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
577 devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
578 if (adev->tty_mode == TTY_MODE_FULL)
579 snd_device = SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES;
580 else if (adev->tty_mode == TTY_MODE_VCO)
581 snd_device = SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES;
582 else if (adev->tty_mode == TTY_MODE_HCO)
583 snd_device = SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET;
584 else
585 snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES;
586 } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
587 snd_device = SND_DEVICE_OUT_BT_SCO;
588 } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
589 snd_device = SND_DEVICE_OUT_VOICE_SPEAKER;
590 } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
Ravi Kumar Alamandaceb40822013-11-06 11:01:47 -0800591 snd_device = SND_DEVICE_OUT_HANDSET;
Eric Laurentb23d5282013-05-14 15:27:20 -0700592 }
593 if (snd_device != SND_DEVICE_NONE) {
594 goto exit;
595 }
596 }
597
598 if (popcount(devices) == 2) {
599 if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE |
600 AUDIO_DEVICE_OUT_SPEAKER)) {
601 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
602 } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET |
603 AUDIO_DEVICE_OUT_SPEAKER)) {
604 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES;
605 } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL |
606 AUDIO_DEVICE_OUT_SPEAKER)) {
607 snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI;
608 } else {
609 ALOGE("%s: Invalid combo device(%#x)", __func__, devices);
610 goto exit;
611 }
612 if (snd_device != SND_DEVICE_NONE) {
613 goto exit;
614 }
615 }
616
617 if (popcount(devices) != 1) {
618 ALOGE("%s: Invalid output devices(%#x)", __func__, devices);
619 goto exit;
620 }
621
622 if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
623 devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
624 snd_device = SND_DEVICE_OUT_HEADPHONES;
625 } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) {
626 if (adev->speaker_lr_swap)
627 snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE;
628 else
629 snd_device = SND_DEVICE_OUT_SPEAKER;
630 } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) {
631 snd_device = SND_DEVICE_OUT_BT_SCO;
632 } else if (devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
633 snd_device = SND_DEVICE_OUT_HDMI ;
634 } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) {
635 snd_device = SND_DEVICE_OUT_HANDSET;
636 } else {
637 ALOGE("%s: Unknown device(s) %#x", __func__, devices);
638 }
639exit:
640 ALOGV("%s: exit: snd_device(%s)", __func__, device_table[snd_device]);
641 return snd_device;
642}
643
644snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_device)
645{
646 struct platform_data *my_data = (struct platform_data *)platform;
647 struct audio_device *adev = my_data->adev;
648 audio_source_t source = (adev->active_input == NULL) ?
649 AUDIO_SOURCE_DEFAULT : adev->active_input->source;
650
651 audio_mode_t mode = adev->mode;
652 audio_devices_t in_device = ((adev->active_input == NULL) ?
653 AUDIO_DEVICE_NONE : adev->active_input->device)
654 & ~AUDIO_DEVICE_BIT_IN;
655 audio_channel_mask_t channel_mask = (adev->active_input == NULL) ?
656 AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask;
657 snd_device_t snd_device = SND_DEVICE_NONE;
658
659 ALOGV("%s: enter: out_device(%#x) in_device(%#x)",
660 __func__, out_device, in_device);
661 if (mode == AUDIO_MODE_IN_CALL) {
662 if (out_device == AUDIO_DEVICE_NONE) {
663 ALOGE("%s: No output device set for voice call", __func__);
664 goto exit;
665 }
666 if (adev->tty_mode != TTY_MODE_OFF) {
667 if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE ||
668 out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
669 switch (adev->tty_mode) {
670 case TTY_MODE_FULL:
671 snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC;
672 break;
673 case TTY_MODE_VCO:
674 snd_device = SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC;
675 break;
676 case TTY_MODE_HCO:
677 snd_device = SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC;
678 break;
679 default:
680 ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->tty_mode);
681 }
682 goto exit;
683 }
684 }
685 if (out_device & AUDIO_DEVICE_OUT_EARPIECE ||
686 out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700687 if (my_data->fluence_type == FLUENCE_NONE ||
688 my_data->fluence_in_voice_call == false) {
Eric Laurentb23d5282013-05-14 15:27:20 -0700689 snd_device = SND_DEVICE_IN_HANDSET_MIC;
690 } else {
Ravi Kumar Alamandaceb40822013-11-06 11:01:47 -0800691 snd_device = SND_DEVICE_IN_VOICE_DMIC;
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700692 adev->acdb_settings |= DMIC_FLAG;
Eric Laurentb23d5282013-05-14 15:27:20 -0700693 }
694 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
695 snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC;
696 } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) {
697 snd_device = SND_DEVICE_IN_BT_SCO_MIC ;
698 } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700699 if (my_data->fluence_type != FLUENCE_NONE &&
700 my_data->fluence_in_voice_call &&
701 my_data->fluence_in_spkr_mode) {
702 if(my_data->fluence_type == FLUENCE_DUAL_MIC) {
703 adev->acdb_settings |= DMIC_FLAG;
704 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC;
705 } else {
706 adev->acdb_settings |= QMIC_FLAG;
707 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_QMIC;
708 }
Eric Laurentb23d5282013-05-14 15:27:20 -0700709 } else {
710 snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
711 }
712 }
713 } else if (source == AUDIO_SOURCE_CAMCORDER) {
714 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC ||
715 in_device & AUDIO_DEVICE_IN_BACK_MIC) {
716 snd_device = SND_DEVICE_IN_CAMCORDER_MIC;
717 }
718 } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) {
719 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700720 if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK)
721 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC;
722 else if (my_data->fluence_in_voice_rec)
723 snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE;
Eric Laurentb23d5282013-05-14 15:27:20 -0700724
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700725 if (snd_device == SND_DEVICE_NONE)
Eric Laurentb23d5282013-05-14 15:27:20 -0700726 snd_device = SND_DEVICE_IN_VOICE_REC_MIC;
Mingming Yin8e5a4f62013-10-07 15:23:41 -0700727 else
728 adev->acdb_settings |= DMIC_FLAG;
Eric Laurentb23d5282013-05-14 15:27:20 -0700729 }
730 } else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION) {
731 if (out_device & AUDIO_DEVICE_OUT_SPEAKER)
732 in_device = AUDIO_DEVICE_IN_BACK_MIC;
733 if (adev->active_input) {
734 if (adev->active_input->enable_aec) {
735 if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
736 snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC;
737 } else if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
738 snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC;
739 } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) {
740 snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC;
741 }
Anish Kumar674837a2014-04-17 12:42:20 -0700742 set_echo_reference(adev, true);
Eric Laurentb23d5282013-05-14 15:27:20 -0700743 } else
Anish Kumar674837a2014-04-17 12:42:20 -0700744 set_echo_reference(adev, false);
Eric Laurentb23d5282013-05-14 15:27:20 -0700745 }
746 } else if (source == AUDIO_SOURCE_DEFAULT) {
747 goto exit;
748 }
749
750
751 if (snd_device != SND_DEVICE_NONE) {
752 goto exit;
753 }
754
755 if (in_device != AUDIO_DEVICE_NONE &&
756 !(in_device & AUDIO_DEVICE_IN_VOICE_CALL) &&
757 !(in_device & AUDIO_DEVICE_IN_COMMUNICATION)) {
758 if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) {
759 snd_device = SND_DEVICE_IN_HANDSET_MIC;
760 } else if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
761 snd_device = SND_DEVICE_IN_SPEAKER_MIC;
762 } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) {
763 snd_device = SND_DEVICE_IN_HEADSET_MIC;
764 } else if (in_device & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) {
765 snd_device = SND_DEVICE_IN_BT_SCO_MIC ;
766 } else if (in_device & AUDIO_DEVICE_IN_AUX_DIGITAL) {
767 snd_device = SND_DEVICE_IN_HDMI_MIC;
768 } else {
769 ALOGE("%s: Unknown input device(s) %#x", __func__, in_device);
770 ALOGW("%s: Using default handset-mic", __func__);
771 snd_device = SND_DEVICE_IN_HANDSET_MIC;
772 }
773 } else {
774 if (out_device & AUDIO_DEVICE_OUT_EARPIECE) {
775 snd_device = SND_DEVICE_IN_HANDSET_MIC;
776 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) {
777 snd_device = SND_DEVICE_IN_HEADSET_MIC;
778 } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) {
779 snd_device = SND_DEVICE_IN_SPEAKER_MIC;
780 } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) {
781 snd_device = SND_DEVICE_IN_HANDSET_MIC;
782 } else if (out_device & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) {
783 snd_device = SND_DEVICE_IN_BT_SCO_MIC;
784 } else if (out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
785 snd_device = SND_DEVICE_IN_HDMI_MIC;
786 } else {
787 ALOGE("%s: Unknown output device(s) %#x", __func__, out_device);
788 ALOGW("%s: Using default handset-mic", __func__);
789 snd_device = SND_DEVICE_IN_HANDSET_MIC;
790 }
791 }
792exit:
793 ALOGV("%s: exit: in_snd_device(%s)", __func__, device_table[snd_device]);
794 return snd_device;
795}
796
797int platform_set_hdmi_channels(void *platform, int channel_count)
798{
799 struct platform_data *my_data = (struct platform_data *)platform;
800 struct audio_device *adev = my_data->adev;
801 struct mixer_ctl *ctl;
802 const char *channel_cnt_str = NULL;
803 const char *mixer_ctl_name = "HDMI_RX Channels";
804 switch (channel_count) {
805 case 8:
806 channel_cnt_str = "Eight"; break;
807 case 7:
808 channel_cnt_str = "Seven"; break;
809 case 6:
810 channel_cnt_str = "Six"; break;
811 case 5:
812 channel_cnt_str = "Five"; break;
813 case 4:
814 channel_cnt_str = "Four"; break;
815 case 3:
816 channel_cnt_str = "Three"; break;
817 default:
818 channel_cnt_str = "Two"; break;
819 }
820 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
821 if (!ctl) {
822 ALOGE("%s: Could not get ctl for mixer cmd - %s",
823 __func__, mixer_ctl_name);
824 return -EINVAL;
825 }
826 ALOGV("HDMI channel count: %s", channel_cnt_str);
827 mixer_ctl_set_enum_by_string(ctl, channel_cnt_str);
828 return 0;
829}
830
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530831int platform_edid_get_max_channels(void *platform __unused)
Eric Laurentb23d5282013-05-14 15:27:20 -0700832{
833 FILE *file;
834 struct audio_block_header header;
835 char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE];
836 char *sad = block;
837 int num_audio_blocks;
838 int channel_count;
839 int max_channels = 0;
840 int i;
841
842 file = fopen(AUDIO_DATA_BLOCK_PATH, "rb");
843 if (file == NULL) {
844 ALOGE("Unable to open '%s'", AUDIO_DATA_BLOCK_PATH);
845 return 0;
846 }
847
848 /* Read audio block header */
849 fread(&header, 1, sizeof(header), file);
850
851 /* Read SAD blocks, clamping the maximum size for safety */
852 if (header.length > (int)sizeof(block))
853 header.length = (int)sizeof(block);
854 fread(&block, header.length, 1, file);
855
856 fclose(file);
857
858 /* Calculate the number of SAD blocks */
859 num_audio_blocks = header.length / SAD_BLOCK_SIZE;
860
861 for (i = 0; i < num_audio_blocks; i++) {
862 /* Only consider LPCM blocks */
863 if ((sad[0] >> 3) != EDID_FORMAT_LPCM)
864 continue;
865
866 channel_count = (sad[0] & 0x7) + 1;
867 if (channel_count > max_channels)
868 max_channels = channel_count;
869
870 /* Advance to next block */
871 sad += 3;
872 }
873
874 return max_channels;
875}
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700876
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530877void platform_get_parameters(void *platform __unused,
878 struct str_parms *query __unused,
879 struct str_parms *reply __unused)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700880{
881 LOGE("%s: Not implemented", __func__);
882}
883
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530884int platform_set_parameters(void *platform __unused,
885 struct str_parms *parms __unused)
Shiv Maliyappanahalli34b585f2013-10-01 15:49:05 -0700886{
887 LOGE("%s: Not implemented", __func__);
888 return -ENOSYS;
889}
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700890
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530891int platform_set_incall_recoding_session_id(void *platform __unused,
892 uint32_t session_id __unused)
Shiv Maliyappanahallida107642013-10-17 11:16:13 -0700893{
894 LOGE("%s: Not implemented", __func__);
895 return -ENOSYS;
896}
Shruthi Krishnaace10852013-10-25 14:32:12 -0700897
Haynes Mathew George7ff216f2013-09-11 19:51:41 -0700898/* Delay in Us */
899int64_t platform_render_latency(audio_usecase_t usecase)
900{
901 switch (usecase) {
902 case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER:
903 return DEEP_BUFFER_PLATFORM_DELAY;
904 case USECASE_AUDIO_PLAYBACK_LOW_LATENCY:
905 return LOW_LATENCY_PLATFORM_DELAY;
906 default:
907 return 0;
908 }
909}
Mingming Yine62d7842013-10-25 16:26:03 -0700910
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530911int platform_update_usecase_from_source(int source __unused,
912 int usecase __unused)
Mingming Yine62d7842013-10-25 16:26:03 -0700913{
914 ALOGV("%s: input source :%d", __func__, source);
915 return usecase;
916}
Kiran Kandide144c82013-11-20 15:58:32 -0800917
Divya Narayanan Poojarybd9f33f2014-09-17 17:35:59 +0530918bool platform_listen_update_status(snd_device_t snd_device __unused)
Kiran Kandide144c82013-11-20 15:58:32 -0800919{
920 return false;
921}