Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 The Android Open Source Project |
| 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 | #include <hardware/audio.h> |
Ravi Kumar Alamanda | f70ffb4 | 2013-04-16 15:55:53 -0700 | [diff] [blame^] | 18 | #include <hardware/audio_effect.h> |
| 19 | #include <audio_effects/effect_aec.h> |
| 20 | #include <audio_effects/effect_ns.h> |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 21 | |
| 22 | #include <tinyalsa/asoundlib.h> |
| 23 | |
| 24 | #include <audio_route/audio_route.h> |
| 25 | |
| 26 | #define ACDB_DEV_TYPE_OUT 1 |
| 27 | #define ACDB_DEV_TYPE_IN 2 |
| 28 | |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 29 | #define DUALMIC_CONFIG_NONE 0 /* Target does not contain 2 mics */ |
| 30 | #define DUALMIC_CONFIG_ENDFIRE 1 |
| 31 | #define DUALMIC_CONFIG_BROADSIDE 2 |
| 32 | |
Ravi Kumar Alamanda | 71c84b7 | 2013-03-10 23:50:28 -0700 | [diff] [blame] | 33 | /* |
| 34 | * Below are the devices for which is back end is same, SLIMBUS_0_RX. |
| 35 | * All these devices are handled by the internal HW codec. We can |
| 36 | * enable any one of these devices at any time |
| 37 | */ |
| 38 | #define AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND \ |
| 39 | (AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | \ |
| 40 | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE) |
| 41 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 42 | /* Sound devices specific to the platform |
| 43 | * The DEVICE_OUT_* and DEVICE_IN_* should be mapped to these sound |
| 44 | * devices to enable corresponding mixer paths |
| 45 | */ |
| 46 | typedef enum { |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 47 | SND_DEVICE_NONE = 0, |
| 48 | |
| 49 | /* Playback devices */ |
| 50 | SND_DEVICE_MIN, |
| 51 | SND_DEVICE_OUT_BEGIN = SND_DEVICE_MIN, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 52 | SND_DEVICE_OUT_HANDSET = SND_DEVICE_OUT_BEGIN, |
| 53 | SND_DEVICE_OUT_SPEAKER, |
| 54 | SND_DEVICE_OUT_HEADPHONES, |
| 55 | SND_DEVICE_OUT_SPEAKER_AND_HEADPHONES, |
| 56 | SND_DEVICE_OUT_VOICE_SPEAKER, |
| 57 | SND_DEVICE_OUT_VOICE_HEADPHONES, |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 58 | SND_DEVICE_OUT_HDMI, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 59 | SND_DEVICE_OUT_SPEAKER_AND_HDMI, |
| 60 | SND_DEVICE_OUT_BT_SCO, |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 61 | SND_DEVICE_OUT_VOICE_HANDSET_TMUS, |
Ravi Kumar Alamanda | f996704 | 2013-02-14 19:35:14 -0800 | [diff] [blame] | 62 | SND_DEVICE_OUT_VOICE_TTY_FULL_HEADPHONES, |
| 63 | SND_DEVICE_OUT_VOICE_TTY_VCO_HEADPHONES, |
| 64 | SND_DEVICE_OUT_VOICE_TTY_HCO_HANDSET, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 65 | SND_DEVICE_OUT_END, |
| 66 | |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 67 | /* |
| 68 | * Note: IN_BEGIN should be same as OUT_END because total number of devices |
| 69 | * SND_DEVICES_MAX should not exceed MAX_RX + MAX_TX devices. |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 70 | */ |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 71 | /* Capture devices */ |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 72 | SND_DEVICE_IN_BEGIN = SND_DEVICE_OUT_END, |
| 73 | SND_DEVICE_IN_HANDSET_MIC = SND_DEVICE_IN_BEGIN, |
| 74 | SND_DEVICE_IN_SPEAKER_MIC, |
| 75 | SND_DEVICE_IN_HEADSET_MIC, |
Ravi Kumar Alamanda | f70ffb4 | 2013-04-16 15:55:53 -0700 | [diff] [blame^] | 76 | SND_DEVICE_IN_HANDSET_MIC_AEC, |
| 77 | SND_DEVICE_IN_SPEAKER_MIC_AEC, |
| 78 | SND_DEVICE_IN_HEADSET_MIC_AEC, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 79 | SND_DEVICE_IN_VOICE_SPEAKER_MIC, |
| 80 | SND_DEVICE_IN_VOICE_HEADSET_MIC, |
| 81 | SND_DEVICE_IN_HDMI_MIC, |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 82 | SND_DEVICE_IN_BT_SCO_MIC, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 83 | SND_DEVICE_IN_CAMCORDER_MIC, |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 84 | SND_DEVICE_IN_VOICE_DMIC_EF, |
| 85 | SND_DEVICE_IN_VOICE_DMIC_BS, |
| 86 | SND_DEVICE_IN_VOICE_DMIC_EF_TMUS, |
| 87 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC_EF, |
| 88 | SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BS, |
Ravi Kumar Alamanda | f996704 | 2013-02-14 19:35:14 -0800 | [diff] [blame] | 89 | SND_DEVICE_IN_VOICE_TTY_FULL_HEADSET_MIC, |
| 90 | SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC, |
| 91 | SND_DEVICE_IN_VOICE_TTY_HCO_HEADSET_MIC, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 92 | SND_DEVICE_IN_VOICE_REC_MIC, |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 93 | SND_DEVICE_IN_VOICE_REC_DMIC_EF, |
| 94 | SND_DEVICE_IN_VOICE_REC_DMIC_BS, |
Eric Laurent | c840063 | 2013-02-14 19:04:54 -0800 | [diff] [blame] | 95 | SND_DEVICE_IN_VOICE_REC_DMIC_EF_FLUENCE, |
| 96 | SND_DEVICE_IN_VOICE_REC_DMIC_BS_FLUENCE, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 97 | SND_DEVICE_IN_END, |
| 98 | |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 99 | SND_DEVICE_MAX = SND_DEVICE_IN_END, |
| 100 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 101 | } snd_device_t; |
| 102 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 103 | |
| 104 | /* These are the supported use cases by the hardware. |
| 105 | * Each usecase is mapped to a specific PCM device. |
| 106 | * Refer to pcm_device_table[]. |
| 107 | */ |
| 108 | typedef enum { |
| 109 | USECASE_INVALID = -1, |
| 110 | /* Playback usecases */ |
| 111 | USECASE_AUDIO_PLAYBACK_DEEP_BUFFER = 0, |
| 112 | USECASE_AUDIO_PLAYBACK_LOW_LATENCY, |
| 113 | USECASE_AUDIO_PLAYBACK_MULTI_CH, |
| 114 | |
| 115 | /* Capture usecases */ |
| 116 | USECASE_AUDIO_RECORD, |
| 117 | USECASE_AUDIO_RECORD_LOW_LATENCY, |
| 118 | |
| 119 | USECASE_VOICE_CALL, |
| 120 | |
| 121 | AUDIO_USECASE_MAX |
| 122 | } audio_usecase_t; |
| 123 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 124 | #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) |
| 125 | |
| 126 | #define SOUND_CARD 0 |
| 127 | |
| 128 | #define DEFAULT_OUTPUT_SAMPLING_RATE 48000 |
| 129 | |
| 130 | /* |
| 131 | * tinyAlsa library interprets period size as number of frames |
| 132 | * one frame = channel_count * sizeof (pcm sample) |
| 133 | * so if format = 16-bit PCM and channels = Stereo, frame size = 2 ch * 2 = 4 bytes |
| 134 | * DEEP_BUFFER_OUTPUT_PERIOD_SIZE = 1024 means 1024 * 4 = 4096 bytes |
| 135 | * We should take care of returning proper size when AudioFlinger queries for |
| 136 | * the buffer size of an input/output stream |
| 137 | */ |
Sungmin Choi | 5195a4b | 2013-04-03 21:54:22 -0700 | [diff] [blame] | 138 | #ifdef MSM8974 |
| 139 | #define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 1024 |
| 140 | #else |
Ravi Kumar Alamanda | c301186 | 2013-03-19 16:46:58 -0700 | [diff] [blame] | 141 | #define DEEP_BUFFER_OUTPUT_PERIOD_SIZE 960 |
Sungmin Choi | 5195a4b | 2013-04-03 21:54:22 -0700 | [diff] [blame] | 142 | #endif |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 143 | #define DEEP_BUFFER_OUTPUT_PERIOD_COUNT 8 |
| 144 | |
Sungmin Choi | 5195a4b | 2013-04-03 21:54:22 -0700 | [diff] [blame] | 145 | #ifdef MSM8974 |
| 146 | #define LOW_LATENCY_OUTPUT_PERIOD_SIZE 256 |
| 147 | #else |
Ravi Kumar Alamanda | c301186 | 2013-03-19 16:46:58 -0700 | [diff] [blame] | 148 | #define LOW_LATENCY_OUTPUT_PERIOD_SIZE 240 |
Sungmin Choi | 5195a4b | 2013-04-03 21:54:22 -0700 | [diff] [blame] | 149 | #endif |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 150 | #define LOW_LATENCY_OUTPUT_PERIOD_COUNT 2 |
| 151 | |
| 152 | #define HDMI_MULTI_PERIOD_SIZE 336 |
| 153 | #define HDMI_MULTI_PERIOD_COUNT 8 |
| 154 | #define HDMI_MULTI_DEFAULT_CHANNEL_COUNT 6 |
| 155 | #define HDMI_MULTI_PERIOD_BYTES (HDMI_MULTI_PERIOD_SIZE * HDMI_MULTI_DEFAULT_CHANNEL_COUNT * 2) |
| 156 | |
Sungmin Choi | 6336b0d | 2013-04-11 13:04:38 -0700 | [diff] [blame] | 157 | #ifdef MSM8974 |
| 158 | #define AUDIO_CAPTURE_PERIOD_SIZE 512 |
| 159 | #define AUDIO_CAPTURE_PERIOD_COUNT 16 |
| 160 | #else |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 161 | #define AUDIO_CAPTURE_PERIOD_SIZE 320 |
| 162 | #define AUDIO_CAPTURE_PERIOD_COUNT 2 |
Sungmin Choi | 6336b0d | 2013-04-11 13:04:38 -0700 | [diff] [blame] | 163 | #endif |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 164 | |
| 165 | #define MAX_SUPPORTED_CHANNEL_MASKS 2 |
| 166 | |
| 167 | struct stream_out { |
| 168 | struct audio_stream_out stream; |
Eric Laurent | 150dbfe | 2013-02-27 14:31:02 -0800 | [diff] [blame] | 169 | pthread_mutex_t lock; /* see note below on mutex acquisition order */ |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 170 | struct pcm_config config; |
| 171 | struct pcm *pcm; |
| 172 | int standby; |
| 173 | int pcm_device_id; |
| 174 | audio_channel_mask_t channel_mask; |
| 175 | audio_devices_t devices; |
| 176 | audio_output_flags_t flags; |
| 177 | audio_usecase_t usecase; |
| 178 | /* Array of supported channel mask configurations. +1 so that the last entry is always 0 */ |
| 179 | audio_channel_mask_t supported_channel_masks[MAX_SUPPORTED_CHANNEL_MASKS + 1]; |
Eric Laurent | a9024de | 2013-04-04 09:19:12 -0700 | [diff] [blame] | 180 | bool muted; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 181 | |
| 182 | struct audio_device *dev; |
| 183 | }; |
| 184 | |
| 185 | struct stream_in { |
| 186 | struct audio_stream_in stream; |
Eric Laurent | 150dbfe | 2013-02-27 14:31:02 -0800 | [diff] [blame] | 187 | pthread_mutex_t lock; /* see note below on mutex acquisition order */ |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 188 | struct pcm_config config; |
| 189 | struct pcm *pcm; |
| 190 | int standby; |
| 191 | int source; |
| 192 | int pcm_device_id; |
| 193 | int device; |
| 194 | audio_channel_mask_t channel_mask; |
| 195 | audio_usecase_t usecase; |
Ravi Kumar Alamanda | f70ffb4 | 2013-04-16 15:55:53 -0700 | [diff] [blame^] | 196 | bool enable_aec; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 197 | |
| 198 | struct audio_device *dev; |
| 199 | }; |
| 200 | |
| 201 | typedef enum { |
| 202 | PCM_PLAYBACK, |
| 203 | PCM_CAPTURE, |
| 204 | VOICE_CALL |
| 205 | } usecase_type_t; |
| 206 | |
Ravi Kumar Alamanda | 096c87f | 2013-02-28 20:54:57 -0800 | [diff] [blame] | 207 | union stream_ptr { |
| 208 | struct stream_in *in; |
| 209 | struct stream_out *out; |
| 210 | }; |
| 211 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 212 | struct audio_usecase { |
Ravi Kumar Alamanda | 3b1816c | 2013-02-27 23:01:21 -0800 | [diff] [blame] | 213 | struct listnode list; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 214 | audio_usecase_t id; |
| 215 | usecase_type_t type; |
| 216 | audio_devices_t devices; |
Ravi Kumar Alamanda | 71c84b7 | 2013-03-10 23:50:28 -0700 | [diff] [blame] | 217 | snd_device_t out_snd_device; |
| 218 | snd_device_t in_snd_device; |
Ravi Kumar Alamanda | 096c87f | 2013-02-28 20:54:57 -0800 | [diff] [blame] | 219 | union stream_ptr stream; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | typedef void (*acdb_deallocate_t)(); |
| 223 | typedef int (*acdb_init_t)(); |
Ravi Kumar Alamanda | 75d924d | 2013-02-20 21:30:08 -0800 | [diff] [blame] | 224 | typedef void (*acdb_send_audio_cal_t)(int, int); |
| 225 | typedef void (*acdb_send_voice_cal_t)(int, int); |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 226 | |
| 227 | typedef int (*csd_client_init_t)(); |
| 228 | typedef int (*csd_client_deinit_t)(); |
| 229 | typedef int (*csd_disable_device_t)(); |
| 230 | typedef int (*csd_enable_device_t)(int, int, uint32_t); |
| 231 | typedef int (*csd_volume_t)(int); |
| 232 | typedef int (*csd_mic_mute_t)(int); |
| 233 | typedef int (*csd_start_voice_t)(); |
| 234 | typedef int (*csd_stop_voice_t)(); |
| 235 | |
| 236 | struct audio_device { |
| 237 | struct audio_hw_device device; |
Eric Laurent | 150dbfe | 2013-02-27 14:31:02 -0800 | [diff] [blame] | 238 | pthread_mutex_t lock; /* see note below on mutex acquisition order */ |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 239 | struct mixer *mixer; |
| 240 | audio_mode_t mode; |
| 241 | audio_devices_t out_device; |
Eric Laurent | c840063 | 2013-02-14 19:04:54 -0800 | [diff] [blame] | 242 | struct stream_in *active_input; |
Ravi Kumar Alamanda | 096c87f | 2013-02-28 20:54:57 -0800 | [diff] [blame] | 243 | struct stream_out *primary_output; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 244 | int in_call; |
| 245 | float voice_volume; |
| 246 | bool mic_mute; |
| 247 | int tty_mode; |
| 248 | bool bluetooth_nrec; |
| 249 | bool screen_off; |
| 250 | struct pcm *voice_call_rx; |
| 251 | struct pcm *voice_call_tx; |
Ravi Kumar Alamanda | 71c84b7 | 2013-03-10 23:50:28 -0700 | [diff] [blame] | 252 | int snd_dev_ref_cnt[SND_DEVICE_MAX]; |
Ravi Kumar Alamanda | 3b1816c | 2013-02-27 23:01:21 -0800 | [diff] [blame] | 253 | struct listnode usecase_list; |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 254 | struct audio_route *audio_route; |
| 255 | int acdb_settings; |
| 256 | |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 257 | bool mic_type_analog; |
Ravi Kumar Alamanda | 0231779 | 2013-03-04 20:56:50 -0800 | [diff] [blame] | 258 | bool fluence_in_spkr_mode; |
Ravi Kumar Alamanda | 72c411f | 2013-02-12 02:09:33 -0800 | [diff] [blame] | 259 | bool fluence_in_voice_call; |
| 260 | bool fluence_in_voice_rec; |
| 261 | int dualmic_config; |
| 262 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 263 | /* Audio calibration related functions */ |
| 264 | void *acdb_handle; |
| 265 | acdb_init_t acdb_init; |
| 266 | acdb_deallocate_t acdb_deallocate; |
| 267 | acdb_send_audio_cal_t acdb_send_audio_cal; |
| 268 | acdb_send_voice_cal_t acdb_send_voice_cal; |
| 269 | |
| 270 | /* CSD Client related functions for voice call */ |
| 271 | void *csd_client; |
| 272 | csd_client_init_t csd_client_init; |
| 273 | csd_client_deinit_t csd_client_deinit; |
| 274 | csd_disable_device_t csd_disable_device; |
| 275 | csd_enable_device_t csd_enable_device; |
| 276 | csd_volume_t csd_volume; |
| 277 | csd_mic_mute_t csd_mic_mute; |
| 278 | csd_start_voice_t csd_start_voice; |
| 279 | csd_stop_voice_t csd_stop_voice; |
| 280 | }; |
| 281 | |
Eric Laurent | 150dbfe | 2013-02-27 14:31:02 -0800 | [diff] [blame] | 282 | /* |
| 283 | * NOTE: when multiple mutexes have to be acquired, always take the |
| 284 | * stream_in or stream_out mutex first, followed by the audio_device mutex. |
| 285 | */ |
| 286 | |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 287 | struct pcm_config pcm_config_deep_buffer = { |
| 288 | .channels = 2, |
| 289 | .rate = DEFAULT_OUTPUT_SAMPLING_RATE, |
| 290 | .period_size = DEEP_BUFFER_OUTPUT_PERIOD_SIZE, |
| 291 | .period_count = DEEP_BUFFER_OUTPUT_PERIOD_COUNT, |
| 292 | .format = PCM_FORMAT_S16_LE, |
| 293 | .start_threshold = DEEP_BUFFER_OUTPUT_PERIOD_SIZE / 4, |
Ravi Kumar Alamanda | b199506 | 2013-03-21 23:18:20 -0700 | [diff] [blame] | 294 | .stop_threshold = INT_MAX, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 295 | .avail_min = DEEP_BUFFER_OUTPUT_PERIOD_SIZE / 4, |
| 296 | }; |
| 297 | |
| 298 | struct pcm_config pcm_config_low_latency = { |
| 299 | .channels = 2, |
| 300 | .rate = DEFAULT_OUTPUT_SAMPLING_RATE, |
| 301 | .period_size = LOW_LATENCY_OUTPUT_PERIOD_SIZE, |
| 302 | .period_count = LOW_LATENCY_OUTPUT_PERIOD_COUNT, |
| 303 | .format = PCM_FORMAT_S16_LE, |
| 304 | .start_threshold = LOW_LATENCY_OUTPUT_PERIOD_SIZE / 4, |
Ravi Kumar Alamanda | b199506 | 2013-03-21 23:18:20 -0700 | [diff] [blame] | 305 | .stop_threshold = INT_MAX, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 306 | .avail_min = LOW_LATENCY_OUTPUT_PERIOD_SIZE / 4, |
| 307 | }; |
| 308 | |
| 309 | struct pcm_config pcm_config_hdmi_multi = { |
| 310 | .channels = HDMI_MULTI_DEFAULT_CHANNEL_COUNT, /* changed when the stream is opened */ |
| 311 | .rate = DEFAULT_OUTPUT_SAMPLING_RATE, /* changed when the stream is opened */ |
| 312 | .period_size = HDMI_MULTI_PERIOD_SIZE, |
| 313 | .period_count = HDMI_MULTI_PERIOD_COUNT, |
| 314 | .format = PCM_FORMAT_S16_LE, |
| 315 | .start_threshold = 0, |
Ravi Kumar Alamanda | b199506 | 2013-03-21 23:18:20 -0700 | [diff] [blame] | 316 | .stop_threshold = INT_MAX, |
Ravi Kumar Alamanda | 2dfba2b | 2013-01-17 16:50:22 -0800 | [diff] [blame] | 317 | .avail_min = 0, |
| 318 | }; |
| 319 | |
| 320 | struct pcm_config pcm_config_audio_capture = { |
| 321 | .channels = 2, |
| 322 | .period_size = AUDIO_CAPTURE_PERIOD_SIZE, |
| 323 | .period_count = AUDIO_CAPTURE_PERIOD_COUNT, |
| 324 | .format = PCM_FORMAT_S16_LE, |
| 325 | }; |
| 326 | |
| 327 | struct pcm_config pcm_config_voice_call = { |
| 328 | .channels = 1, |
| 329 | .rate = 8000, |
| 330 | .period_size = 160, |
| 331 | .period_count = 2, |
| 332 | .format = PCM_FORMAT_S16_LE, |
| 333 | }; |
| 334 | |