Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 1 | /* |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 2 | * Copyright (C) 2013-2014 The Android Open Source Project |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 3 | * |
| 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> |
Haynes Mathew George | e6e2d44 | 2018-02-22 18:51:56 -0800 | [diff] [blame] | 23 | #include <log/log.h> |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 24 | #include <cutils/properties.h> |
| 25 | #include <audio_hw.h> |
| 26 | #include <platform_api.h> |
| 27 | #include "platform.h" |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 28 | #include "audio_extn.h" |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 29 | |
| 30 | #define LIB_ACDB_LOADER "libacdbloader.so" |
| 31 | #define LIB_CSD_CLIENT "libcsd-client.so" |
| 32 | |
| 33 | #define DUALMIC_CONFIG_NONE 0 /* Target does not contain 2 mics */ |
| 34 | #define DUALMIC_CONFIG_ENDFIRE 1 |
| 35 | #define DUALMIC_CONFIG_BROADSIDE 2 |
| 36 | |
| 37 | /* |
| 38 | * This is the sysfs path for the HDMI audio data block |
| 39 | */ |
| 40 | #define AUDIO_DATA_BLOCK_PATH "/sys/class/graphics/fb1/audio_data_block" |
Artem Borisov | 6890961 | 2017-12-02 20:19:25 +0300 | [diff] [blame] | 41 | #define MIXER_XML_PATH "mixer_paths.xml" |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 42 | |
| 43 | /* |
| 44 | * This file will have a maximum of 38 bytes: |
| 45 | * |
| 46 | * 4 bytes: number of audio blocks |
| 47 | * 4 bytes: total length of Short Audio Descriptor (SAD) blocks |
| 48 | * Maximum 10 * 3 bytes: SAD blocks |
| 49 | */ |
| 50 | #define MAX_SAD_BLOCKS 10 |
| 51 | #define SAD_BLOCK_SIZE 3 |
| 52 | |
| 53 | /* EDID format ID for LPCM audio */ |
| 54 | #define EDID_FORMAT_LPCM 1 |
| 55 | |
| 56 | struct audio_block_header |
| 57 | { |
| 58 | int reserved; |
| 59 | int length; |
| 60 | }; |
| 61 | |
| 62 | |
| 63 | typedef void (*acdb_deallocate_t)(); |
| 64 | typedef int (*acdb_init_t)(); |
| 65 | typedef void (*acdb_send_audio_cal_t)(int, int); |
| 66 | typedef void (*acdb_send_voice_cal_t)(int, int); |
| 67 | |
| 68 | typedef int (*csd_client_init_t)(); |
| 69 | typedef int (*csd_client_deinit_t)(); |
| 70 | typedef int (*csd_disable_device_t)(); |
| 71 | typedef int (*csd_enable_device_t)(int, int, uint32_t); |
| 72 | typedef int (*csd_volume_t)(int); |
| 73 | typedef int (*csd_mic_mute_t)(int); |
| 74 | typedef int (*csd_start_voice_t)(); |
| 75 | typedef int (*csd_stop_voice_t)(); |
| 76 | |
| 77 | |
| 78 | /* Audio calibration related functions */ |
| 79 | struct platform_data { |
| 80 | struct audio_device *adev; |
| 81 | bool fluence_in_spkr_mode; |
| 82 | bool fluence_in_voice_call; |
| 83 | bool fluence_in_voice_rec; |
| 84 | int dualmic_config; |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 85 | bool speaker_lr_swap; |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 86 | |
| 87 | 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 | |
| 105 | static 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}, |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 108 | [USECASE_AUDIO_PLAYBACK_HIFI] = {1, 1}, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 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 */ |
| 115 | static 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", |
David Lin | fb3c995 | 2018-01-19 14:57:43 -0800 | [diff] [blame] | 121 | [SND_DEVICE_OUT_SPEAKER_SAFE] = "speaker-safe", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 122 | [SND_DEVICE_OUT_HEADPHONES] = "headphones", |
| 123 | [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = "speaker-and-headphones", |
| 124 | [SND_DEVICE_OUT_VOICE_SPEAKER] = "voice-speaker", |
| 125 | [SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones", |
yixuanjiang | 9536e67 | 2018-09-06 18:43:36 +0800 | [diff] [blame] | 126 | [SND_DEVICE_OUT_VOICE_HEADSET] = "voice-headphones", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 127 | [SND_DEVICE_OUT_HDMI] = "hdmi", |
| 128 | [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi", |
| 129 | [SND_DEVICE_OUT_BT_SCO] = "bt-sco-headset", |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 130 | [SND_DEVICE_OUT_BT_SCO_WB] = "bt-sco-headset-wb", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 131 | [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = "voice-handset-tmus", |
Eric Laurent | 788f41f | 2015-08-24 12:21:50 -0700 | [diff] [blame] | 132 | [SND_DEVICE_OUT_VOICE_HANDSET] = "voice-handset-tmus", |
| 133 | [SND_DEVICE_OUT_VOICE_HAC_HANDSET] = "voice-handset-tmus", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 134 | [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = "voice-tty-full-headphones", |
| 135 | [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = "voice-tty-vco-headphones", |
| 136 | [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = "voice-tty-hco-handset", |
voron00 | e1cdfc7 | 2019-03-12 06:06:18 +0300 | [diff] [blame^] | 137 | [SND_DEVICE_OUT_VOICE_MUSIC_TX] = "voice-music-tx", |
Eric Laurent | b1b0799 | 2017-06-29 09:20:02 -0700 | [diff] [blame] | 138 | [SND_DEVICE_OUT_USB_HEADSET] = "usb-headset", |
| 139 | [SND_DEVICE_OUT_USB_HEADPHONES] = "usb-headphones", |
| 140 | [SND_DEVICE_OUT_VOICE_USB_HEADSET] = "usb-headset", |
| 141 | [SND_DEVICE_OUT_VOICE_USB_HEADPHONES] = "usb-headphones", |
| 142 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 143 | |
| 144 | /* Capture sound devices */ |
| 145 | [SND_DEVICE_IN_HANDSET_MIC] = "handset-mic", |
| 146 | [SND_DEVICE_IN_SPEAKER_MIC] = "speaker-mic", |
| 147 | [SND_DEVICE_IN_HEADSET_MIC] = "headset-mic", |
| 148 | [SND_DEVICE_IN_HANDSET_MIC_AEC] = "handset-mic", |
| 149 | [SND_DEVICE_IN_SPEAKER_MIC_AEC] = "voice-speaker-mic", |
| 150 | [SND_DEVICE_IN_HEADSET_MIC_AEC] = "headset-mic", |
| 151 | [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = "voice-speaker-mic", |
| 152 | [SND_DEVICE_IN_VOICE_HEADSET_MIC] = "voice-headset-mic", |
| 153 | [SND_DEVICE_IN_HDMI_MIC] = "hdmi-mic", |
| 154 | [SND_DEVICE_IN_BT_SCO_MIC] = "bt-sco-mic", |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 155 | [SND_DEVICE_IN_BT_SCO_MIC_WB] = "bt-sco-mic-wb", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 156 | [SND_DEVICE_IN_CAMCORDER_MIC] = "camcorder-mic", |
| 157 | [SND_DEVICE_IN_VOICE_DMIC_EF] = "voice-dmic-ef", |
| 158 | [SND_DEVICE_IN_VOICE_DMIC_BS] = "voice-dmic-bs", |
| 159 | [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = "voice-dmic-ef-tmus", |
| 160 | [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = "voice-speaker-dmic-ef", |
| 161 | [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = "voice-speaker-dmic-bs", |
| 162 | [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = "voice-tty-full-headset-mic", |
| 163 | [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = "voice-tty-vco-handset-mic", |
| 164 | [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = "voice-tty-hco-headset-mic", |
| 165 | [SND_DEVICE_IN_VOICE_REC_MIC] = "voice-rec-mic", |
| 166 | [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = "voice-rec-dmic-ef", |
| 167 | [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = "voice-rec-dmic-bs", |
| 168 | [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = "voice-rec-dmic-ef-fluence", |
| 169 | [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = "voice-rec-dmic-bs-fluence", |
| 170 | }; |
| 171 | |
| 172 | /* ACDB IDs (audio DSP path configuration IDs) for each sound device */ |
| 173 | static const int acdb_device_table[SND_DEVICE_MAX] = { |
| 174 | [SND_DEVICE_NONE] = -1, |
| 175 | [SND_DEVICE_OUT_HANDSET] = 7, |
| 176 | [SND_DEVICE_OUT_SPEAKER] = 14, |
| 177 | [SND_DEVICE_OUT_SPEAKER_REVERSE] = 14, |
David Lin | fb3c995 | 2018-01-19 14:57:43 -0800 | [diff] [blame] | 178 | [SND_DEVICE_OUT_SPEAKER_SAFE] = 14, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 179 | [SND_DEVICE_OUT_HEADPHONES] = 10, |
| 180 | [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = 10, |
| 181 | [SND_DEVICE_OUT_VOICE_SPEAKER] = 14, |
| 182 | [SND_DEVICE_OUT_VOICE_HEADPHONES] = 10, |
yixuanjiang | 9536e67 | 2018-09-06 18:43:36 +0800 | [diff] [blame] | 183 | [SND_DEVICE_OUT_VOICE_HEADSET] = 10, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 184 | [SND_DEVICE_OUT_HDMI] = 18, |
| 185 | [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = 14, |
| 186 | [SND_DEVICE_OUT_BT_SCO] = 22, |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 187 | [SND_DEVICE_OUT_BT_SCO_WB] = 39, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 188 | [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = 81, |
Eric Laurent | 788f41f | 2015-08-24 12:21:50 -0700 | [diff] [blame] | 189 | [SND_DEVICE_OUT_VOICE_HANDSET] = 81, |
| 190 | [SND_DEVICE_OUT_VOICE_HAC_HANDSET] = 81, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 191 | [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = 17, |
| 192 | [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = 17, |
| 193 | [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = 37, |
voron00 | e1cdfc7 | 2019-03-12 06:06:18 +0300 | [diff] [blame^] | 194 | [SND_DEVICE_OUT_VOICE_MUSIC_TX] = 3, |
Eric Laurent | b1b0799 | 2017-06-29 09:20:02 -0700 | [diff] [blame] | 195 | [SND_DEVICE_OUT_USB_HEADSET] = 45, |
| 196 | [SND_DEVICE_OUT_USB_HEADPHONES] = 45, |
| 197 | [SND_DEVICE_OUT_VOICE_USB_HEADSET] = 45, |
| 198 | [SND_DEVICE_OUT_VOICE_USB_HEADPHONES] = 45, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 199 | |
| 200 | [SND_DEVICE_IN_HANDSET_MIC] = 4, |
| 201 | [SND_DEVICE_IN_SPEAKER_MIC] = 4, |
| 202 | [SND_DEVICE_IN_HEADSET_MIC] = 8, |
| 203 | [SND_DEVICE_IN_HANDSET_MIC_AEC] = 40, |
| 204 | [SND_DEVICE_IN_SPEAKER_MIC_AEC] = 42, |
| 205 | [SND_DEVICE_IN_HEADSET_MIC_AEC] = 47, |
| 206 | [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = 11, |
| 207 | [SND_DEVICE_IN_VOICE_HEADSET_MIC] = 8, |
| 208 | [SND_DEVICE_IN_HDMI_MIC] = 4, |
| 209 | [SND_DEVICE_IN_BT_SCO_MIC] = 21, |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 210 | [SND_DEVICE_IN_BT_SCO_MIC_WB] = 38, |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 211 | [SND_DEVICE_IN_CAMCORDER_MIC] = 61, |
| 212 | [SND_DEVICE_IN_VOICE_DMIC_EF] = 6, |
| 213 | [SND_DEVICE_IN_VOICE_DMIC_BS] = 5, |
| 214 | [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = 91, |
| 215 | [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = 13, |
| 216 | [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = 12, |
| 217 | [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = 16, |
| 218 | [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = 36, |
| 219 | [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = 16, |
| 220 | [SND_DEVICE_IN_VOICE_REC_MIC] = 62, |
| 221 | /* TODO: Update with proper acdb ids */ |
| 222 | [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = 62, |
| 223 | [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = 62, |
| 224 | [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = 6, |
| 225 | [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = 5, |
| 226 | }; |
| 227 | |
Haynes Mathew George | 7ff216f | 2013-09-11 19:51:41 -0700 | [diff] [blame] | 228 | #define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) |
| 229 | #define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) |
| 230 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 231 | static pthread_once_t check_op_once_ctl = PTHREAD_ONCE_INIT; |
| 232 | static bool is_tmus = false; |
| 233 | |
| 234 | static void check_operator() |
| 235 | { |
| 236 | char value[PROPERTY_VALUE_MAX]; |
| 237 | int mccmnc; |
| 238 | property_get("gsm.sim.operator.numeric",value,"0"); |
| 239 | mccmnc = atoi(value); |
| 240 | ALOGD("%s: tmus mccmnc %d", __func__, mccmnc); |
| 241 | switch(mccmnc) { |
| 242 | /* TMUS MCC(310), MNC(490, 260, 026) */ |
| 243 | case 310490: |
| 244 | case 310260: |
| 245 | case 310026: |
| 246 | is_tmus = true; |
| 247 | break; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | bool is_operator_tmus() |
| 252 | { |
| 253 | pthread_once(&check_op_once_ctl, check_operator); |
| 254 | return is_tmus; |
| 255 | } |
| 256 | |
| 257 | static int set_echo_reference(struct mixer *mixer, const char* ec_ref) |
| 258 | { |
| 259 | struct mixer_ctl *ctl; |
| 260 | const char *mixer_ctl_name = "EC_REF_RX"; |
| 261 | |
| 262 | ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name); |
| 263 | if (!ctl) { |
| 264 | ALOGE("%s: Could not get ctl for mixer cmd - %s", |
| 265 | __func__, mixer_ctl_name); |
| 266 | return -EINVAL; |
| 267 | } |
| 268 | ALOGV("Setting EC Reference: %s", ec_ref); |
| 269 | mixer_ctl_set_enum_by_string(ctl, ec_ref); |
| 270 | return 0; |
| 271 | } |
| 272 | |
Artem Borisov | 6890961 | 2017-12-02 20:19:25 +0300 | [diff] [blame] | 273 | // Treblized config files will be located in /odm/etc or /vendor/etc. |
| 274 | static const char *kConfigLocationList[] = |
| 275 | {"/odm/etc", "/vendor/etc", "/system/etc"}; |
| 276 | static const int kConfigLocationListSize = |
| 277 | (sizeof(kConfigLocationList) / sizeof(kConfigLocationList[0])); |
| 278 | |
| 279 | bool resolveConfigFile(char file_name[MIXER_PATH_MAX_LENGTH]) { |
| 280 | char full_config_path[MIXER_PATH_MAX_LENGTH]; |
| 281 | for (int i = 0; i < kConfigLocationListSize; i++) { |
| 282 | snprintf(full_config_path, |
| 283 | MIXER_PATH_MAX_LENGTH, |
| 284 | "%s/%s", |
| 285 | kConfigLocationList[i], |
| 286 | file_name); |
| 287 | if (F_OK == access(full_config_path, 0)) { |
| 288 | strcpy(file_name, full_config_path); |
| 289 | return true; |
| 290 | } |
| 291 | } |
| 292 | return false; |
| 293 | } |
| 294 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 295 | void *platform_init(struct audio_device *adev) |
| 296 | { |
| 297 | char platform[PROPERTY_VALUE_MAX]; |
| 298 | char baseband[PROPERTY_VALUE_MAX]; |
| 299 | char value[PROPERTY_VALUE_MAX]; |
| 300 | struct platform_data *my_data; |
Artem Borisov | 6890961 | 2017-12-02 20:19:25 +0300 | [diff] [blame] | 301 | char mixer_xml_file[MIXER_PATH_MAX_LENGTH] = MIXER_XML_PATH; |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 302 | |
sangwoo | 1b9f4b3 | 2013-06-21 18:22:55 -0700 | [diff] [blame] | 303 | adev->mixer = mixer_open(MIXER_CARD); |
| 304 | |
| 305 | if (!adev->mixer) { |
| 306 | ALOGE("Unable to open the mixer, aborting."); |
| 307 | return NULL; |
| 308 | } |
| 309 | |
Artem Borisov | 6890961 | 2017-12-02 20:19:25 +0300 | [diff] [blame] | 310 | resolveConfigFile(mixer_xml_file); |
| 311 | adev->audio_route = audio_route_init(MIXER_CARD, mixer_xml_file); |
sangwoo | 1b9f4b3 | 2013-06-21 18:22:55 -0700 | [diff] [blame] | 312 | if (!adev->audio_route) { |
| 313 | ALOGE("%s: Failed to init audio route controls, aborting.", __func__); |
| 314 | return NULL; |
| 315 | } |
| 316 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 317 | my_data = calloc(1, sizeof(struct platform_data)); |
| 318 | |
| 319 | my_data->adev = adev; |
| 320 | my_data->dualmic_config = DUALMIC_CONFIG_NONE; |
| 321 | my_data->fluence_in_spkr_mode = false; |
| 322 | my_data->fluence_in_voice_call = false; |
| 323 | my_data->fluence_in_voice_rec = false; |
| 324 | |
| 325 | property_get("persist.audio.dualmic.config",value,""); |
| 326 | if (!strcmp("broadside", value)) { |
| 327 | my_data->dualmic_config = DUALMIC_CONFIG_BROADSIDE; |
| 328 | adev->acdb_settings |= DMIC_FLAG; |
| 329 | } else if (!strcmp("endfire", value)) { |
| 330 | my_data->dualmic_config = DUALMIC_CONFIG_ENDFIRE; |
| 331 | adev->acdb_settings |= DMIC_FLAG; |
| 332 | } |
| 333 | |
| 334 | if (my_data->dualmic_config != DUALMIC_CONFIG_NONE) { |
| 335 | property_get("persist.audio.fluence.voicecall",value,""); |
| 336 | if (!strcmp("true", value)) { |
| 337 | my_data->fluence_in_voice_call = true; |
| 338 | } |
| 339 | |
| 340 | property_get("persist.audio.fluence.voicerec",value,""); |
| 341 | if (!strcmp("true", value)) { |
| 342 | my_data->fluence_in_voice_rec = true; |
| 343 | } |
| 344 | |
| 345 | property_get("persist.audio.fluence.speaker",value,""); |
| 346 | if (!strcmp("true", value)) { |
| 347 | my_data->fluence_in_spkr_mode = true; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | my_data->acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW); |
| 352 | if (my_data->acdb_handle == NULL) { |
| 353 | ALOGE("%s: DLOPEN failed for %s", __func__, LIB_ACDB_LOADER); |
| 354 | } else { |
| 355 | ALOGV("%s: DLOPEN successful for %s", __func__, LIB_ACDB_LOADER); |
| 356 | my_data->acdb_deallocate = (acdb_deallocate_t)dlsym(my_data->acdb_handle, |
| 357 | "acdb_loader_deallocate_ACDB"); |
| 358 | my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, |
| 359 | "acdb_loader_send_audio_cal"); |
| 360 | if (!my_data->acdb_send_audio_cal) |
| 361 | ALOGW("%s: Could not find the symbol acdb_send_audio_cal from %s", |
| 362 | __func__, LIB_ACDB_LOADER); |
| 363 | my_data->acdb_send_voice_cal = (acdb_send_voice_cal_t)dlsym(my_data->acdb_handle, |
| 364 | "acdb_loader_send_voice_cal"); |
| 365 | my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle, |
| 366 | "acdb_loader_init_ACDB"); |
| 367 | if (my_data->acdb_init == NULL) |
| 368 | ALOGE("%s: dlsym error %s for acdb_loader_init_ACDB", __func__, dlerror()); |
| 369 | else |
| 370 | my_data->acdb_init(); |
| 371 | } |
| 372 | |
| 373 | /* If platform is Fusion3, load CSD Client specific symbols |
| 374 | * Voice call is handled by MDM and apps processor talks to |
| 375 | * MDM through CSD Client |
| 376 | */ |
| 377 | property_get("ro.board.platform", platform, ""); |
| 378 | property_get("ro.baseband", baseband, ""); |
| 379 | if (!strcmp("msm8960", platform) && !strcmp("mdm", baseband)) { |
| 380 | my_data->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW); |
| 381 | if (my_data->csd_client == NULL) |
| 382 | ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT); |
| 383 | } |
| 384 | |
| 385 | if (my_data->csd_client) { |
| 386 | ALOGV("%s: DLOPEN successful for %s", __func__, LIB_CSD_CLIENT); |
| 387 | my_data->csd_client_deinit = (csd_client_deinit_t)dlsym(my_data->csd_client, |
| 388 | "csd_client_deinit"); |
| 389 | my_data->csd_disable_device = (csd_disable_device_t)dlsym(my_data->csd_client, |
| 390 | "csd_client_disable_device"); |
| 391 | my_data->csd_enable_device = (csd_enable_device_t)dlsym(my_data->csd_client, |
| 392 | "csd_client_enable_device"); |
| 393 | my_data->csd_start_voice = (csd_start_voice_t)dlsym(my_data->csd_client, |
| 394 | "csd_client_start_voice"); |
| 395 | my_data->csd_stop_voice = (csd_stop_voice_t)dlsym(my_data->csd_client, |
| 396 | "csd_client_stop_voice"); |
| 397 | my_data->csd_volume = (csd_volume_t)dlsym(my_data->csd_client, |
| 398 | "csd_client_volume"); |
| 399 | my_data->csd_mic_mute = (csd_mic_mute_t)dlsym(my_data->csd_client, |
| 400 | "csd_client_mic_mute"); |
| 401 | my_data->csd_client_init = (csd_client_init_t)dlsym(my_data->csd_client, |
| 402 | "csd_client_init"); |
| 403 | |
| 404 | if (my_data->csd_client_init == NULL) { |
| 405 | ALOGE("%s: dlsym error %s for csd_client_init", __func__, dlerror()); |
| 406 | } else { |
| 407 | my_data->csd_client_init(); |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | return my_data; |
| 412 | } |
| 413 | |
| 414 | void platform_deinit(void *platform) |
| 415 | { |
| 416 | free(platform); |
| 417 | } |
| 418 | |
| 419 | const char *platform_get_snd_device_name(snd_device_t snd_device) |
| 420 | { |
| 421 | if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX) |
| 422 | return device_table[snd_device]; |
| 423 | else |
Ravi Kumar Alamanda | 6402646 | 2014-09-15 00:08:58 -0700 | [diff] [blame] | 424 | return "none"; |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 425 | } |
| 426 | |
Ravi Kumar Alamanda | 299760a | 2013-11-01 17:29:09 -0500 | [diff] [blame] | 427 | void platform_add_backend_name(void *platform __unused, char *mixer_path, |
| 428 | snd_device_t snd_device) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 429 | { |
| 430 | if (snd_device == SND_DEVICE_IN_BT_SCO_MIC) |
| 431 | strcat(mixer_path, " bt-sco"); |
| 432 | else if(snd_device == SND_DEVICE_OUT_BT_SCO) |
| 433 | strcat(mixer_path, " bt-sco"); |
| 434 | else if (snd_device == SND_DEVICE_OUT_HDMI) |
| 435 | strcat(mixer_path, " hdmi"); |
| 436 | else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI) |
| 437 | strcat(mixer_path, " speaker-and-hdmi"); |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 438 | else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB || |
| 439 | snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB) |
| 440 | strcat(mixer_path, " bt-sco-wb"); |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | int platform_get_pcm_device_id(audio_usecase_t usecase, int device_type) |
| 444 | { |
| 445 | int device_id; |
| 446 | if (device_type == PCM_PLAYBACK) |
| 447 | device_id = pcm_device_table[usecase][0]; |
| 448 | else |
| 449 | device_id = pcm_device_table[usecase][1]; |
| 450 | return device_id; |
| 451 | } |
| 452 | |
Vignesh Kulothungan | 019d19b | 2019-01-23 11:09:18 -0800 | [diff] [blame] | 453 | int platform_get_haptics_pcm_device_id() |
| 454 | { |
| 455 | return -1; |
| 456 | } |
| 457 | |
Haynes Mathew George | 98c9562 | 2014-06-20 19:14:25 -0700 | [diff] [blame] | 458 | int platform_get_snd_device_index(char *snd_device_index_name __unused) |
Haynes Mathew George | 5bc1884 | 2014-06-16 16:36:20 -0700 | [diff] [blame] | 459 | { |
| 460 | return -ENODEV; |
| 461 | } |
| 462 | |
Haynes Mathew George | 98c9562 | 2014-06-20 19:14:25 -0700 | [diff] [blame] | 463 | int platform_set_snd_device_acdb_id(snd_device_t snd_device __unused, |
| 464 | unsigned int acdb_id __unused) |
Haynes Mathew George | 5bc1884 | 2014-06-16 16:36:20 -0700 | [diff] [blame] | 465 | { |
| 466 | return -ENODEV; |
| 467 | } |
| 468 | |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 469 | int platform_get_default_app_type_v2(void *platform __unused, usecase_type_t type __unused, |
Yamit Mehta | e3b9956 | 2016-09-16 22:44:00 +0530 | [diff] [blame] | 470 | int *app_type __unused) |
| 471 | { |
| 472 | ALOGE("%s: Not implemented", __func__); |
| 473 | return -ENOSYS; |
| 474 | } |
| 475 | |
Ravi Kumar Alamanda | 6386300 | 2015-04-22 11:15:25 -0700 | [diff] [blame] | 476 | int platform_get_snd_device_acdb_id(snd_device_t snd_device __unused) |
| 477 | { |
| 478 | ALOGE("%s: Not implemented", __func__); |
| 479 | return -ENOSYS; |
| 480 | } |
| 481 | |
Carter Hsu | 017c63a | 2018-10-15 15:01:42 -0700 | [diff] [blame] | 482 | void platform_add_external_specific_device(snd_device_t snd_device __unused, |
| 483 | const char *name __unused, |
| 484 | unsigned int acdb_id __unused) |
| 485 | { |
| 486 | return; |
| 487 | } |
| 488 | |
Eric Laurent | 788f41f | 2015-08-24 12:21:50 -0700 | [diff] [blame] | 489 | void platform_add_operator_specific_device(snd_device_t snd_device __unused, |
| 490 | const char *operator __unused, |
| 491 | const char *mixer_path __unused, |
| 492 | unsigned int acdb_id __unused) |
keunhui.park | 2f7306a | 2015-07-16 16:48:06 +0900 | [diff] [blame] | 493 | { |
| 494 | } |
| 495 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 496 | int platform_send_audio_calibration(void *platform, snd_device_t snd_device) |
| 497 | { |
| 498 | struct platform_data *my_data = (struct platform_data *)platform; |
| 499 | int acdb_dev_id, acdb_dev_type; |
| 500 | |
| 501 | acdb_dev_id = acdb_device_table[snd_device]; |
| 502 | if (acdb_dev_id < 0) { |
| 503 | ALOGE("%s: Could not find acdb id for device(%d)", |
| 504 | __func__, snd_device); |
| 505 | return -EINVAL; |
| 506 | } |
| 507 | if (my_data->acdb_send_audio_cal) { |
Eric Laurent | 994a693 | 2013-07-17 11:51:42 -0700 | [diff] [blame] | 508 | ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 509 | __func__, snd_device, acdb_dev_id); |
| 510 | if (snd_device >= SND_DEVICE_OUT_BEGIN && |
| 511 | snd_device < SND_DEVICE_OUT_END) |
| 512 | acdb_dev_type = ACDB_DEV_TYPE_OUT; |
| 513 | else |
| 514 | acdb_dev_type = ACDB_DEV_TYPE_IN; |
| 515 | my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type); |
| 516 | } |
| 517 | return 0; |
| 518 | } |
| 519 | |
| 520 | int platform_switch_voice_call_device_pre(void *platform) |
| 521 | { |
| 522 | struct platform_data *my_data = (struct platform_data *)platform; |
| 523 | int ret = 0; |
| 524 | |
Ravi Kumar Alamanda | b09e4a0 | 2014-10-20 17:07:43 -0700 | [diff] [blame] | 525 | if (my_data->csd_client != NULL && |
| 526 | voice_is_in_call(my_data->adev)) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 527 | /* This must be called before disabling the mixer controls on APQ side */ |
| 528 | if (my_data->csd_disable_device == NULL) { |
| 529 | ALOGE("%s: dlsym error for csd_disable_device", __func__); |
| 530 | } else { |
| 531 | ret = my_data->csd_disable_device(); |
| 532 | if (ret < 0) { |
| 533 | ALOGE("%s: csd_client_disable_device, failed, error %d", |
| 534 | __func__, ret); |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | return ret; |
| 539 | } |
| 540 | |
| 541 | int platform_switch_voice_call_device_post(void *platform, |
| 542 | snd_device_t out_snd_device, |
| 543 | snd_device_t in_snd_device) |
| 544 | { |
| 545 | struct platform_data *my_data = (struct platform_data *)platform; |
| 546 | int acdb_rx_id, acdb_tx_id; |
| 547 | int ret = 0; |
| 548 | |
| 549 | if (my_data->csd_client) { |
| 550 | if (my_data->csd_enable_device == NULL) { |
| 551 | ALOGE("%s: dlsym error for csd_enable_device", |
| 552 | __func__); |
| 553 | } else { |
| 554 | acdb_rx_id = acdb_device_table[out_snd_device]; |
| 555 | acdb_tx_id = acdb_device_table[in_snd_device]; |
| 556 | |
| 557 | if (acdb_rx_id > 0 || acdb_tx_id > 0) { |
| 558 | ret = my_data->csd_enable_device(acdb_rx_id, acdb_tx_id, |
| 559 | my_data->adev->acdb_settings); |
| 560 | if (ret < 0) { |
| 561 | ALOGE("%s: csd_enable_device, failed, error %d", |
| 562 | __func__, ret); |
| 563 | } |
| 564 | } else { |
| 565 | ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__, |
| 566 | acdb_rx_id, acdb_tx_id); |
| 567 | } |
| 568 | } |
| 569 | } |
| 570 | |
| 571 | return ret; |
| 572 | } |
| 573 | |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 574 | int platform_start_voice_call(void *platform, uint32_t vsid __unused) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 575 | { |
| 576 | struct platform_data *my_data = (struct platform_data *)platform; |
| 577 | int ret = 0; |
| 578 | |
| 579 | if (my_data->csd_client) { |
| 580 | if (my_data->csd_start_voice == NULL) { |
| 581 | ALOGE("dlsym error for csd_client_start_voice"); |
| 582 | ret = -ENOSYS; |
| 583 | } else { |
| 584 | ret = my_data->csd_start_voice(); |
| 585 | if (ret < 0) { |
| 586 | ALOGE("%s: csd_start_voice error %d\n", __func__, ret); |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | return ret; |
| 592 | } |
| 593 | |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 594 | int platform_stop_voice_call(void *platform, uint32_t vsid __unused) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 595 | { |
| 596 | struct platform_data *my_data = (struct platform_data *)platform; |
| 597 | int ret = 0; |
| 598 | |
| 599 | if (my_data->csd_client) { |
| 600 | if (my_data->csd_stop_voice == NULL) { |
| 601 | ALOGE("dlsym error for csd_stop_voice"); |
| 602 | } else { |
| 603 | ret = my_data->csd_stop_voice(); |
| 604 | if (ret < 0) { |
| 605 | ALOGE("%s: csd_stop_voice error %d\n", __func__, ret); |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | return ret; |
| 611 | } |
| 612 | |
vivek mehta | b650641 | 2015-08-07 16:55:17 -0700 | [diff] [blame] | 613 | void platform_set_speaker_gain_in_combo(struct audio_device *adev __unused, |
Eric Laurent | 788f41f | 2015-08-24 12:21:50 -0700 | [diff] [blame] | 614 | snd_device_t snd_device __unused, |
vivek mehta | b650641 | 2015-08-07 16:55:17 -0700 | [diff] [blame] | 615 | bool enable __unused) { |
| 616 | } |
| 617 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 618 | int platform_set_voice_volume(void *platform, int volume) |
| 619 | { |
| 620 | struct platform_data *my_data = (struct platform_data *)platform; |
| 621 | int ret = 0; |
| 622 | |
| 623 | if (my_data->csd_client) { |
| 624 | if (my_data->csd_volume == NULL) { |
| 625 | ALOGE("%s: dlsym error for csd_volume", __func__); |
| 626 | } else { |
| 627 | ret = my_data->csd_volume(volume); |
| 628 | if (ret < 0) { |
| 629 | ALOGE("%s: csd_volume error %d", __func__, ret); |
| 630 | } |
| 631 | } |
| 632 | } else { |
| 633 | ALOGE("%s: No CSD Client present", __func__); |
| 634 | } |
| 635 | |
| 636 | return ret; |
| 637 | } |
| 638 | |
| 639 | int platform_set_mic_mute(void *platform, bool state) |
| 640 | { |
| 641 | struct platform_data *my_data = (struct platform_data *)platform; |
| 642 | int ret = 0; |
| 643 | |
| 644 | if (my_data->adev->mode == AUDIO_MODE_IN_CALL) { |
| 645 | if (my_data->csd_client) { |
| 646 | if (my_data->csd_mic_mute == NULL) { |
| 647 | ALOGE("%s: dlsym error for csd_mic_mute", __func__); |
| 648 | } else { |
| 649 | ret = my_data->csd_mic_mute(state); |
| 650 | if (ret < 0) { |
| 651 | ALOGE("%s: csd_mic_mute error %d", __func__, ret); |
| 652 | } |
| 653 | } |
| 654 | } else { |
| 655 | ALOGE("%s: No CSD Client present", __func__); |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | return ret; |
| 660 | } |
| 661 | |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 662 | int platform_set_device_mute(void *platform __unused, bool state __unused, char *dir __unused) |
| 663 | { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 664 | ALOGE("%s: Not implemented", __func__); |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 665 | return -ENOSYS; |
| 666 | } |
| 667 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 668 | snd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices) |
| 669 | { |
| 670 | struct platform_data *my_data = (struct platform_data *)platform; |
| 671 | struct audio_device *adev = my_data->adev; |
| 672 | audio_mode_t mode = adev->mode; |
| 673 | snd_device_t snd_device = SND_DEVICE_NONE; |
| 674 | |
| 675 | ALOGV("%s: enter: output devices(%#x)", __func__, devices); |
| 676 | if (devices == AUDIO_DEVICE_NONE || |
| 677 | devices & AUDIO_DEVICE_BIT_IN) { |
| 678 | ALOGV("%s: Invalid output devices (%#x)", __func__, devices); |
| 679 | goto exit; |
| 680 | } |
| 681 | |
Ravi Kumar Alamanda | b09e4a0 | 2014-10-20 17:07:43 -0700 | [diff] [blame] | 682 | if (voice_is_in_call(adev)) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 683 | if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || |
| 684 | devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 685 | if (adev->voice.tty_mode == TTY_MODE_FULL) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 686 | snd_device = SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES; |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 687 | else if (adev->voice.tty_mode == TTY_MODE_VCO) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 688 | snd_device = SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES; |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 689 | else if (adev->voice.tty_mode == TTY_MODE_HCO) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 690 | snd_device = SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET; |
yixuanjiang | 9536e67 | 2018-09-06 18:43:36 +0800 | [diff] [blame] | 691 | else if (devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) |
| 692 | snd_device = SND_DEVICE_OUT_VOICE_HEADSET; |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 693 | else |
| 694 | snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; |
| 695 | } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) { |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 696 | if (adev->bt_wb_speech_enabled) { |
| 697 | snd_device = SND_DEVICE_OUT_BT_SCO_WB; |
| 698 | } else { |
| 699 | snd_device = SND_DEVICE_OUT_BT_SCO; |
| 700 | } |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 701 | } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { |
| 702 | snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; |
| 703 | } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { |
| 704 | if (is_operator_tmus()) |
| 705 | snd_device = SND_DEVICE_OUT_VOICE_HANDSET_TMUS; |
| 706 | else |
| 707 | snd_device = SND_DEVICE_OUT_HANDSET; |
| 708 | } |
| 709 | if (snd_device != SND_DEVICE_NONE) { |
| 710 | goto exit; |
| 711 | } |
| 712 | } |
| 713 | |
| 714 | if (popcount(devices) == 2) { |
| 715 | if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | |
| 716 | AUDIO_DEVICE_OUT_SPEAKER)) { |
| 717 | snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; |
| 718 | } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | |
| 719 | AUDIO_DEVICE_OUT_SPEAKER)) { |
| 720 | snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; |
| 721 | } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL | |
| 722 | AUDIO_DEVICE_OUT_SPEAKER)) { |
| 723 | snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI; |
| 724 | } else { |
| 725 | ALOGE("%s: Invalid combo device(%#x)", __func__, devices); |
| 726 | goto exit; |
| 727 | } |
| 728 | if (snd_device != SND_DEVICE_NONE) { |
| 729 | goto exit; |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | if (popcount(devices) != 1) { |
| 734 | ALOGE("%s: Invalid output devices(%#x)", __func__, devices); |
| 735 | goto exit; |
| 736 | } |
| 737 | |
| 738 | if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || |
| 739 | devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { |
| 740 | snd_device = SND_DEVICE_OUT_HEADPHONES; |
| 741 | } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { |
andysu | 5b30b06 | 2018-04-20 16:34:06 +0800 | [diff] [blame] | 742 | /* |
| 743 | * Perform device switch only if acdb tuning is different between SPEAKER & SPEAKER_REVERSE, |
| 744 | * Or there will be a small pause while performing device switch. |
| 745 | */ |
| 746 | if (my_data->speaker_lr_swap && |
| 747 | (acdb_device_table[SND_DEVICE_OUT_SPEAKER] != |
| 748 | acdb_device_table[SND_DEVICE_OUT_SPEAKER_REVERSE])) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 749 | snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; |
| 750 | else |
| 751 | snd_device = SND_DEVICE_OUT_SPEAKER; |
| 752 | } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) { |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 753 | if (adev->bt_wb_speech_enabled) { |
| 754 | snd_device = SND_DEVICE_OUT_BT_SCO_WB; |
| 755 | } else { |
| 756 | snd_device = SND_DEVICE_OUT_BT_SCO; |
| 757 | } |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 758 | } else if (devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { |
| 759 | snd_device = SND_DEVICE_OUT_HDMI ; |
| 760 | } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { |
| 761 | snd_device = SND_DEVICE_OUT_HANDSET; |
| 762 | } else { |
| 763 | ALOGE("%s: Unknown device(s) %#x", __func__, devices); |
| 764 | } |
| 765 | exit: |
| 766 | ALOGV("%s: exit: snd_device(%s)", __func__, device_table[snd_device]); |
| 767 | return snd_device; |
| 768 | } |
| 769 | |
Eric Laurent | d1b7a9b | 2018-11-15 12:24:31 -0800 | [diff] [blame] | 770 | snd_device_t platform_get_input_snd_device(void *platform, |
| 771 | struct stream_in *in, |
| 772 | audio_devices_t out_device) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 773 | { |
| 774 | struct platform_data *my_data = (struct platform_data *)platform; |
| 775 | struct audio_device *adev = my_data->adev; |
Eric Laurent | d1b7a9b | 2018-11-15 12:24:31 -0800 | [diff] [blame] | 776 | audio_mode_t mode = adev->mode; |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 777 | snd_device_t snd_device = SND_DEVICE_NONE; |
| 778 | |
Eric Laurent | d1b7a9b | 2018-11-15 12:24:31 -0800 | [diff] [blame] | 779 | if (in == NULL) { |
| 780 | in = adev_get_active_input(adev); |
| 781 | } |
| 782 | |
| 783 | audio_source_t source = (in == NULL) ? AUDIO_SOURCE_DEFAULT : in->source; |
| 784 | audio_devices_t in_device = |
| 785 | ((in == NULL) ? AUDIO_DEVICE_NONE : in->device) & ~AUDIO_DEVICE_BIT_IN; |
| 786 | audio_channel_mask_t channel_mask = (in == NULL) ? AUDIO_CHANNEL_IN_MONO : in->channel_mask; |
| 787 | |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 788 | ALOGV("%s: enter: out_device(%#x) in_device(%#x)", |
| 789 | __func__, out_device, in_device); |
Ravi Kumar Alamanda | b09e4a0 | 2014-10-20 17:07:43 -0700 | [diff] [blame] | 790 | if ((out_device != AUDIO_DEVICE_NONE) && voice_is_in_call(adev)) { |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 791 | if (adev->voice.tty_mode != TTY_MODE_OFF) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 792 | if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || |
| 793 | out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 794 | switch (adev->voice.tty_mode) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 795 | case TTY_MODE_FULL: |
| 796 | snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC; |
| 797 | break; |
| 798 | case TTY_MODE_VCO: |
| 799 | snd_device = SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC; |
| 800 | break; |
| 801 | case TTY_MODE_HCO: |
| 802 | snd_device = SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC; |
| 803 | break; |
| 804 | default: |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 805 | ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->voice.tty_mode); |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 806 | } |
| 807 | goto exit; |
| 808 | } |
| 809 | } |
| 810 | if (out_device & AUDIO_DEVICE_OUT_EARPIECE || |
| 811 | out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) { |
| 812 | if (my_data->fluence_in_voice_call == false) { |
| 813 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 814 | } else { |
| 815 | if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { |
| 816 | if (is_operator_tmus()) |
| 817 | snd_device = SND_DEVICE_IN_VOICE_DMIC_EF_TMUS; |
| 818 | else |
| 819 | snd_device = SND_DEVICE_IN_VOICE_DMIC_EF; |
| 820 | } else if(my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) |
| 821 | snd_device = SND_DEVICE_IN_VOICE_DMIC_BS; |
| 822 | else |
| 823 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 824 | } |
| 825 | } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { |
| 826 | snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; |
| 827 | } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 828 | if (adev->bt_wb_speech_enabled) { |
| 829 | snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; |
| 830 | } else { |
| 831 | snd_device = SND_DEVICE_IN_BT_SCO_MIC; |
| 832 | } |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 833 | } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) { |
| 834 | if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode && |
| 835 | my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { |
| 836 | snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF; |
| 837 | } else if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode && |
| 838 | my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) { |
| 839 | snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS; |
| 840 | } else { |
| 841 | snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; |
| 842 | } |
| 843 | } |
| 844 | } else if (source == AUDIO_SOURCE_CAMCORDER) { |
| 845 | if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC || |
| 846 | in_device & AUDIO_DEVICE_IN_BACK_MIC) { |
| 847 | snd_device = SND_DEVICE_IN_CAMCORDER_MIC; |
| 848 | } |
| 849 | } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) { |
| 850 | if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { |
| 851 | if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { |
| 852 | if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) |
| 853 | snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF; |
| 854 | else if (my_data->fluence_in_voice_rec) |
| 855 | snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE; |
| 856 | } else if (my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) { |
| 857 | if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) |
| 858 | snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS; |
| 859 | else if (my_data->fluence_in_voice_rec) |
| 860 | snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE; |
| 861 | } |
| 862 | |
| 863 | if (snd_device == SND_DEVICE_NONE) { |
| 864 | snd_device = SND_DEVICE_IN_VOICE_REC_MIC; |
| 865 | } |
| 866 | } |
Eric Laurent | 50a38ed | 2015-10-14 18:48:06 -0700 | [diff] [blame] | 867 | } else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION || |
| 868 | mode == AUDIO_MODE_IN_COMMUNICATION) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 869 | if (out_device & AUDIO_DEVICE_OUT_SPEAKER) |
| 870 | in_device = AUDIO_DEVICE_IN_BACK_MIC; |
Eric Laurent | d1b7a9b | 2018-11-15 12:24:31 -0800 | [diff] [blame] | 871 | if (in) { |
| 872 | if (in != NULL && in->enable_aec) { |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 873 | if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { |
| 874 | snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC; |
| 875 | } else if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { |
| 876 | snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; |
| 877 | } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { |
| 878 | snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC; |
| 879 | } |
| 880 | set_echo_reference(adev->mixer, "SLIM_RX"); |
| 881 | } else |
| 882 | set_echo_reference(adev->mixer, "NONE"); |
| 883 | } |
| 884 | } else if (source == AUDIO_SOURCE_DEFAULT) { |
| 885 | goto exit; |
| 886 | } |
| 887 | |
| 888 | |
| 889 | if (snd_device != SND_DEVICE_NONE) { |
| 890 | goto exit; |
| 891 | } |
| 892 | |
| 893 | if (in_device != AUDIO_DEVICE_NONE && |
| 894 | !(in_device & AUDIO_DEVICE_IN_VOICE_CALL) && |
| 895 | !(in_device & AUDIO_DEVICE_IN_COMMUNICATION)) { |
| 896 | if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { |
| 897 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 898 | } else if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { |
| 899 | snd_device = SND_DEVICE_IN_SPEAKER_MIC; |
| 900 | } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { |
| 901 | snd_device = SND_DEVICE_IN_HEADSET_MIC; |
| 902 | } else if (in_device & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) { |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 903 | if (adev->bt_wb_speech_enabled) { |
| 904 | snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; |
| 905 | } else { |
| 906 | snd_device = SND_DEVICE_IN_BT_SCO_MIC; |
| 907 | } |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 908 | } else if (in_device & AUDIO_DEVICE_IN_AUX_DIGITAL) { |
| 909 | snd_device = SND_DEVICE_IN_HDMI_MIC; |
| 910 | } else { |
| 911 | ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); |
| 912 | ALOGW("%s: Using default handset-mic", __func__); |
| 913 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 914 | } |
| 915 | } else { |
| 916 | if (out_device & AUDIO_DEVICE_OUT_EARPIECE) { |
| 917 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 918 | } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { |
| 919 | snd_device = SND_DEVICE_IN_HEADSET_MIC; |
| 920 | } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) { |
| 921 | snd_device = SND_DEVICE_IN_SPEAKER_MIC; |
| 922 | } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) { |
| 923 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 924 | } else if (out_device & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) { |
Ravi Kumar Alamanda | 9f30654 | 2014-04-02 15:11:49 -0700 | [diff] [blame] | 925 | if (adev->bt_wb_speech_enabled) { |
| 926 | snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; |
| 927 | } else { |
| 928 | snd_device = SND_DEVICE_IN_BT_SCO_MIC; |
| 929 | } |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 930 | } else if (out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL) { |
| 931 | snd_device = SND_DEVICE_IN_HDMI_MIC; |
| 932 | } else { |
| 933 | ALOGE("%s: Unknown output device(s) %#x", __func__, out_device); |
| 934 | ALOGW("%s: Using default handset-mic", __func__); |
| 935 | snd_device = SND_DEVICE_IN_HANDSET_MIC; |
| 936 | } |
| 937 | } |
| 938 | exit: |
| 939 | ALOGV("%s: exit: in_snd_device(%s)", __func__, device_table[snd_device]); |
| 940 | return snd_device; |
| 941 | } |
| 942 | |
| 943 | int platform_set_hdmi_channels(void *platform, int channel_count) |
| 944 | { |
| 945 | struct platform_data *my_data = (struct platform_data *)platform; |
| 946 | struct audio_device *adev = my_data->adev; |
| 947 | struct mixer_ctl *ctl; |
| 948 | const char *channel_cnt_str = NULL; |
| 949 | const char *mixer_ctl_name = "HDMI_RX Channels"; |
| 950 | switch (channel_count) { |
| 951 | case 8: |
| 952 | channel_cnt_str = "Eight"; break; |
| 953 | case 7: |
| 954 | channel_cnt_str = "Seven"; break; |
| 955 | case 6: |
| 956 | channel_cnt_str = "Six"; break; |
| 957 | case 5: |
| 958 | channel_cnt_str = "Five"; break; |
| 959 | case 4: |
| 960 | channel_cnt_str = "Four"; break; |
| 961 | case 3: |
| 962 | channel_cnt_str = "Three"; break; |
| 963 | default: |
| 964 | channel_cnt_str = "Two"; break; |
| 965 | } |
| 966 | ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); |
| 967 | if (!ctl) { |
| 968 | ALOGE("%s: Could not get ctl for mixer cmd - %s", |
| 969 | __func__, mixer_ctl_name); |
| 970 | return -EINVAL; |
| 971 | } |
| 972 | ALOGV("HDMI channel count: %s", channel_cnt_str); |
| 973 | mixer_ctl_set_enum_by_string(ctl, channel_cnt_str); |
| 974 | return 0; |
| 975 | } |
| 976 | |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 977 | int platform_edid_get_max_channels(void *platform __unused) |
Eric Laurent | b23d528 | 2013-05-14 15:27:20 -0700 | [diff] [blame] | 978 | { |
| 979 | FILE *file; |
| 980 | struct audio_block_header header; |
| 981 | char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE]; |
| 982 | char *sad = block; |
| 983 | int num_audio_blocks; |
| 984 | int channel_count; |
| 985 | int max_channels = 0; |
| 986 | int i; |
| 987 | |
| 988 | file = fopen(AUDIO_DATA_BLOCK_PATH, "rb"); |
| 989 | if (file == NULL) { |
| 990 | ALOGE("Unable to open '%s'", AUDIO_DATA_BLOCK_PATH); |
| 991 | return 0; |
| 992 | } |
| 993 | |
| 994 | /* Read audio block header */ |
| 995 | fread(&header, 1, sizeof(header), file); |
| 996 | |
| 997 | /* Read SAD blocks, clamping the maximum size for safety */ |
| 998 | if (header.length > (int)sizeof(block)) |
| 999 | header.length = (int)sizeof(block); |
| 1000 | fread(&block, header.length, 1, file); |
| 1001 | |
| 1002 | fclose(file); |
| 1003 | |
| 1004 | /* Calculate the number of SAD blocks */ |
| 1005 | num_audio_blocks = header.length / SAD_BLOCK_SIZE; |
| 1006 | |
| 1007 | for (i = 0; i < num_audio_blocks; i++) { |
| 1008 | /* Only consider LPCM blocks */ |
| 1009 | if ((sad[0] >> 3) != EDID_FORMAT_LPCM) |
| 1010 | continue; |
| 1011 | |
| 1012 | channel_count = (sad[0] & 0x7) + 1; |
| 1013 | if (channel_count > max_channels) |
| 1014 | max_channels = channel_count; |
| 1015 | |
| 1016 | /* Advance to next block */ |
| 1017 | sad += 3; |
| 1018 | } |
| 1019 | |
| 1020 | return max_channels; |
| 1021 | } |
Haynes Mathew George | 7ff216f | 2013-09-11 19:51:41 -0700 | [diff] [blame] | 1022 | |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1023 | int platform_set_incall_recording_session_id(void *platform __unused, |
| 1024 | uint32_t session_id __unused, int rec_mode __unused) |
| 1025 | { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1026 | ALOGE("%s: Not implemented", __func__); |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1027 | return -ENOSYS; |
| 1028 | } |
| 1029 | |
| 1030 | int platform_stop_incall_recording_usecase(void *platform __unused) |
| 1031 | { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1032 | ALOGE("%s: Not implemented", __func__); |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1033 | return -ENOSYS; |
| 1034 | } |
| 1035 | |
| 1036 | int platform_start_incall_music_usecase(void *platform __unused) |
| 1037 | { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1038 | ALOGE("%s: Not implemented", __func__); |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1039 | return -ENOSYS; |
| 1040 | } |
| 1041 | |
| 1042 | int platform_stop_incall_music_usecase(void *platform __unused) |
| 1043 | { |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1044 | ALOGE("%s: Not implemented", __func__); |
Vineeta Srivastava | 4b89e37 | 2014-06-19 14:21:42 -0700 | [diff] [blame] | 1045 | return -ENOSYS; |
| 1046 | } |
| 1047 | |
Ravi Kumar Alamanda | c4f5731 | 2015-06-26 17:41:02 -0700 | [diff] [blame] | 1048 | int platform_set_parameters(void *platform __unused, |
| 1049 | struct str_parms *parms __unused) |
| 1050 | { |
| 1051 | ALOGE("%s: Not implemented", __func__); |
| 1052 | return -ENOSYS; |
| 1053 | } |
| 1054 | |
Haynes Mathew George | 7ff216f | 2013-09-11 19:51:41 -0700 | [diff] [blame] | 1055 | /* Delay in Us */ |
| 1056 | int64_t platform_render_latency(audio_usecase_t usecase) |
| 1057 | { |
| 1058 | switch (usecase) { |
| 1059 | case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER: |
| 1060 | return DEEP_BUFFER_PLATFORM_DELAY; |
| 1061 | case USECASE_AUDIO_PLAYBACK_LOW_LATENCY: |
| 1062 | return LOW_LATENCY_PLATFORM_DELAY; |
| 1063 | default: |
| 1064 | return 0; |
| 1065 | } |
| 1066 | } |
Ravi Kumar Alamanda | 83281a9 | 2014-05-19 18:14:57 -0700 | [diff] [blame] | 1067 | |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1068 | int platform_switch_voice_call_enable_device_config(void *platform __unused, |
| 1069 | snd_device_t out_snd_device __unused, |
| 1070 | snd_device_t in_snd_device __unused) |
Ravi Kumar Alamanda | 83281a9 | 2014-05-19 18:14:57 -0700 | [diff] [blame] | 1071 | { |
| 1072 | return 0; |
| 1073 | } |
| 1074 | |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1075 | int platform_switch_voice_call_usecase_route_post(void *platform __unused, |
| 1076 | snd_device_t out_snd_device __unused, |
| 1077 | snd_device_t in_snd_device __unused) |
Ravi Kumar Alamanda | 83281a9 | 2014-05-19 18:14:57 -0700 | [diff] [blame] | 1078 | { |
| 1079 | return 0; |
| 1080 | } |
Haynes Mathew George | 24ca9ad | 2014-06-18 15:14:18 -0700 | [diff] [blame] | 1081 | |
| 1082 | int platform_get_sample_rate(void *platform __unused, uint32_t *rate __unused) |
| 1083 | { |
| 1084 | return -ENOSYS; |
| 1085 | } |
Haynes Mathew George | 98c9562 | 2014-06-20 19:14:25 -0700 | [diff] [blame] | 1086 | |
| 1087 | int platform_get_usecase_index(const char * usecase __unused) |
| 1088 | { |
| 1089 | return -ENOSYS; |
| 1090 | } |
| 1091 | |
| 1092 | int platform_set_usecase_pcm_id(audio_usecase_t usecase __unused, int32_t type __unused, |
| 1093 | int32_t pcm_id __unused) |
| 1094 | { |
| 1095 | return -ENOSYS; |
| 1096 | } |
| 1097 | |
| 1098 | int platform_set_snd_device_backend(snd_device_t device __unused, |
Ravi Kumar Alamanda | b7ea4f5 | 2015-06-08 16:44:05 -0700 | [diff] [blame] | 1099 | const char *backend __unused, |
| 1100 | const char *hw_interface __unused) |
Haynes Mathew George | 98c9562 | 2014-06-20 19:14:25 -0700 | [diff] [blame] | 1101 | { |
| 1102 | return -ENOSYS; |
| 1103 | } |
Eric Laurent | cefbbac | 2014-09-04 13:54:10 -0500 | [diff] [blame] | 1104 | |
vivek mehta | 1a9b7c0 | 2015-06-25 11:49:38 -0700 | [diff] [blame] | 1105 | void platform_set_echo_reference(struct audio_device *adev __unused, |
| 1106 | bool enable __unused, |
| 1107 | audio_devices_t out_device __unused) |
Eric Laurent | cefbbac | 2014-09-04 13:54:10 -0500 | [diff] [blame] | 1108 | { |
| 1109 | return; |
| 1110 | } |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1111 | |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1112 | #define DEFAULT_NOMINAL_SPEAKER_GAIN 20 |
| 1113 | int ramp_speaker_gain(struct audio_device *adev, bool ramp_up, int target_ramp_up_gain) { |
| 1114 | // backup_gain: gain to try to set in case of an error during ramp |
| 1115 | int start_gain, end_gain, step, backup_gain, i; |
| 1116 | bool error = false; |
| 1117 | const struct mixer_ctl *ctl; |
| 1118 | const char *mixer_ctl_name_gain_left = "Left Speaker Gain"; |
| 1119 | const char *mixer_ctl_name_gain_right = "Right Speaker Gain"; |
| 1120 | struct mixer_ctl *ctl_left = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name_gain_left); |
| 1121 | struct mixer_ctl *ctl_right = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name_gain_right); |
| 1122 | if (!ctl_left || !ctl_right) { |
| 1123 | ALOGE("%s: Could not get ctl for mixer cmd - %s or %s, not applying speaker gain ramp", |
| 1124 | __func__, mixer_ctl_name_gain_left, mixer_ctl_name_gain_right); |
| 1125 | return -EINVAL; |
| 1126 | } else if ((mixer_ctl_get_num_values(ctl_left) != 1) |
| 1127 | || (mixer_ctl_get_num_values(ctl_right) != 1)) { |
| 1128 | ALOGE("%s: Unexpected num values for mixer cmd - %s or %s, not applying speaker gain ramp", |
| 1129 | __func__, mixer_ctl_name_gain_left, mixer_ctl_name_gain_right); |
| 1130 | return -EINVAL; |
| 1131 | } |
| 1132 | if (ramp_up) { |
| 1133 | start_gain = 0; |
| 1134 | end_gain = target_ramp_up_gain > 0 ? target_ramp_up_gain : DEFAULT_NOMINAL_SPEAKER_GAIN; |
| 1135 | step = +1; |
| 1136 | backup_gain = end_gain; |
| 1137 | } else { |
| 1138 | // using same gain on left and right |
| 1139 | const int left_gain = mixer_ctl_get_value(ctl_left, 0); |
| 1140 | start_gain = left_gain > 0 ? left_gain : DEFAULT_NOMINAL_SPEAKER_GAIN; |
| 1141 | end_gain = 0; |
| 1142 | step = -1; |
| 1143 | backup_gain = start_gain; |
| 1144 | } |
| 1145 | for (i = start_gain ; i != (end_gain + step) ; i += step) { |
| 1146 | //ALOGV("setting speaker gain to %d", i); |
| 1147 | if (mixer_ctl_set_value(ctl_left, 0, i)) { |
| 1148 | ALOGE("%s: error setting %s to %d during gain ramp", |
| 1149 | __func__, mixer_ctl_name_gain_left, i); |
| 1150 | error = true; |
| 1151 | break; |
| 1152 | } |
| 1153 | if (mixer_ctl_set_value(ctl_right, 0, i)) { |
| 1154 | ALOGE("%s: error setting %s to %d during gain ramp", |
| 1155 | __func__, mixer_ctl_name_gain_right, i); |
| 1156 | error = true; |
| 1157 | break; |
| 1158 | } |
| 1159 | usleep(1000); |
| 1160 | } |
| 1161 | if (error) { |
| 1162 | // an error occured during the ramp, let's still try to go back to a safe volume |
| 1163 | if (mixer_ctl_set_value(ctl_left, 0, backup_gain)) { |
| 1164 | ALOGE("%s: error restoring left gain to %d", __func__, backup_gain); |
| 1165 | } |
| 1166 | if (mixer_ctl_set_value(ctl_right, 0, backup_gain)) { |
| 1167 | ALOGE("%s: error restoring right gain to %d", __func__, backup_gain); |
| 1168 | } |
| 1169 | } |
| 1170 | return start_gain; |
| 1171 | } |
| 1172 | |
| 1173 | int platform_set_swap_mixer(struct audio_device *adev, bool swap_channels) |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1174 | { |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1175 | const char *mixer_ctl_name = "Swap channel"; |
| 1176 | struct mixer_ctl *ctl; |
| 1177 | const char *mixer_path; |
| 1178 | struct platform_data *my_data = (struct platform_data *)adev->platform; |
| 1179 | |
| 1180 | // forced to set to swap, but device not rotated ... ignore set |
| 1181 | if (swap_channels && !my_data->speaker_lr_swap) |
| 1182 | return 0; |
| 1183 | |
| 1184 | ALOGV("%s:", __func__); |
| 1185 | |
| 1186 | if (swap_channels) { |
| 1187 | mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_REVERSE); |
| 1188 | audio_route_apply_and_update_path(adev->audio_route, mixer_path); |
| 1189 | } else { |
| 1190 | mixer_path = platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER); |
| 1191 | audio_route_apply_and_update_path(adev->audio_route, mixer_path); |
| 1192 | } |
| 1193 | |
| 1194 | ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); |
| 1195 | if (!ctl) { |
| 1196 | ALOGE("%s: Could not get ctl for mixer cmd - %s",__func__, mixer_ctl_name); |
| 1197 | return -EINVAL; |
| 1198 | } |
| 1199 | |
| 1200 | if (mixer_ctl_set_value(ctl, 0, swap_channels) < 0) { |
| 1201 | ALOGE("%s: Could not set reverse cotrol %d",__func__, swap_channels); |
| 1202 | return -EINVAL; |
| 1203 | } |
| 1204 | |
| 1205 | ALOGV("platfor_force_swap_channel :: Channel orientation ( %s ) ", |
| 1206 | swap_channels?"R --> L":"L --> R"); |
| 1207 | |
| 1208 | return 0; |
| 1209 | } |
| 1210 | |
| 1211 | int platform_check_and_set_swap_lr_channels(struct audio_device *adev, bool swap_channels) |
| 1212 | { |
| 1213 | // only update if there is active pcm playback on speaker |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1214 | struct audio_usecase *usecase; |
| 1215 | struct listnode *node; |
| 1216 | struct platform_data *my_data = (struct platform_data *)adev->platform; |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1217 | |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1218 | my_data->speaker_lr_swap = swap_channels; |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1219 | |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1220 | return platform_set_swap_channels(adev, swap_channels); |
| 1221 | } |
| 1222 | |
| 1223 | int platform_set_swap_channels(struct audio_device *adev, bool swap_channels) |
| 1224 | { |
| 1225 | // only update if there is active pcm playback on speaker |
| 1226 | struct audio_usecase *usecase; |
| 1227 | struct listnode *node; |
| 1228 | struct platform_data *my_data = (struct platform_data *)adev->platform; |
| 1229 | |
| 1230 | // do not swap channels in audio modes with concurrent capture and playback |
| 1231 | // as this may break the echo reference |
| 1232 | if ((adev->mode == AUDIO_MODE_IN_COMMUNICATION) || (adev->mode == AUDIO_MODE_IN_CALL)) { |
| 1233 | ALOGV("%s: will not swap due to audio mode %d", __func__, adev->mode); |
| 1234 | return 0; |
| 1235 | } |
| 1236 | |
| 1237 | list_for_each(node, &adev->usecase_list) { |
| 1238 | usecase = node_to_item(node, struct audio_usecase, list); |
| 1239 | if (usecase->type == PCM_PLAYBACK && |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1240 | usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER) { |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1241 | /* |
| 1242 | * If acdb tuning is different for SPEAKER_REVERSE, it is must |
| 1243 | * to perform device switch to disable the current backend to |
| 1244 | * enable it with new acdb data. |
| 1245 | */ |
| 1246 | if (acdb_device_table[SND_DEVICE_OUT_SPEAKER] != |
| 1247 | acdb_device_table[SND_DEVICE_OUT_SPEAKER_REVERSE]) { |
| 1248 | const int initial_skpr_gain = ramp_speaker_gain(adev, false /*ramp_up*/, -1); |
| 1249 | select_devices(adev, usecase->id); |
| 1250 | if (initial_skpr_gain != -EINVAL) |
| 1251 | ramp_speaker_gain(adev, true /*ramp_up*/, initial_skpr_gain); |
| 1252 | |
| 1253 | } else { |
| 1254 | platform_set_swap_mixer(adev, swap_channels); |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1255 | } |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1256 | break; |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1257 | } |
| 1258 | } |
vivek mehta | e59cfb2 | 2017-06-16 15:57:11 -0700 | [diff] [blame] | 1259 | |
| 1260 | return 0; |
Ravi Kumar Alamanda | 1f60cf8 | 2015-04-23 19:45:17 -0700 | [diff] [blame] | 1261 | } |
Ravi Kumar Alamanda | b7ea4f5 | 2015-06-08 16:44:05 -0700 | [diff] [blame] | 1262 | |
| 1263 | bool platform_send_gain_dep_cal(void *platform __unused, |
| 1264 | int level __unused) |
| 1265 | { |
vivek mehta | fb4d7bd | 2016-04-29 03:16:47 -0700 | [diff] [blame] | 1266 | return true; |
Ravi Kumar Alamanda | b7ea4f5 | 2015-06-08 16:44:05 -0700 | [diff] [blame] | 1267 | } |
| 1268 | |
Haynes Mathew George | 2d809e0 | 2016-09-22 17:38:16 -0700 | [diff] [blame] | 1269 | int platform_can_split_snd_device(snd_device_t in_snd_device __unused, |
Ravi Kumar Alamanda | b7ea4f5 | 2015-06-08 16:44:05 -0700 | [diff] [blame] | 1270 | int *num_devices __unused, |
| 1271 | snd_device_t *out_snd_devices __unused) |
| 1272 | { |
Haynes Mathew George | 2d809e0 | 2016-09-22 17:38:16 -0700 | [diff] [blame] | 1273 | return -ENOSYS; |
Ravi Kumar Alamanda | b7ea4f5 | 2015-06-08 16:44:05 -0700 | [diff] [blame] | 1274 | } |
| 1275 | |
| 1276 | bool platform_check_backends_match(snd_device_t snd_device1 __unused, |
| 1277 | snd_device_t snd_device2 __unused) |
| 1278 | { |
| 1279 | return true; |
| 1280 | } |
vivek mehta | de4849c | 2016-03-03 17:23:38 -0800 | [diff] [blame] | 1281 | |
| 1282 | int platform_get_snd_device_name_extn(void *platform __unused, |
| 1283 | snd_device_t snd_device, |
| 1284 | char *device_name) |
| 1285 | { |
David Benjamin | 1565f99 | 2016-09-21 12:10:34 -0400 | [diff] [blame] | 1286 | strlcpy(device_name, platform_get_snd_device_name(snd_device), |
| 1287 | DEVICE_NAME_MAX_SIZE); |
vivek mehta | de4849c | 2016-03-03 17:23:38 -0800 | [diff] [blame] | 1288 | return 0; |
| 1289 | } |
| 1290 | |
David Lin | ee3fe40 | 2017-03-13 10:00:42 -0700 | [diff] [blame] | 1291 | bool platform_check_and_set_playback_backend_cfg(struct audio_device* adev __unused, |
| 1292 | struct audio_usecase *usecase __unused, |
| 1293 | snd_device_t snd_device __unused) |
| 1294 | { |
| 1295 | return false; |
| 1296 | } |
| 1297 | |
vivek mehta | 4ed66e6 | 2016-04-15 23:33:34 -0700 | [diff] [blame] | 1298 | bool platform_check_and_set_capture_backend_cfg(struct audio_device* adev __unused, |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 1299 | struct audio_usecase *usecase __unused, snd_device_t snd_device __unused) |
vivek mehta | 4ed66e6 | 2016-04-15 23:33:34 -0700 | [diff] [blame] | 1300 | { |
| 1301 | return false; |
| 1302 | } |
| 1303 | |
vivek mehta | a8d7c92 | 2016-05-25 14:40:44 -0700 | [diff] [blame] | 1304 | bool platform_add_gain_level_mapping(struct amp_db_and_gain_table *tbl_entry __unused) |
| 1305 | { |
| 1306 | return false; |
| 1307 | } |
| 1308 | |
| 1309 | int platform_get_gain_level_mapping(struct amp_db_and_gain_table *mapping_tbl __unused, |
| 1310 | int table_size __unused) |
| 1311 | { |
| 1312 | return 0; |
| 1313 | } |
Haynes Mathew George | c735fb0 | 2016-06-30 18:00:28 -0700 | [diff] [blame] | 1314 | |
Tom Cherry | 8721b4d | 2016-07-14 16:12:23 -0700 | [diff] [blame] | 1315 | int platform_snd_card_update(void *platform __unused, |
Haynes Mathew George | c735fb0 | 2016-06-30 18:00:28 -0700 | [diff] [blame] | 1316 | card_status_t status __unused) |
| 1317 | { |
| 1318 | return -1; |
| 1319 | } |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1320 | |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 1321 | int platform_get_snd_device_backend_index(snd_device_t snd_device __unused) |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1322 | { |
| 1323 | return -ENOSYS; |
| 1324 | } |
| 1325 | |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 1326 | void platform_check_and_update_copp_sample_rate(void* platform __unused, snd_device_t snd_device __unused, |
| 1327 | unsigned int stream_sr __unused, int* sample_rate __unused) |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1328 | { |
| 1329 | |
| 1330 | } |
| 1331 | |
David Lin | d6229bd | 2017-07-06 15:28:55 -0700 | [diff] [blame] | 1332 | int platform_send_audio_calibration_v2(void *platform __unused, struct audio_usecase *usecase __unused, |
| 1333 | int app_type __unused, int sample_rate __unused) |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1334 | { |
| 1335 | return -ENOSYS; |
| 1336 | } |
| 1337 | |
| 1338 | bool platform_supports_app_type_cfg() { return false; } |
| 1339 | |
vivek mehta | a68fea6 | 2017-06-08 19:04:02 -0700 | [diff] [blame] | 1340 | void platform_add_app_type(const char *uc_type __unused, |
| 1341 | const char *mode __unused, |
| 1342 | int bw __unused, int app_type __unused, |
| 1343 | int max_sr __unused) {} |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1344 | |
vivek mehta | a68fea6 | 2017-06-08 19:04:02 -0700 | [diff] [blame] | 1345 | int platform_get_app_type_v2(void *platform __unused, |
| 1346 | enum usecase_type_t type __unused, |
| 1347 | const char *mode __unused, |
| 1348 | int bw __unused, int sr __unused, |
| 1349 | int *app_type __unused) { |
| 1350 | return -ENOSYS; |
| 1351 | } |
Haynes Mathew George | e5ff0fc | 2017-02-16 20:33:38 -0800 | [diff] [blame] | 1352 | |
vivek mehta | 9093387 | 2017-06-15 18:04:39 -0700 | [diff] [blame] | 1353 | int platform_set_sidetone(struct audio_device *adev, |
| 1354 | snd_device_t out_snd_device, |
| 1355 | bool enable, char *str) |
| 1356 | { |
| 1357 | int ret; |
| 1358 | if (out_snd_device == SND_DEVICE_OUT_USB_HEADSET || |
| 1359 | out_snd_device == SND_DEVICE_OUT_VOICE_USB_HEADSET) { |
| 1360 | ret = audio_extn_usb_enable_sidetone(out_snd_device, enable); |
| 1361 | if (ret) |
| 1362 | ALOGI("%s: usb device %d does not support device sidetone\n", |
| 1363 | __func__, out_snd_device); |
| 1364 | } else { |
| 1365 | ALOGV("%s: sidetone out device(%d) mixer cmd = %s\n", |
| 1366 | __func__, out_snd_device, str); |
| 1367 | if (enable) |
| 1368 | audio_route_apply_and_update_path(adev->audio_route, str); |
| 1369 | else |
| 1370 | audio_route_reset_and_update_path(adev->audio_route, str); |
| 1371 | } |
| 1372 | return 0; |
| 1373 | } |
Haynes Mathew George | 96483a2 | 2017-03-28 14:52:47 -0700 | [diff] [blame] | 1374 | |
| 1375 | int platform_get_mmap_data_fd(void *platform __unused, int fe_dev __unused, int dir __unused, |
| 1376 | int *fd __unused, uint32_t *size __unused) |
| 1377 | { |
| 1378 | return -ENOSYS; |
| 1379 | } |
Mikhail Naganov | 4ee6e3e | 2018-03-21 16:28:35 +0000 | [diff] [blame] | 1380 | |
| 1381 | bool platform_sound_trigger_usecase_needs_event(audio_usecase_t uc_id __unused) |
| 1382 | { |
| 1383 | return false; |
| 1384 | } |
| 1385 | |
| 1386 | bool platform_snd_device_has_speaker(snd_device_t dev __unused) { |
| 1387 | return false; |
| 1388 | } |
jiabin | 8962a4d | 2018-03-19 18:21:24 -0700 | [diff] [blame] | 1389 | |
| 1390 | bool platform_set_microphone_characteristic(void *platform __unused, |
| 1391 | struct audio_microphone_characteristic_t mic __unused) { |
| 1392 | return -ENOSYS; |
| 1393 | } |
| 1394 | |
| 1395 | int platform_get_microphones(void *platform __unused, |
| 1396 | struct audio_microphone_characteristic_t *mic_array __unused, |
| 1397 | size_t *mic_count __unused) { |
| 1398 | return -ENOSYS; |
| 1399 | } |
| 1400 | |
jiabin | 2276a70 | 2018-05-11 09:36:38 -0700 | [diff] [blame] | 1401 | int platform_get_active_microphones(void *platform __unused, unsigned int channels __unused, |
| 1402 | audio_usecase_t usecase __unused, |
jiabin | 8962a4d | 2018-03-19 18:21:24 -0700 | [diff] [blame] | 1403 | struct audio_microphone_characteristic_t *mic_array __unused, |
| 1404 | size_t *mic_count __unused) { |
| 1405 | return -ENOSYS; |
| 1406 | } |
Haynes Mathew George | 65f6b43 | 2018-02-27 17:44:55 -0800 | [diff] [blame] | 1407 | |
| 1408 | int platform_set_usb_service_interval(void *platform __unused, |
| 1409 | bool playback __unused, |
| 1410 | unsigned long service_interval __unused, |
| 1411 | bool *reconfig) |
| 1412 | { |
| 1413 | *reconfig = false; |
| 1414 | return 0; |
| 1415 | } |
| 1416 | |
Eric Laurent | ca7724d | 2018-05-08 09:08:28 -0700 | [diff] [blame] | 1417 | int platform_set_backend_cfg(const struct audio_device* adev __unused, |
| 1418 | snd_device_t snd_device __unused, |
| 1419 | const struct audio_backend_cfg *backend_cfg __unused) |
Haynes Mathew George | 65f6b43 | 2018-02-27 17:44:55 -0800 | [diff] [blame] | 1420 | { |
| 1421 | return -1; |
| 1422 | } |
Ashish Jain | 1c84970 | 2018-05-11 20:11:55 +0530 | [diff] [blame] | 1423 | |
| 1424 | int platform_set_acdb_metainfo_key(void *platform __unused, |
| 1425 | char *name __unused, |
| 1426 | int key __unused) { |
| 1427 | return -ENOSYS; |
| 1428 | } |