blob: 97a2ad44374893deb790702873d3c29ed85b3830 [file] [log] [blame]
Xiaoyu Ye91553e62017-11-21 17:35:50 -08001/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -08002
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions are
5met:
6 * Redistributions of source code must retain the above copyright
7 notice, this list of conditions and the following disclaimer.
8 * Redistributions in binary form must reproduce the above
9 copyright notice, this list of conditions and the following
10 disclaimer in the documentation and/or other materials provided
11 with the distribution.
12 * Neither the name of The Linux Foundation nor the names of its
13 contributors may be used to endorse or promote products derived
14 from this software without specific prior written permission.
15
16THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
27
28#define LOG_TAG "audio_hw_hfp"
29/*#define LOG_NDEBUG 0*/
30#define LOG_NDDEBUG 0
31
32#include <errno.h>
33#include <math.h>
34#include <cutils/log.h>
35
36#include "audio_hw.h"
37#include "platform.h"
38#include "platform_api.h"
39#include <stdlib.h>
40#include <cutils/str_parms.h>
41
Revathi Uddaraju1eac8b02017-05-18 17:13:33 +053042#ifdef DYNAMIC_LOG_ENABLED
43#include <log_xml_parser.h>
44#define LOG_MASK HAL_MOD_FILE_HFP
45#include <log_utils.h>
46#endif
47
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080048#ifdef HFP_ENABLED
49#define AUDIO_PARAMETER_HFP_ENABLE "hfp_enable"
Vimal Puthanveed47e64852013-12-20 13:23:39 -080050#define AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE "hfp_set_sampling_rate"
Amit Shekhar967cab32014-02-07 17:03:21 -080051#define AUDIO_PARAMETER_KEY_HFP_VOLUME "hfp_volume"
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +053052#define AUDIO_PARAMETER_HFP_PCM_DEV_ID "hfp_pcm_dev_id"
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080053
Sudheer Papothi19e43d02014-07-16 02:34:41 +053054#ifdef PLATFORM_MSM8994
55#define HFP_RX_VOLUME "SEC AUXPCM LOOPBACK Volume"
Banajit Goswamida77c452015-10-14 20:45:22 -070056#elif defined PLATFORM_MSM8996
57#define HFP_RX_VOLUME "PRI AUXPCM LOOPBACK Volume"
Xiaoyu Ye91553e62017-11-21 17:35:50 -080058#elif defined (PLATFORM_MSM8998) || defined (PLATFORM_MSMFALCON) || defined (PLATFORM_SDM845) || defined (PLATFORM_SDM670) || defined (PLATFORM_QCS605) || defined (PLATFORM_MSMNILE)
Banajit Goswami4c0dff22016-03-04 18:31:22 -080059#define HFP_RX_VOLUME "SLIMBUS_7 LOOPBACK Volume"
Sudheer Papothi19e43d02014-07-16 02:34:41 +053060#else
61#define HFP_RX_VOLUME "Internal HFP RX Volume"
62#endif
63
Vimal Puthanveed584048b2013-12-11 17:00:50 -080064static int32_t start_hfp(struct audio_device *adev,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080065 struct str_parms *parms);
66
Vimal Puthanveed584048b2013-12-11 17:00:50 -080067static int32_t stop_hfp(struct audio_device *adev);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080068
69struct hfp_module {
70 struct pcm *hfp_sco_rx;
71 struct pcm *hfp_sco_tx;
72 struct pcm *hfp_pcm_rx;
73 struct pcm *hfp_pcm_tx;
74 bool is_hfp_running;
Amit Shekhar967cab32014-02-07 17:03:21 -080075 float hfp_volume;
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +053076 int32_t hfp_pcm_dev_id;
Vimal Puthanveed47e64852013-12-20 13:23:39 -080077 audio_usecase_t ucid;
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080078};
79
80static struct hfp_module hfpmod = {
81 .hfp_sco_rx = NULL,
82 .hfp_sco_tx = NULL,
83 .hfp_pcm_rx = NULL,
84 .hfp_pcm_tx = NULL,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080085 .is_hfp_running = 0,
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +053086 .hfp_volume = 0,
87 .hfp_pcm_dev_id = HFP_ASM_RX_TX,
Vimal Puthanveed47e64852013-12-20 13:23:39 -080088 .ucid = USECASE_AUDIO_HFP_SCO,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -080089};
90static struct pcm_config pcm_config_hfp = {
91 .channels = 1,
92 .rate = 8000,
93 .period_size = 240,
94 .period_count = 2,
95 .format = PCM_FORMAT_S16_LE,
96 .start_threshold = 0,
97 .stop_threshold = INT_MAX,
98 .avail_min = 0,
99};
100
Amit Shekhar967cab32014-02-07 17:03:21 -0800101static int32_t hfp_set_volume(struct audio_device *adev, float value)
102{
103 int32_t vol, ret = 0;
104 struct mixer_ctl *ctl;
Sudheer Papothi19e43d02014-07-16 02:34:41 +0530105 const char *mixer_ctl_name = HFP_RX_VOLUME;
Amit Shekhar967cab32014-02-07 17:03:21 -0800106
107 ALOGV("%s: entry", __func__);
108 ALOGD("%s: (%f)\n", __func__, value);
109
Satya Krishna Pindiproli3ed6d792014-09-09 15:32:25 +0530110 hfpmod.hfp_volume = value;
Amit Shekhar967cab32014-02-07 17:03:21 -0800111 if (value < 0.0) {
112 ALOGW("%s: (%f) Under 0.0, assuming 0.0\n", __func__, value);
113 value = 0.0;
114 } else {
115 value = ((value > 15.000000) ? 1.0 : (value / 15));
116 ALOGW("%s: Volume brought with in range (%f)\n", __func__, value);
117 }
118 vol = lrint((value * 0x2000) + 0.5);
Amit Shekhar967cab32014-02-07 17:03:21 -0800119
120 if (!hfpmod.is_hfp_running) {
121 ALOGV("%s: HFP not active, ignoring set_hfp_volume call", __func__);
122 return -EIO;
123 }
124
125 ALOGD("%s: Setting HFP volume to %d \n", __func__, vol);
126 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
127 if (!ctl) {
128 ALOGE("%s: Could not get ctl for mixer cmd - %s",
129 __func__, mixer_ctl_name);
130 return -EINVAL;
131 }
132 if(mixer_ctl_set_value(ctl, 0, vol) < 0) {
133 ALOGE("%s: Couldn't set HFP Volume: [%d]", __func__, vol);
134 return -EINVAL;
135 }
136
137 ALOGV("%s: exit", __func__);
138 return ret;
139}
140
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800141static int32_t start_hfp(struct audio_device *adev,
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700142 struct str_parms *parms __unused)
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800143{
Satya Krishna Pindiprolif1cd92b2016-04-14 19:05:23 +0530144 int32_t ret = 0;
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800145 struct audio_usecase *uc_info;
146 int32_t pcm_dev_rx_id, pcm_dev_tx_id, pcm_dev_asm_rx_id, pcm_dev_asm_tx_id;
147
148 ALOGD("%s: enter", __func__);
149
150 uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
Haynes Mathew Georgeb51ceb12014-06-30 13:56:18 -0700151
152 if (!uc_info)
153 return -ENOMEM;
154
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800155 uc_info->id = hfpmod.ucid;
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800156 uc_info->type = PCM_HFP_CALL;
157 uc_info->stream.out = adev->primary_output;
158 uc_info->devices = adev->primary_output->devices;
159 uc_info->in_snd_device = SND_DEVICE_NONE;
160 uc_info->out_snd_device = SND_DEVICE_NONE;
161
162 list_add_tail(&adev->usecase_list, &uc_info->list);
163
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800164 select_devices(adev, hfpmod.ucid);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800165
166 pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
167 pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530168 pcm_dev_asm_rx_id = hfpmod.hfp_pcm_dev_id;
169 pcm_dev_asm_tx_id = hfpmod.hfp_pcm_dev_id;
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800170 if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0 ||
171 pcm_dev_asm_rx_id < 0 || pcm_dev_asm_tx_id < 0 ) {
172 ALOGE("%s: Invalid PCM devices (rx: %d tx: %d asm: rx tx %d) for the usecase(%d)",
173 __func__, pcm_dev_rx_id, pcm_dev_tx_id, pcm_dev_asm_rx_id, uc_info->id);
174 ret = -EIO;
175 goto exit;
176 }
177
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530178 ALOGD("%s: HFP PCM devices (rx: %d tx: %d pcm dev id: %d) usecase(%d)",
179 __func__, pcm_dev_rx_id, pcm_dev_tx_id, hfpmod.hfp_pcm_dev_id, uc_info->id);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800180
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800181 hfpmod.hfp_sco_rx = pcm_open(adev->snd_card,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800182 pcm_dev_asm_rx_id,
183 PCM_OUT, &pcm_config_hfp);
184 if (hfpmod.hfp_sco_rx && !pcm_is_ready(hfpmod.hfp_sco_rx)) {
185 ALOGE("%s: %s", __func__, pcm_get_error(hfpmod.hfp_sco_rx));
186 ret = -EIO;
187 goto exit;
188 }
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530189
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800190 hfpmod.hfp_pcm_rx = pcm_open(adev->snd_card,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800191 pcm_dev_rx_id,
192 PCM_OUT, &pcm_config_hfp);
193 if (hfpmod.hfp_pcm_rx && !pcm_is_ready(hfpmod.hfp_pcm_rx)) {
194 ALOGE("%s: %s", __func__, pcm_get_error(hfpmod.hfp_pcm_rx));
195 ret = -EIO;
196 goto exit;
197 }
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530198
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800199 hfpmod.hfp_sco_tx = pcm_open(adev->snd_card,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800200 pcm_dev_asm_tx_id,
201 PCM_IN, &pcm_config_hfp);
202 if (hfpmod.hfp_sco_tx && !pcm_is_ready(hfpmod.hfp_sco_tx)) {
203 ALOGE("%s: %s", __func__, pcm_get_error(hfpmod.hfp_sco_tx));
204 ret = -EIO;
205 goto exit;
206 }
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530207
Apoorv Raghuvanshi84fa2fe2013-12-04 11:57:47 -0800208 hfpmod.hfp_pcm_tx = pcm_open(adev->snd_card,
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800209 pcm_dev_tx_id,
210 PCM_IN, &pcm_config_hfp);
211 if (hfpmod.hfp_pcm_tx && !pcm_is_ready(hfpmod.hfp_pcm_tx)) {
212 ALOGE("%s: %s", __func__, pcm_get_error(hfpmod.hfp_pcm_tx));
213 ret = -EIO;
214 goto exit;
215 }
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530216
Satya Krishna Pindiprolice903a02014-07-28 12:40:56 +0530217 if (pcm_start(hfpmod.hfp_sco_rx) < 0) {
218 ALOGE("%s: pcm start for hfp sco rx failed", __func__);
219 ret = -EINVAL;
220 goto exit;
221 }
222 if (pcm_start(hfpmod.hfp_sco_tx) < 0) {
223 ALOGE("%s: pcm start for hfp sco tx failed", __func__);
224 ret = -EINVAL;
225 goto exit;
226 }
227 if (pcm_start(hfpmod.hfp_pcm_rx) < 0) {
228 ALOGE("%s: pcm start for hfp pcm rx failed", __func__);
229 ret = -EINVAL;
230 goto exit;
231 }
232 if (pcm_start(hfpmod.hfp_pcm_tx) < 0) {
233 ALOGE("%s: pcm start for hfp pcm tx failed", __func__);
234 ret = -EINVAL;
235 goto exit;
236 }
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800237
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800238 hfpmod.is_hfp_running = true;
Amit Shekhar967cab32014-02-07 17:03:21 -0800239 hfp_set_volume(adev, hfpmod.hfp_volume);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800240
241 ALOGD("%s: exit: status(%d)", __func__, ret);
242 return 0;
243
244exit:
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800245 stop_hfp(adev);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800246 ALOGE("%s: Problem in HFP start: status(%d)", __func__, ret);
247 return ret;
248}
249
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800250static int32_t stop_hfp(struct audio_device *adev)
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800251{
Satya Krishna Pindiprolif1cd92b2016-04-14 19:05:23 +0530252 int32_t ret = 0;
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800253 struct audio_usecase *uc_info;
254
255 ALOGD("%s: enter", __func__);
256 hfpmod.is_hfp_running = false;
257
258 /* 1. Close the PCM devices */
259 if (hfpmod.hfp_sco_rx) {
260 pcm_close(hfpmod.hfp_sco_rx);
261 hfpmod.hfp_sco_rx = NULL;
262 }
263 if (hfpmod.hfp_sco_tx) {
264 pcm_close(hfpmod.hfp_sco_tx);
265 hfpmod.hfp_sco_tx = NULL;
266 }
267 if (hfpmod.hfp_pcm_rx) {
268 pcm_close(hfpmod.hfp_pcm_rx);
269 hfpmod.hfp_pcm_rx = NULL;
270 }
271 if (hfpmod.hfp_pcm_tx) {
272 pcm_close(hfpmod.hfp_pcm_tx);
273 hfpmod.hfp_pcm_tx = NULL;
274 }
275
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800276 uc_info = get_usecase_from_list(adev, hfpmod.ucid);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800277 if (uc_info == NULL) {
278 ALOGE("%s: Could not find the usecase (%d) in the list",
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800279 __func__, hfpmod.ucid);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800280 return -EINVAL;
281 }
282
Venkata Narendra Kumar Gutta1bbbf542014-09-04 19:11:25 +0530283 /* 2. Disable echo reference while stopping hfp */
Apoorv Raghuvanshi924b3022015-07-06 15:07:14 -0700284 platform_set_echo_reference(adev, false, uc_info->devices);
Venkata Narendra Kumar Gutta1bbbf542014-09-04 19:11:25 +0530285
286 /* 3. Get and set stream specific mixer controls */
Haynes Mathew George1376ca62014-04-24 11:55:48 -0700287 disable_audio_route(adev, uc_info);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800288
Venkata Narendra Kumar Gutta1bbbf542014-09-04 19:11:25 +0530289 /* 4. Disable the rx and tx devices */
Haynes Mathew George1376ca62014-04-24 11:55:48 -0700290 disable_snd_device(adev, uc_info->out_snd_device);
291 disable_snd_device(adev, uc_info->in_snd_device);
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800292
293 list_remove(&uc_info->list);
294 free(uc_info);
295
296 ALOGD("%s: exit: status(%d)", __func__, ret);
297 return ret;
298}
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800299
Vimal Puthanveed37b4a1c2014-01-07 16:47:47 -0800300bool audio_extn_hfp_is_active(struct audio_device *adev)
301{
302 struct audio_usecase *hfp_usecase = NULL;
Vimal Puthanveed41fcff22014-01-23 15:56:53 -0800303 hfp_usecase = get_usecase_from_list(adev, hfpmod.ucid);
Vimal Puthanveed37b4a1c2014-01-07 16:47:47 -0800304
305 if (hfp_usecase != NULL)
306 return true;
307 else
308 return false;
309}
310
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530311int hfp_set_mic_mute(struct audio_device *adev, bool state)
312{
313 struct mixer_ctl *ctl;
314 const char *mixer_ctl_name = "HFP TX Mute";
Manish Dewangan338c50a2017-09-12 15:22:03 +0530315 long set_values[ ] = {0};
Dhanalakshmi Siddani823dc5a2016-09-28 14:47:26 +0530316
317 ALOGI("%s: enter, state=%d", __func__, state);
318
319 set_values[0] = state;
320 ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
321 if (!ctl) {
322 ALOGE("%s: Could not get ctl for mixer cmd - %s",
323 __func__, mixer_ctl_name);
324 return -EINVAL;
325 }
326 mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values));
327 ALOGV("%s: exit", __func__);
328 return 0;
329}
330
Vimal Puthanveed41fcff22014-01-23 15:56:53 -0800331audio_usecase_t audio_extn_hfp_get_usecase()
332{
333 return hfpmod.ucid;
334}
335
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800336void audio_extn_hfp_set_parameters(struct audio_device *adev, struct str_parms *parms)
337{
338 int ret;
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800339 int rate;
Vimal Puthanveed21e5c762014-01-08 14:10:09 -0800340 int val;
Amit Shekhar967cab32014-02-07 17:03:21 -0800341 float vol;
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800342 char value[32]={0};
343
344 ret = str_parms_get_str(parms, AUDIO_PARAMETER_HFP_ENABLE, value,
345 sizeof(value));
346 if (ret >= 0) {
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530347 if (!strncmp(value, "true", sizeof(value)) && !hfpmod.is_hfp_running)
348 ret = start_hfp(adev,parms);
349 else if (!strncmp(value, "false", sizeof(value)) && hfpmod.is_hfp_running)
350 stop_hfp(adev);
351 else
352 ALOGE("hfp_enable=%s is unsupported", value);
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800353 }
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800354 memset(value, 0, sizeof(value));
355 ret = str_parms_get_str(parms,AUDIO_PARAMETER_HFP_SET_SAMPLING_RATE, value,
356 sizeof(value));
357 if (ret >= 0) {
358 rate = atoi(value);
359 if (rate == 8000){
360 hfpmod.ucid = USECASE_AUDIO_HFP_SCO;
361 pcm_config_hfp.rate = rate;
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700362 } else if (rate == 16000){
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800363 hfpmod.ucid = USECASE_AUDIO_HFP_SCO_WB;
364 pcm_config_hfp.rate = rate;
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700365 } else
Vimal Puthanveed47e64852013-12-20 13:23:39 -0800366 ALOGE("Unsupported rate..");
367 }
Vimal Puthanveed21e5c762014-01-08 14:10:09 -0800368
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700369 if (hfpmod.is_hfp_running) {
Vimal Puthanveed21e5c762014-01-08 14:10:09 -0800370 memset(value, 0, sizeof(value));
371 ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING,
372 value, sizeof(value));
373 if (ret >= 0) {
374 val = atoi(value);
Ravi Kumar Alamandabdf14162014-09-05 16:14:17 -0700375 if (val > 0)
Vimal Puthanveed21e5c762014-01-08 14:10:09 -0800376 select_devices(adev, hfpmod.ucid);
377 }
378 }
Amit Shekhar967cab32014-02-07 17:03:21 -0800379
380 memset(value, 0, sizeof(value));
381 ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HFP_VOLUME,
382 value, sizeof(value));
383 if (ret >= 0) {
384 if (sscanf(value, "%f", &vol) != 1){
385 ALOGE("%s: error in retrieving hfp volume", __func__);
386 ret = -EIO;
387 goto exit;
388 }
389 ALOGD("%s: set_hfp_volume usecase, Vol: [%f]", __func__, vol);
390 hfp_set_volume(adev, vol);
391 }
Satya Krishna Pindiprolic6b0a742017-02-03 14:37:18 +0530392
393 memset(value, 0, sizeof(value));
394 ret = str_parms_get_str(parms, AUDIO_PARAMETER_HFP_PCM_DEV_ID, value, sizeof(value));
395 if (ret >= 0) {
396 hfpmod.hfp_pcm_dev_id = atoi(value);
397 ALOGD("Updating HFP_PCM_DEV_ID as %d from platform XML", hfpmod.hfp_pcm_dev_id);
398 str_parms_del(parms, AUDIO_PARAMETER_HFP_PCM_DEV_ID);
399 }
400
Amit Shekhar967cab32014-02-07 17:03:21 -0800401exit:
402 ALOGV("%s Exit",__func__);
Vimal Puthanveed584048b2013-12-11 17:00:50 -0800403}
Vimal Puthanveed5b4d3f12013-11-05 15:57:39 -0800404#endif /*HFP_ENABLED*/