1b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* 24b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava * Copyright (C) 2013-2014 The Android Open Source Project 3b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 4b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * Licensed under the Apache License, Version 2.0 (the "License"); 5b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * you may not use this file except in compliance with the License. 6b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * You may obtain a copy of the License at 7b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 8b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * http://www.apache.org/licenses/LICENSE-2.0 9b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 10b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * Unless required by applicable law or agreed to in writing, software 11b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * distributed under the License is distributed on an "AS IS" BASIS, 12b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * See the License for the specific language governing permissions and 14b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * limitations under the License. 15b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent */ 16b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 17b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define LOG_TAG "msm8960_platform" 18b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/*#define LOG_NDEBUG 0*/ 19b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define LOG_NDDEBUG 0 20b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 21b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <stdlib.h> 22b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <dlfcn.h> 23b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <cutils/log.h> 24b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <cutils/properties.h> 25b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <audio_hw.h> 26b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include <platform_api.h> 27b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#include "platform.h" 28b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 29b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define LIB_ACDB_LOADER "libacdbloader.so" 30b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define LIB_CSD_CLIENT "libcsd-client.so" 31b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 32b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define DUALMIC_CONFIG_NONE 0 /* Target does not contain 2 mics */ 33b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define DUALMIC_CONFIG_ENDFIRE 1 34b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define DUALMIC_CONFIG_BROADSIDE 2 35b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 36b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* 37b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * This is the sysfs path for the HDMI audio data block 38b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent */ 39b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define AUDIO_DATA_BLOCK_PATH "/sys/class/graphics/fb1/audio_data_block" 401b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo#define MIXER_XML_PATH "/system/etc/mixer_paths.xml" 41b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 42b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* 43b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * This file will have a maximum of 38 bytes: 44b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 45b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 4 bytes: number of audio blocks 46b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * 4 bytes: total length of Short Audio Descriptor (SAD) blocks 47b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * Maximum 10 * 3 bytes: SAD blocks 48b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent */ 49b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define MAX_SAD_BLOCKS 10 50b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define SAD_BLOCK_SIZE 3 51b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 52b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* EDID format ID for LPCM audio */ 53b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent#define EDID_FORMAT_LPCM 1 54b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 55b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstruct audio_block_header 56b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 57b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int reserved; 58b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int length; 59b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent}; 60b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 61b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 62b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef void (*acdb_deallocate_t)(); 63b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*acdb_init_t)(); 64b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef void (*acdb_send_audio_cal_t)(int, int); 65b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef void (*acdb_send_voice_cal_t)(int, int); 66b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 67b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_client_init_t)(); 68b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_client_deinit_t)(); 69b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_disable_device_t)(); 70b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_enable_device_t)(int, int, uint32_t); 71b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_volume_t)(int); 72b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_mic_mute_t)(int); 73b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_start_voice_t)(); 74b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurenttypedef int (*csd_stop_voice_t)(); 75b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 76b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 77b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* Audio calibration related functions */ 78b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstruct platform_data { 79b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct audio_device *adev; 80b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent bool fluence_in_spkr_mode; 81b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent bool fluence_in_voice_call; 82b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent bool fluence_in_voice_rec; 83b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int dualmic_config; 84b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 85b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent void *acdb_handle; 86b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_init_t acdb_init; 87b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_deallocate_t acdb_deallocate; 88b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_send_audio_cal_t acdb_send_audio_cal; 89b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_send_voice_cal_t acdb_send_voice_cal; 90b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 91b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* CSD Client related functions for voice call */ 92b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent void *csd_client; 93b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_client_init_t csd_client_init; 94b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_client_deinit_t csd_client_deinit; 95b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_disable_device_t csd_disable_device; 96b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_enable_device_t csd_enable_device; 97b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_volume_t csd_volume; 98b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_mic_mute_t csd_mic_mute; 99b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_start_voice_t csd_start_voice; 100b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent csd_stop_voice_t csd_stop_voice; 101b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent}; 102b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 103b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic const int pcm_device_table[AUDIO_USECASE_MAX][2] = { 104b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_AUDIO_PLAYBACK_DEEP_BUFFER] = {0, 0}, 105b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_AUDIO_PLAYBACK_LOW_LATENCY] = {14, 14}, 106b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_AUDIO_PLAYBACK_MULTI_CH] = {1, 1}, 107b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_AUDIO_RECORD] = {0, 0}, 108b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_AUDIO_RECORD_LOW_LATENCY] = {14, 14}, 109b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [USECASE_VOICE_CALL] = {12, 12}, 110b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent}; 111b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 112b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* Array to store sound devices */ 113b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic const char * const device_table[SND_DEVICE_MAX] = { 114b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_NONE] = "none", 115b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Playback sound devices */ 116b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HANDSET] = "handset", 117b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER] = "speaker", 118b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_REVERSE] = "speaker-reverse", 119b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HEADPHONES] = "headphones", 120b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = "speaker-and-headphones", 121b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_SPEAKER] = "voice-speaker", 122b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_HEADPHONES] = "voice-headphones", 123b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HDMI] = "hdmi", 124b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = "speaker-and-hdmi", 125b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_BT_SCO] = "bt-sco-headset", 1269f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda [SND_DEVICE_OUT_BT_SCO_WB] = "bt-sco-headset-wb", 127b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = "voice-handset-tmus", 128b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = "voice-tty-full-headphones", 129b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = "voice-tty-vco-headphones", 130b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = "voice-tty-hco-handset", 131b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 132b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Capture sound devices */ 133b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HANDSET_MIC] = "handset-mic", 134b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_SPEAKER_MIC] = "speaker-mic", 135b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HEADSET_MIC] = "headset-mic", 136b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HANDSET_MIC_AEC] = "handset-mic", 137b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_SPEAKER_MIC_AEC] = "voice-speaker-mic", 138b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HEADSET_MIC_AEC] = "headset-mic", 139b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = "voice-speaker-mic", 140b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_HEADSET_MIC] = "voice-headset-mic", 141b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HDMI_MIC] = "hdmi-mic", 142b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_BT_SCO_MIC] = "bt-sco-mic", 1439f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda [SND_DEVICE_IN_BT_SCO_MIC_WB] = "bt-sco-mic-wb", 144b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_CAMCORDER_MIC] = "camcorder-mic", 145b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_EF] = "voice-dmic-ef", 146b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_BS] = "voice-dmic-bs", 147b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = "voice-dmic-ef-tmus", 148b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = "voice-speaker-dmic-ef", 149b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = "voice-speaker-dmic-bs", 150b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = "voice-tty-full-headset-mic", 151b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = "voice-tty-vco-handset-mic", 152b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = "voice-tty-hco-headset-mic", 153b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_MIC] = "voice-rec-mic", 154b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = "voice-rec-dmic-ef", 155b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = "voice-rec-dmic-bs", 156b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = "voice-rec-dmic-ef-fluence", 157b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = "voice-rec-dmic-bs-fluence", 158b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent}; 159b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 160b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent/* ACDB IDs (audio DSP path configuration IDs) for each sound device */ 161b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic const int acdb_device_table[SND_DEVICE_MAX] = { 162b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_NONE] = -1, 163b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HANDSET] = 7, 164b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER] = 14, 165b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_REVERSE] = 14, 166b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HEADPHONES] = 10, 167b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES] = 10, 168b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_SPEAKER] = 14, 169b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_HEADPHONES] = 10, 170b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_HDMI] = 18, 171b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_SPEAKER_AND_HDMI] = 14, 172b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_BT_SCO] = 22, 1739f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda [SND_DEVICE_OUT_BT_SCO_WB] = 39, 174b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_HANDSET_TMUS] = 81, 175b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES] = 17, 176b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES] = 17, 177b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET] = 37, 178b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 179b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HANDSET_MIC] = 4, 180b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_SPEAKER_MIC] = 4, 181b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HEADSET_MIC] = 8, 182b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HANDSET_MIC_AEC] = 40, 183b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_SPEAKER_MIC_AEC] = 42, 184b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HEADSET_MIC_AEC] = 47, 185b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_MIC] = 11, 186b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_HEADSET_MIC] = 8, 187b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_HDMI_MIC] = 4, 188b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_BT_SCO_MIC] = 21, 1899f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda [SND_DEVICE_IN_BT_SCO_MIC_WB] = 38, 190b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_CAMCORDER_MIC] = 61, 191b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_EF] = 6, 192b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_BS] = 5, 193b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_DMIC_EF_TMUS] = 91, 194b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF] = 13, 195b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS] = 12, 196b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC] = 16, 197b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC] = 36, 198b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC] = 16, 199b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_MIC] = 62, 200b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* TODO: Update with proper acdb ids */ 201b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_EF] = 62, 202b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_BS] = 62, 203b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE] = 6, 204b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent [SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE] = 5, 205b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent}; 206b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 2077ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George#define DEEP_BUFFER_PLATFORM_DELAY (29*1000LL) 2087ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George#define LOW_LATENCY_PLATFORM_DELAY (13*1000LL) 2097ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George 210b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic pthread_once_t check_op_once_ctl = PTHREAD_ONCE_INIT; 211b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic bool is_tmus = false; 212b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 213b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic void check_operator() 214b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 215b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char value[PROPERTY_VALUE_MAX]; 216b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int mccmnc; 217b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("gsm.sim.operator.numeric",value,"0"); 218b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent mccmnc = atoi(value); 219b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGD("%s: tmus mccmnc %d", __func__, mccmnc); 220b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent switch(mccmnc) { 221b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* TMUS MCC(310), MNC(490, 260, 026) */ 222b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 310490: 223b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 310260: 224b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 310026: 225b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent is_tmus = true; 226b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent break; 227b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 228b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 229b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 230b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentbool is_operator_tmus() 231b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 232b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent pthread_once(&check_op_once_ctl, check_operator); 233b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return is_tmus; 234b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 235b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 236b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentstatic int set_echo_reference(struct mixer *mixer, const char* ec_ref) 237b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 238b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct mixer_ctl *ctl; 239b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent const char *mixer_ctl_name = "EC_REF_RX"; 240b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 241b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ctl = mixer_get_ctl_by_name(mixer, mixer_ctl_name); 242b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!ctl) { 243b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Could not get ctl for mixer cmd - %s", 244b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, mixer_ctl_name); 245b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return -EINVAL; 246b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 247b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("Setting EC Reference: %s", ec_ref); 248b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent mixer_ctl_set_enum_by_string(ctl, ec_ref); 249b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return 0; 250b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 251b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 252b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentvoid *platform_init(struct audio_device *adev) 253b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 254b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char platform[PROPERTY_VALUE_MAX]; 255b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char baseband[PROPERTY_VALUE_MAX]; 256b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char value[PROPERTY_VALUE_MAX]; 257b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data; 258b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 2591b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo adev->mixer = mixer_open(MIXER_CARD); 2601b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo 2611b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo if (!adev->mixer) { 2621b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo ALOGE("Unable to open the mixer, aborting."); 2631b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo return NULL; 2641b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo } 2651b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo 2661b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo adev->audio_route = audio_route_init(MIXER_CARD, MIXER_XML_PATH); 2671b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo if (!adev->audio_route) { 2681b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo ALOGE("%s: Failed to init audio route controls, aborting.", __func__); 2691b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo return NULL; 2701b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo } 2711b9f4b3708d1ed1204bdb1dec370ad2e9db7a779sangwoo 272b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data = calloc(1, sizeof(struct platform_data)); 273b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 274b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->adev = adev; 275b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->dualmic_config = DUALMIC_CONFIG_NONE; 276b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_spkr_mode = false; 277b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_voice_call = false; 278b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_voice_rec = false; 279b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 280b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("persist.audio.dualmic.config",value,""); 281b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!strcmp("broadside", value)) { 282b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->dualmic_config = DUALMIC_CONFIG_BROADSIDE; 283b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent adev->acdb_settings |= DMIC_FLAG; 284b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (!strcmp("endfire", value)) { 285b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->dualmic_config = DUALMIC_CONFIG_ENDFIRE; 286b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent adev->acdb_settings |= DMIC_FLAG; 287b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 288b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 289b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->dualmic_config != DUALMIC_CONFIG_NONE) { 290b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("persist.audio.fluence.voicecall",value,""); 291b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!strcmp("true", value)) { 292b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_voice_call = true; 293b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 294b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 295b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("persist.audio.fluence.voicerec",value,""); 296b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!strcmp("true", value)) { 297b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_voice_rec = true; 298b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 299b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 300b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("persist.audio.fluence.speaker",value,""); 301b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!strcmp("true", value)) { 302b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->fluence_in_spkr_mode = true; 303b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 304b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 305b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 306b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_handle = dlopen(LIB_ACDB_LOADER, RTLD_NOW); 307b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->acdb_handle == NULL) { 308b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: DLOPEN failed for %s", __func__, LIB_ACDB_LOADER); 309b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 310b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: DLOPEN successful for %s", __func__, LIB_ACDB_LOADER); 311b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_deallocate = (acdb_deallocate_t)dlsym(my_data->acdb_handle, 312b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "acdb_loader_deallocate_ACDB"); 313b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_send_audio_cal = (acdb_send_audio_cal_t)dlsym(my_data->acdb_handle, 314b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "acdb_loader_send_audio_cal"); 315b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!my_data->acdb_send_audio_cal) 316b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGW("%s: Could not find the symbol acdb_send_audio_cal from %s", 317b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, LIB_ACDB_LOADER); 318b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_send_voice_cal = (acdb_send_voice_cal_t)dlsym(my_data->acdb_handle, 319b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "acdb_loader_send_voice_cal"); 320b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_init = (acdb_init_t)dlsym(my_data->acdb_handle, 321b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "acdb_loader_init_ACDB"); 322b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->acdb_init == NULL) 323b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error %s for acdb_loader_init_ACDB", __func__, dlerror()); 324b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 325b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_init(); 326b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 327b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 328b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* If platform is Fusion3, load CSD Client specific symbols 329b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * Voice call is handled by MDM and apps processor talks to 330b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent * MDM through CSD Client 331b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent */ 332b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("ro.board.platform", platform, ""); 333b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent property_get("ro.baseband", baseband, ""); 334b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!strcmp("msm8960", platform) && !strcmp("mdm", baseband)) { 335b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_client = dlopen(LIB_CSD_CLIENT, RTLD_NOW); 336b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client == NULL) 337b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: DLOPEN failed for %s", __func__, LIB_CSD_CLIENT); 338b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 339b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 340b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 341b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: DLOPEN successful for %s", __func__, LIB_CSD_CLIENT); 342b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_client_deinit = (csd_client_deinit_t)dlsym(my_data->csd_client, 343b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_deinit"); 344b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_disable_device = (csd_disable_device_t)dlsym(my_data->csd_client, 345b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_disable_device"); 346b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_enable_device = (csd_enable_device_t)dlsym(my_data->csd_client, 347b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_enable_device"); 348b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_start_voice = (csd_start_voice_t)dlsym(my_data->csd_client, 349b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_start_voice"); 350b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_stop_voice = (csd_stop_voice_t)dlsym(my_data->csd_client, 351b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_stop_voice"); 352b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_volume = (csd_volume_t)dlsym(my_data->csd_client, 353b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_volume"); 354b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_mic_mute = (csd_mic_mute_t)dlsym(my_data->csd_client, 355b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_mic_mute"); 356b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_client_init = (csd_client_init_t)dlsym(my_data->csd_client, 357b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent "csd_client_init"); 358b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 359b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client_init == NULL) { 360b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error %s for csd_client_init", __func__, dlerror()); 361b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 362b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->csd_client_init(); 363b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 364b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 365b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 366b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return my_data; 367b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 368b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 369b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentvoid platform_deinit(void *platform) 370b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 371b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent free(platform); 372b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 373b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 374b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentconst char *platform_get_snd_device_name(snd_device_t snd_device) 375b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 376b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device >= SND_DEVICE_MIN && snd_device < SND_DEVICE_MAX) 377b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return device_table[snd_device]; 378b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 3796402646dbd962f62c37abbb1d435907d54da77ddRavi Kumar Alamanda return "none"; 380b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 381b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 382299760a41231bd0f6d9991fb189977347365c72bRavi Kumar Alamandavoid platform_add_backend_name(void *platform __unused, char *mixer_path, 383299760a41231bd0f6d9991fb189977347365c72bRavi Kumar Alamanda snd_device_t snd_device) 384b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 385b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device == SND_DEVICE_IN_BT_SCO_MIC) 386b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent strcat(mixer_path, " bt-sco"); 387b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else if(snd_device == SND_DEVICE_OUT_BT_SCO) 388b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent strcat(mixer_path, " bt-sco"); 389b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else if (snd_device == SND_DEVICE_OUT_HDMI) 390b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent strcat(mixer_path, " hdmi"); 391b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else if (snd_device == SND_DEVICE_OUT_SPEAKER_AND_HDMI) 392b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent strcat(mixer_path, " speaker-and-hdmi"); 3939f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda else if (snd_device == SND_DEVICE_OUT_BT_SCO_WB || 3949f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB) 3959f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda strcat(mixer_path, " bt-sco-wb"); 396b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 397b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 398b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_get_pcm_device_id(audio_usecase_t usecase, int device_type) 399b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 400b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int device_id; 401b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (device_type == PCM_PLAYBACK) 402b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent device_id = pcm_device_table[usecase][0]; 403b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 404b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent device_id = pcm_device_table[usecase][1]; 405b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return device_id; 406b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 407b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 40898c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew Georgeint platform_get_snd_device_index(char *snd_device_index_name __unused) 4095bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George{ 4105bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George return -ENODEV; 4115bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George} 4125bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George 41398c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew Georgeint platform_set_snd_device_acdb_id(snd_device_t snd_device __unused, 41498c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George unsigned int acdb_id __unused) 4155bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George{ 4165bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George return -ENODEV; 4175bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George} 4185bc188456348ebdfc5d3c86414952503ec41bd44Haynes Mathew George 419b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_send_audio_calibration(void *platform, snd_device_t snd_device) 420b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 421b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 422b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int acdb_dev_id, acdb_dev_type; 423b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 424b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_dev_id = acdb_device_table[snd_device]; 425b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (acdb_dev_id < 0) { 426b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Could not find acdb id for device(%d)", 427b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, snd_device); 428b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return -EINVAL; 429b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 430b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->acdb_send_audio_cal) { 431994a693158202488516c48c22534ae2035b5c8faEric Laurent ("%s: sending audio calibration for snd_device(%d) acdb_id(%d)", 432b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, snd_device, acdb_dev_id); 433b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device >= SND_DEVICE_OUT_BEGIN && 434b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device < SND_DEVICE_OUT_END) 435b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_dev_type = ACDB_DEV_TYPE_OUT; 436b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 437b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_dev_type = ACDB_DEV_TYPE_IN; 438b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->acdb_send_audio_cal(acdb_dev_id, acdb_dev_type); 439b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 440b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return 0; 441b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 442b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 443b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_switch_voice_call_device_pre(void *platform) 444b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 445b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 446b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 447b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 448b09e4a04c7a8ca770affbf48f154222ccd083f4bRavi Kumar Alamanda if (my_data->csd_client != NULL && 449b09e4a04c7a8ca770affbf48f154222ccd083f4bRavi Kumar Alamanda voice_is_in_call(my_data->adev)) { 450b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* This must be called before disabling the mixer controls on APQ side */ 451b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_disable_device == NULL) { 452b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error for csd_disable_device", __func__); 453b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 454b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_disable_device(); 455b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 456b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_client_disable_device, failed, error %d", 457b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, ret); 458b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 459b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 460b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 461b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 462b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 463b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 464b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_switch_voice_call_device_post(void *platform, 465b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device_t out_snd_device, 466b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device_t in_snd_device) 467b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 468b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 469b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int acdb_rx_id, acdb_tx_id; 470b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 471b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 472b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 473b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_enable_device == NULL) { 474b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error for csd_enable_device", 475b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__); 476b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 477b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_rx_id = acdb_device_table[out_snd_device]; 478b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_tx_id = acdb_device_table[in_snd_device]; 479b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 480b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (acdb_rx_id > 0 || acdb_tx_id > 0) { 481b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_enable_device(acdb_rx_id, acdb_tx_id, 482b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->adev->acdb_settings); 483b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 484b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_enable_device, failed, error %d", 485b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, ret); 486b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 487b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 488b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Incorrect ACDB IDs (rx: %d tx: %d)", __func__, 489b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent acdb_rx_id, acdb_tx_id); 490b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 491b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 492b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 493b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 494b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 495b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 496b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 4974b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_start_voice_call(void *platform, uint32_t vsid __unused) 498b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 499b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 500b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 501b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 502b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 503b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_start_voice == NULL) { 504b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("dlsym error for csd_client_start_voice"); 505b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = -ENOSYS; 506b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 507b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_start_voice(); 508b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 509b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_start_voice error %d\n", __func__, ret); 510b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 511b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 512b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 513b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 514b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 515b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 516b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 5174b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_stop_voice_call(void *platform, uint32_t vsid __unused) 518b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 519b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 520b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 521b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 522b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 523b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_stop_voice == NULL) { 524b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("dlsym error for csd_stop_voice"); 525b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 526b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_stop_voice(); 527b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 528b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_stop_voice error %d\n", __func__, ret); 529b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 530b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 531b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 532b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 533b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 534b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 535b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 536b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_set_voice_volume(void *platform, int volume) 537b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 538b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 539b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 540b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 541b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 542b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_volume == NULL) { 543b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error for csd_volume", __func__); 544b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 545b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_volume(volume); 546b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 547b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_volume error %d", __func__, ret); 548b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 549b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 550b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 551b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: No CSD Client present", __func__); 552b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 553b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 554b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 555b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 556b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 557b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_set_mic_mute(void *platform, bool state) 558b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 559b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 560b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int ret = 0; 561b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 562b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->adev->mode == AUDIO_MODE_IN_CALL) { 563b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_client) { 564b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->csd_mic_mute == NULL) { 565b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: dlsym error for csd_mic_mute", __func__); 566b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 567b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ret = my_data->csd_mic_mute(state); 568b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (ret < 0) { 569b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: csd_mic_mute error %d", __func__, ret); 570b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 571b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 572b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 573b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: No CSD Client present", __func__); 574b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 575b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 576b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 577b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return ret; 578b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 579b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 5804b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_set_device_mute(void *platform __unused, bool state __unused, char *dir __unused) 5814b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava{ 58224ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George ALOGE("%s: Not implemented", __func__); 5834b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava return -ENOSYS; 5844b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava} 5854b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 586b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentsnd_device_t platform_get_output_snd_device(void *platform, audio_devices_t devices) 587b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 588b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 589b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct audio_device *adev = my_data->adev; 590b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent audio_mode_t mode = adev->mode; 591b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device_t snd_device = SND_DEVICE_NONE; 592b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 593b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: enter: output devices(%#x)", __func__, devices); 594b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (devices == AUDIO_DEVICE_NONE || 595b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent devices & AUDIO_DEVICE_BIT_IN) { 596b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: Invalid output devices (%#x)", __func__, devices); 597b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 598b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 599b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 600b09e4a04c7a8ca770affbf48f154222ccd083f4bRavi Kumar Alamanda if (voice_is_in_call(adev)) { 601b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || 602b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { 60324ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George if (adev->voice.tty_mode == TTY_MODE_FULL) 604b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES; 60524ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George else if (adev->voice.tty_mode == TTY_MODE_VCO) 606b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES; 60724ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George else if (adev->voice.tty_mode == TTY_MODE_HCO) 608b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET; 609b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 610b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_HEADPHONES; 611b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) { 6129f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda if (adev->bt_wb_speech_enabled) { 6139f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_OUT_BT_SCO_WB; 6149f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } else { 6159f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_OUT_BT_SCO; 6169f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } 617b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { 618b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_SPEAKER; 619b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { 620b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (is_operator_tmus()) 621b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_VOICE_HANDSET_TMUS; 622b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 623b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_HANDSET; 624b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 625b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device != SND_DEVICE_NONE) { 626b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 627b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 628b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 629b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 630b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (popcount(devices) == 2) { 631b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADPHONE | 632b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_DEVICE_OUT_SPEAKER)) { 633b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; 634b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices == (AUDIO_DEVICE_OUT_WIRED_HEADSET | 635b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_DEVICE_OUT_SPEAKER)) { 636b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES; 637b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices == (AUDIO_DEVICE_OUT_AUX_DIGITAL | 638b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_DEVICE_OUT_SPEAKER)) { 639b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_SPEAKER_AND_HDMI; 640b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 641b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Invalid combo device(%#x)", __func__, devices); 642b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 643b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 644b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device != SND_DEVICE_NONE) { 645b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 646b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 647b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 648b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 649b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (popcount(devices) != 1) { 650b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Invalid output devices(%#x)", __func__, devices); 651b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 652b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 653b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 654b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (devices & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || 655b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent devices & AUDIO_DEVICE_OUT_WIRED_HEADSET) { 656b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_HEADPHONES; 657b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_SPEAKER) { 658b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (adev->speaker_lr_swap) 659b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_SPEAKER_REVERSE; 660b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 661b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_SPEAKER; 662b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_ALL_SCO) { 6639f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda if (adev->bt_wb_speech_enabled) { 6649f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_OUT_BT_SCO_WB; 6659f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } else { 6669f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_OUT_BT_SCO; 6679f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } 668b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) { 669b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_HDMI ; 670b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (devices & AUDIO_DEVICE_OUT_EARPIECE) { 671b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_OUT_HANDSET; 672b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 673b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Unknown device(s) %#x", __func__, devices); 674b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 675b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentexit: 676b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: exit: snd_device(%s)", __func__, device_table[snd_device]); 677b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return snd_device; 678b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 679b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 680b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentsnd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_device) 681b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 682b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 683b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct audio_device *adev = my_data->adev; 684b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent audio_source_t source = (adev->active_input == NULL) ? 685b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_SOURCE_DEFAULT : adev->active_input->source; 686b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 687b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent audio_mode_t mode = adev->mode; 688b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent audio_devices_t in_device = ((adev->active_input == NULL) ? 689b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_DEVICE_NONE : adev->active_input->device) 690b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent & ~AUDIO_DEVICE_BIT_IN; 691b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent audio_channel_mask_t channel_mask = (adev->active_input == NULL) ? 692b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent AUDIO_CHANNEL_IN_MONO : adev->active_input->channel_mask; 693b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device_t snd_device = SND_DEVICE_NONE; 694b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 695b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: enter: out_device(%#x) in_device(%#x)", 696b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, out_device, in_device); 697b09e4a04c7a8ca770affbf48f154222ccd083f4bRavi Kumar Alamanda if ((out_device != AUDIO_DEVICE_NONE) && voice_is_in_call(adev)) { 6984b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava if (adev->voice.tty_mode != TTY_MODE_OFF) { 699b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE || 700b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { 7014b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava switch (adev->voice.tty_mode) { 702b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case TTY_MODE_FULL: 703b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC; 704b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent break; 705b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case TTY_MODE_VCO: 706b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC; 707b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent break; 708b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case TTY_MODE_HCO: 709b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC; 710b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent break; 711b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent default: 7124b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava ALOGE("%s: Invalid TTY mode (%#x)", __func__, adev->voice.tty_mode); 713b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 714b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 715b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 716b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 717b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (out_device & AUDIO_DEVICE_OUT_EARPIECE || 718b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) { 719b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->fluence_in_voice_call == false) { 720b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 721b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 722b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { 723b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (is_operator_tmus()) 724b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_DMIC_EF_TMUS; 725b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 726b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_DMIC_EF; 727b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if(my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) 728b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_DMIC_BS; 729b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else 730b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 731b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 732b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { 733b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_HEADSET_MIC; 734b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_ALL_SCO) { 7359f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda if (adev->bt_wb_speech_enabled) { 7369f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; 7379f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } else { 7389f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC; 7399f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } 740b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) { 741b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode && 742b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { 743b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF; 744b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (my_data->fluence_in_voice_call && my_data->fluence_in_spkr_mode && 745b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) { 746b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS; 747b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 748b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC; 749b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 750b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 751b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (source == AUDIO_SOURCE_CAMCORDER) { 752b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC || 753b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent in_device & AUDIO_DEVICE_IN_BACK_MIC) { 754b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_CAMCORDER_MIC; 755b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 756b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (source == AUDIO_SOURCE_VOICE_RECOGNITION) { 757b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { 758b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (my_data->dualmic_config == DUALMIC_CONFIG_ENDFIRE) { 759b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) 760b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF; 761b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else if (my_data->fluence_in_voice_rec) 762b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE; 763b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (my_data->dualmic_config == DUALMIC_CONFIG_BROADSIDE) { 764b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (channel_mask == AUDIO_CHANNEL_IN_FRONT_BACK) 765b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS; 766b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent else if (my_data->fluence_in_voice_rec) 767b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE; 768b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 769b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 770b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device == SND_DEVICE_NONE) { 771b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_VOICE_REC_MIC; 772b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 773b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 774b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (source == AUDIO_SOURCE_VOICE_COMMUNICATION) { 775b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (out_device & AUDIO_DEVICE_OUT_SPEAKER) 776b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent in_device = AUDIO_DEVICE_IN_BACK_MIC; 777b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (adev->active_input) { 778b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (adev->active_input->enable_aec) { 779b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { 780b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC; 781b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { 782b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC_AEC; 783b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { 784b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HEADSET_MIC_AEC; 785b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 786b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent set_echo_reference(adev->mixer, "SLIM_RX"); 787b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else 788b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent set_echo_reference(adev->mixer, "NONE"); 789b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 790b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (source == AUDIO_SOURCE_DEFAULT) { 791b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 792b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 793b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 794b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 795b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (snd_device != SND_DEVICE_NONE) { 796b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent goto exit; 797b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 798b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 799b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (in_device != AUDIO_DEVICE_NONE && 800b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent !(in_device & AUDIO_DEVICE_IN_VOICE_CALL) && 801b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent !(in_device & AUDIO_DEVICE_IN_COMMUNICATION)) { 802b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { 803b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 804b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_BACK_MIC) { 805b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_SPEAKER_MIC; 806b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_WIRED_HEADSET) { 807b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HEADSET_MIC; 808b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET) { 8099f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda if (adev->bt_wb_speech_enabled) { 8109f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; 8119f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } else { 8129f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC; 8139f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } 814b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (in_device & AUDIO_DEVICE_IN_AUX_DIGITAL) { 815b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HDMI_MIC; 816b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 817b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Unknown input device(s) %#x", __func__, in_device); 818b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGW("%s: Using default handset-mic", __func__); 819b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 820b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 821b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 822b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (out_device & AUDIO_DEVICE_OUT_EARPIECE) { 823b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 824b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET) { 825b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HEADSET_MIC; 826b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_SPEAKER) { 827b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_SPEAKER_MIC; 828b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_WIRED_HEADPHONE) { 829b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 830b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) { 8319f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda if (adev->bt_wb_speech_enabled) { 8329f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC_WB; 8339f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } else { 8349f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda snd_device = SND_DEVICE_IN_BT_SCO_MIC; 8359f3065480c81bf01d3af65bfd3da09e1fb74b520Ravi Kumar Alamanda } 836b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else if (out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL) { 837b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HDMI_MIC; 838b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } else { 839b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Unknown output device(s) %#x", __func__, out_device); 840b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGW("%s: Using default handset-mic", __func__); 841b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent snd_device = SND_DEVICE_IN_HANDSET_MIC; 842b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 843b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 844b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentexit: 845b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("%s: exit: in_snd_device(%s)", __func__, device_table[snd_device]); 846b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return snd_device; 847b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 848b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 849b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurentint platform_set_hdmi_channels(void *platform, int channel_count) 850b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 851b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct platform_data *my_data = (struct platform_data *)platform; 852b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct audio_device *adev = my_data->adev; 853b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct mixer_ctl *ctl; 854b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent const char *channel_cnt_str = NULL; 855b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent const char *mixer_ctl_name = "HDMI_RX Channels"; 856b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent switch (channel_count) { 857b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 8: 858b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Eight"; break; 859b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 7: 860b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Seven"; break; 861b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 6: 862b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Six"; break; 863b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 5: 864b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Five"; break; 865b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 4: 866b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Four"; break; 867b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent case 3: 868b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Three"; break; 869b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent default: 870b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_cnt_str = "Two"; break; 871b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 872b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name); 873b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (!ctl) { 874b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("%s: Could not get ctl for mixer cmd - %s", 875b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent __func__, mixer_ctl_name); 876b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return -EINVAL; 877b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 878b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGV("HDMI channel count: %s", channel_cnt_str); 879b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent mixer_ctl_set_enum_by_string(ctl, channel_cnt_str); 880b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return 0; 881b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 882b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 88324ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew Georgeint platform_edid_get_max_channels(void *platform __unused) 884b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent{ 885b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent FILE *file; 886b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent struct audio_block_header header; 887b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char block[MAX_SAD_BLOCKS * SAD_BLOCK_SIZE]; 888b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent char *sad = block; 889b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int num_audio_blocks; 890b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int channel_count; 891b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int max_channels = 0; 892b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent int i; 893b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 894b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent file = fopen(AUDIO_DATA_BLOCK_PATH, "rb"); 895b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (file == NULL) { 896b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent ALOGE("Unable to open '%s'", AUDIO_DATA_BLOCK_PATH); 897b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return 0; 898b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 899b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 900b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Read audio block header */ 901b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent fread(&header, 1, sizeof(header), file); 902b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 903b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Read SAD blocks, clamping the maximum size for safety */ 904b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (header.length > (int)sizeof(block)) 905b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent header.length = (int)sizeof(block); 906b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent fread(&block, header.length, 1, file); 907b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 908b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent fclose(file); 909b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 910b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Calculate the number of SAD blocks */ 911b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent num_audio_blocks = header.length / SAD_BLOCK_SIZE; 912b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 913b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent for (i = 0; i < num_audio_blocks; i++) { 914b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Only consider LPCM blocks */ 915b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if ((sad[0] >> 3) != EDID_FORMAT_LPCM) 916b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent continue; 917b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 918b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent channel_count = (sad[0] & 0x7) + 1; 919b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent if (channel_count > max_channels) 920b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent max_channels = channel_count; 921b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 922b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent /* Advance to next block */ 923b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent sad += 3; 924b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent } 925b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent 926b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent return max_channels; 927b23d5286490ad2dc0edf919d52428fa02dc2b2dcEric Laurent} 9287ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George 9294b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_set_incall_recording_session_id(void *platform __unused, 9304b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava uint32_t session_id __unused, int rec_mode __unused) 9314b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava{ 93224ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George ALOGE("%s: Not implemented", __func__); 9334b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava return -ENOSYS; 9344b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava} 9354b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 9364b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_stop_incall_recording_usecase(void *platform __unused) 9374b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava{ 93824ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George ALOGE("%s: Not implemented", __func__); 9394b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava return -ENOSYS; 9404b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava} 9414b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 9424b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_start_incall_music_usecase(void *platform __unused) 9434b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava{ 94424ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George ALOGE("%s: Not implemented", __func__); 9454b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava return -ENOSYS; 9464b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava} 9474b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 9484b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastavaint platform_stop_incall_music_usecase(void *platform __unused) 9494b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava{ 95024ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George ALOGE("%s: Not implemented", __func__); 9514b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava return -ENOSYS; 9524b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava} 9534b89e37ad290ef955abf8ac1d151728303311345Vineeta Srivastava 9547ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George/* Delay in Us */ 9557ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew Georgeint64_t platform_render_latency(audio_usecase_t usecase) 9567ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George{ 9577ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George switch (usecase) { 9587ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George case USECASE_AUDIO_PLAYBACK_DEEP_BUFFER: 9597ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George return DEEP_BUFFER_PLATFORM_DELAY; 9607ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George case USECASE_AUDIO_PLAYBACK_LOW_LATENCY: 9617ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George return LOW_LATENCY_PLATFORM_DELAY; 9627ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George default: 9637ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George return 0; 9647ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George } 9657ff216f80f6e53235b4239c6fb7da9b0d5127738Haynes Mathew George} 96683281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda 96724ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew Georgeint platform_switch_voice_call_enable_device_config(void *platform __unused, 96824ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George snd_device_t out_snd_device __unused, 96924ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George snd_device_t in_snd_device __unused) 97083281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda{ 97183281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda return 0; 97283281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda} 97383281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda 97424ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew Georgeint platform_switch_voice_call_usecase_route_post(void *platform __unused, 97524ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George snd_device_t out_snd_device __unused, 97624ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George snd_device_t in_snd_device __unused) 97783281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda{ 97883281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda return 0; 97983281a951af159ca00517f6132fab39727b293f5Ravi Kumar Alamanda} 98024ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George 98124ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew Georgeint platform_get_sample_rate(void *platform __unused, uint32_t *rate __unused) 98224ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George{ 98324ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George return -ENOSYS; 98424ca9ade8ff9550a1f30e28c6008e3b0832ab15fHaynes Mathew George} 98598c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George 98698c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew Georgeint platform_get_usecase_index(const char * usecase __unused) 98798c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George{ 98898c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George return -ENOSYS; 98998c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George} 99098c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George 99198c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew Georgeint platform_set_usecase_pcm_id(audio_usecase_t usecase __unused, int32_t type __unused, 99298c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George int32_t pcm_id __unused) 99398c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George{ 99498c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George return -ENOSYS; 99598c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George} 99698c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George 99798c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew Georgeint platform_set_snd_device_backend(snd_device_t device __unused, 99898c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George const char *backend __unused) 99998c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George{ 100098c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George return -ENOSYS; 100198c95622da1e906d32dde6b6651ed5b270b9b5f1Haynes Mathew George} 1002cefbbac40220d4e7690d204eecff5f6ae3f63069Eric Laurent 1003cefbbac40220d4e7690d204eecff5f6ae3f63069Eric Laurentvoid platform_set_echo_reference(struct audio_device *adev, bool enable, audio_devices_t out_device) 1004cefbbac40220d4e7690d204eecff5f6ae3f63069Eric Laurent{ 1005cefbbac40220d4e7690d204eecff5f6ae3f63069Eric Laurent return; 1006cefbbac40220d4e7690d204eecff5f6ae3f63069Eric Laurent} 1007