2013-10-06 21:39:35 +00:00
|
|
|
/*
|
2018-01-23 09:32:30 +00:00
|
|
|
* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
|
2013-10-06 21:39:35 +00:00
|
|
|
* Not a Contribution.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 The Android Open Source Project
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define LOG_TAG "audio_hw_fm"
|
|
|
|
/*#define LOG_NDEBUG 0*/
|
|
|
|
#define LOG_NDDEBUG 0
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <cutils/log.h>
|
2018-04-29 08:33:38 +00:00
|
|
|
#include <unistd.h>
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
#include "audio_hw.h"
|
|
|
|
#include "platform.h"
|
|
|
|
#include "platform_api.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <cutils/str_parms.h>
|
|
|
|
|
2017-05-18 11:43:33 +00:00
|
|
|
#ifdef DYNAMIC_LOG_ENABLED
|
|
|
|
#include <log_xml_parser.h>
|
|
|
|
#define LOG_MASK HAL_MOD_FILE_FM
|
|
|
|
#include <log_utils.h>
|
|
|
|
#endif
|
|
|
|
|
2013-10-06 21:39:35 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_HANDLE_FM "handle_fm"
|
|
|
|
#define AUDIO_PARAMETER_KEY_FM_VOLUME "fm_volume"
|
2014-12-08 11:19:22 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_REC_PLAY_CONC "rec_play_conc_on"
|
2016-01-25 14:15:19 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_FM_MUTE "fm_mute"
|
2018-01-23 09:32:30 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_FM_RESTORE_VOLUME "fm_restore_volume"
|
2018-11-01 06:28:08 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_FM_ROUTING "fm_routing"
|
2018-12-17 11:38:30 +00:00
|
|
|
#define AUDIO_PARAMETER_KEY_FM_STATUS "fm_status"
|
2015-10-01 08:08:37 +00:00
|
|
|
#define FM_LOOPBACK_DRAIN_TIME_MS 2
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
static struct pcm_config pcm_config_fm = {
|
|
|
|
.channels = 2,
|
|
|
|
.rate = 48000,
|
|
|
|
.period_size = 256,
|
|
|
|
.period_count = 4,
|
|
|
|
.format = PCM_FORMAT_S16_LE,
|
|
|
|
.start_threshold = 0,
|
|
|
|
.stop_threshold = INT_MAX,
|
|
|
|
.avail_min = 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct fm_module {
|
|
|
|
struct pcm *fm_pcm_rx;
|
|
|
|
struct pcm *fm_pcm_tx;
|
|
|
|
bool is_fm_running;
|
2016-01-25 14:15:19 +00:00
|
|
|
bool is_fm_muted;
|
2013-11-21 02:31:58 +00:00
|
|
|
float fm_volume;
|
2014-05-30 05:50:27 +00:00
|
|
|
bool restart_fm;
|
2018-11-01 06:28:08 +00:00
|
|
|
audio_devices_t fm_device;
|
2017-05-25 11:55:30 +00:00
|
|
|
card_status_t card_status;
|
2013-10-06 21:39:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct fm_module fmmod = {
|
|
|
|
.fm_pcm_rx = NULL,
|
|
|
|
.fm_pcm_tx = NULL,
|
|
|
|
.fm_volume = 0,
|
|
|
|
.is_fm_running = 0,
|
2016-01-25 14:15:19 +00:00
|
|
|
.is_fm_muted = 0,
|
2014-05-30 05:50:27 +00:00
|
|
|
.restart_fm = 0,
|
2018-11-01 06:28:08 +00:00
|
|
|
.fm_device = 0,
|
2017-05-25 11:55:30 +00:00
|
|
|
.card_status = CARD_STATUS_ONLINE,
|
2013-10-06 21:39:35 +00:00
|
|
|
};
|
|
|
|
|
2015-10-01 08:08:37 +00:00
|
|
|
static int32_t fm_set_volume(struct audio_device *adev, float value, bool persist)
|
2013-10-06 21:39:35 +00:00
|
|
|
{
|
|
|
|
int32_t vol, ret = 0;
|
|
|
|
struct mixer_ctl *ctl;
|
2014-04-11 00:59:02 +00:00
|
|
|
const char *mixer_ctl_name = FM_RX_VOLUME;
|
2013-10-06 21:39:35 +00:00
|
|
|
|
2013-11-21 02:31:58 +00:00
|
|
|
ALOGV("%s: entry", __func__);
|
2013-10-06 21:39:35 +00:00
|
|
|
ALOGD("%s: (%f)\n", __func__, value);
|
|
|
|
|
|
|
|
if (value < 0.0) {
|
|
|
|
ALOGW("%s: (%f) Under 0.0, assuming 0.0\n", __func__, value);
|
|
|
|
value = 0.0;
|
|
|
|
} else if (value > 1.0) {
|
|
|
|
ALOGW("%s: (%f) Over 1.0, assuming 1.0\n", __func__, value);
|
|
|
|
value = 1.0;
|
|
|
|
}
|
|
|
|
vol = lrint((value * 0x2000) + 0.5);
|
2015-10-01 08:08:37 +00:00
|
|
|
if (persist)
|
|
|
|
fmmod.fm_volume = value;
|
2013-10-06 21:39:35 +00:00
|
|
|
|
2016-01-25 14:15:19 +00:00
|
|
|
if (fmmod.is_fm_muted == true && vol > 0) {
|
|
|
|
ALOGD("%s: fm is muted, applying '0' volume instead of '%d'.",
|
|
|
|
__func__, vol);
|
|
|
|
vol = 0;
|
|
|
|
}
|
|
|
|
|
2013-10-06 21:39:35 +00:00
|
|
|
if (!fmmod.is_fm_running) {
|
|
|
|
ALOGV("%s: FM not active, ignoring set_fm_volume call", __func__);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALOGD("%s: Setting FM volume to %d \n", __func__, vol);
|
|
|
|
ctl = mixer_get_ctl_by_name(adev->mixer, mixer_ctl_name);
|
|
|
|
if (!ctl) {
|
|
|
|
ALOGE("%s: Could not get ctl for mixer cmd - %s",
|
|
|
|
__func__, mixer_ctl_name);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2013-11-21 02:31:58 +00:00
|
|
|
mixer_ctl_set_value(ctl, 0, vol);
|
|
|
|
ALOGV("%s: exit", __func__);
|
2013-10-06 21:39:35 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int32_t fm_stop(struct audio_device *adev)
|
|
|
|
{
|
2016-04-14 13:35:23 +00:00
|
|
|
int32_t ret = 0;
|
2013-10-06 21:39:35 +00:00
|
|
|
struct audio_usecase *uc_info;
|
|
|
|
|
|
|
|
ALOGD("%s: enter", __func__);
|
|
|
|
fmmod.is_fm_running = false;
|
|
|
|
|
|
|
|
/* 1. Close the PCM devices */
|
|
|
|
if (fmmod.fm_pcm_rx) {
|
|
|
|
pcm_close(fmmod.fm_pcm_rx);
|
|
|
|
fmmod.fm_pcm_rx = NULL;
|
|
|
|
}
|
|
|
|
if (fmmod.fm_pcm_tx) {
|
|
|
|
pcm_close(fmmod.fm_pcm_tx);
|
|
|
|
fmmod.fm_pcm_tx = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
uc_info = get_usecase_from_list(adev, USECASE_AUDIO_PLAYBACK_FM);
|
|
|
|
if (uc_info == NULL) {
|
|
|
|
ALOGE("%s: Could not find the usecase (%d) in the list",
|
|
|
|
__func__, USECASE_VOICE_CALL);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2. Get and set stream specific mixer controls */
|
2014-04-24 18:55:48 +00:00
|
|
|
disable_audio_route(adev, uc_info);
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
/* 3. Disable the rx and tx devices */
|
2014-04-24 18:55:48 +00:00
|
|
|
disable_snd_device(adev, uc_info->out_snd_device);
|
|
|
|
disable_snd_device(adev, uc_info->in_snd_device);
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
list_remove(&uc_info->list);
|
2018-11-01 06:28:08 +00:00
|
|
|
free(uc_info->stream.out);
|
2013-10-06 21:39:35 +00:00
|
|
|
free(uc_info);
|
|
|
|
|
|
|
|
ALOGD("%s: exit: status(%d)", __func__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2018-11-01 06:28:08 +00:00
|
|
|
|
|
|
|
static int32_t fm_start(struct audio_device *adev, audio_devices_t outputDevices)
|
2013-10-06 21:39:35 +00:00
|
|
|
{
|
2018-11-01 06:28:08 +00:00
|
|
|
struct stream_out *fm_out;
|
2016-04-14 13:35:23 +00:00
|
|
|
int32_t ret = 0;
|
2013-10-06 21:39:35 +00:00
|
|
|
struct audio_usecase *uc_info;
|
|
|
|
int32_t pcm_dev_rx_id, pcm_dev_tx_id;
|
|
|
|
|
2018-11-01 06:28:08 +00:00
|
|
|
ALOGD("%s: Start FM over output device %d ", __func__, outputDevices);
|
|
|
|
|
|
|
|
fm_out = (struct stream_out *)calloc(1, sizeof(struct stream_out));
|
|
|
|
if (!fm_out)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
fm_out->sample_rate = 48000;
|
|
|
|
fm_out->format = AUDIO_FORMAT_PCM_16_BIT;
|
|
|
|
fm_out->usecase = USECASE_AUDIO_PLAYBACK_FM;
|
|
|
|
fm_out->config = pcm_config_fm;
|
|
|
|
fm_out->devices = outputDevices;
|
2018-06-28 10:34:57 +00:00
|
|
|
fmmod.is_fm_running = true;
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
uc_info = (struct audio_usecase *)calloc(1, sizeof(struct audio_usecase));
|
hal: miscellaneous fixes
Fixes for the following issues reported by KW
21725, 21726, 21727, 21737, 21738, 21739, 21740, 21750,
21751, 21752, 25317, 30602, 32620, 36778, 41817, 41819,
50942, 54468, 54470, 54479, 55569, 54481, 55570, 55571,
58485, 85112, 85122, 85123
Change-Id: I9abef07db7ccdc19789a201eb268a97e1b360cad
2014-06-30 20:56:18 +00:00
|
|
|
|
2018-11-01 06:28:08 +00:00
|
|
|
if (!uc_info) {
|
|
|
|
free(fm_out);
|
hal: miscellaneous fixes
Fixes for the following issues reported by KW
21725, 21726, 21727, 21737, 21738, 21739, 21740, 21750,
21751, 21752, 25317, 30602, 32620, 36778, 41817, 41819,
50942, 54468, 54470, 54479, 55569, 54481, 55570, 55571,
58485, 85112, 85122, 85123
Change-Id: I9abef07db7ccdc19789a201eb268a97e1b360cad
2014-06-30 20:56:18 +00:00
|
|
|
return -ENOMEM;
|
2018-11-01 06:28:08 +00:00
|
|
|
}
|
hal: miscellaneous fixes
Fixes for the following issues reported by KW
21725, 21726, 21727, 21737, 21738, 21739, 21740, 21750,
21751, 21752, 25317, 30602, 32620, 36778, 41817, 41819,
50942, 54468, 54470, 54479, 55569, 54481, 55570, 55571,
58485, 85112, 85122, 85123
Change-Id: I9abef07db7ccdc19789a201eb268a97e1b360cad
2014-06-30 20:56:18 +00:00
|
|
|
|
2013-10-06 21:39:35 +00:00
|
|
|
uc_info->id = USECASE_AUDIO_PLAYBACK_FM;
|
|
|
|
uc_info->type = PCM_PLAYBACK;
|
2018-11-01 06:28:08 +00:00
|
|
|
uc_info->stream.out = fm_out;
|
|
|
|
uc_info->devices = outputDevices;
|
2013-10-06 21:39:35 +00:00
|
|
|
uc_info->in_snd_device = SND_DEVICE_NONE;
|
|
|
|
uc_info->out_snd_device = SND_DEVICE_NONE;
|
|
|
|
|
|
|
|
list_add_tail(&adev->usecase_list, &uc_info->list);
|
|
|
|
|
|
|
|
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
|
|
|
|
|
|
|
|
pcm_dev_rx_id = platform_get_pcm_device_id(uc_info->id, PCM_PLAYBACK);
|
|
|
|
pcm_dev_tx_id = platform_get_pcm_device_id(uc_info->id, PCM_CAPTURE);
|
|
|
|
|
|
|
|
if (pcm_dev_rx_id < 0 || pcm_dev_tx_id < 0) {
|
|
|
|
ALOGE("%s: Invalid PCM devices (rx: %d tx: %d) for the usecase(%d)",
|
|
|
|
__func__, pcm_dev_rx_id, pcm_dev_tx_id, uc_info->id);
|
|
|
|
ret = -EIO;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALOGV("%s: FM PCM devices (rx: %d tx: %d) for the usecase(%d)",
|
|
|
|
__func__, pcm_dev_rx_id, pcm_dev_tx_id, uc_info->id);
|
|
|
|
|
|
|
|
ALOGV("%s: Opening PCM playback device card_id(%d) device_id(%d)",
|
2013-12-04 19:57:47 +00:00
|
|
|
__func__, adev->snd_card, pcm_dev_rx_id);
|
|
|
|
fmmod.fm_pcm_rx = pcm_open(adev->snd_card,
|
|
|
|
pcm_dev_rx_id,
|
|
|
|
PCM_OUT, &pcm_config_fm);
|
2013-10-06 21:39:35 +00:00
|
|
|
if (fmmod.fm_pcm_rx && !pcm_is_ready(fmmod.fm_pcm_rx)) {
|
|
|
|
ALOGE("%s: %s", __func__, pcm_get_error(fmmod.fm_pcm_rx));
|
|
|
|
ret = -EIO;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
ALOGV("%s: Opening PCM capture device card_id(%d) device_id(%d)",
|
2013-12-04 19:57:47 +00:00
|
|
|
__func__, adev->snd_card, pcm_dev_tx_id);
|
|
|
|
fmmod.fm_pcm_tx = pcm_open(adev->snd_card,
|
|
|
|
pcm_dev_tx_id,
|
|
|
|
PCM_IN, &pcm_config_fm);
|
2013-10-06 21:39:35 +00:00
|
|
|
if (fmmod.fm_pcm_tx && !pcm_is_ready(fmmod.fm_pcm_tx)) {
|
|
|
|
ALOGE("%s: %s", __func__, pcm_get_error(fmmod.fm_pcm_tx));
|
|
|
|
ret = -EIO;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
pcm_start(fmmod.fm_pcm_rx);
|
|
|
|
pcm_start(fmmod.fm_pcm_tx);
|
|
|
|
|
2018-11-01 06:28:08 +00:00
|
|
|
fmmod.fm_device = fm_out->devices;
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
ALOGD("%s: exit: status(%d)", __func__, ret);
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
exit:
|
|
|
|
fm_stop(adev);
|
|
|
|
ALOGE("%s: Problem in FM start: status(%d)", __func__, ret);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-01-30 00:42:45 +00:00
|
|
|
void fm_get_parameters(struct str_parms *query, struct str_parms *reply)
|
2018-12-17 11:38:30 +00:00
|
|
|
{
|
|
|
|
int ret, val;
|
|
|
|
char value[32]={0};
|
|
|
|
|
|
|
|
ALOGV("%s: enter", __func__);
|
|
|
|
ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_FM_STATUS, value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
val = (fmmod.is_fm_running ? 1: 0);
|
|
|
|
str_parms_add_int(reply, AUDIO_PARAMETER_KEY_FM_STATUS, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-30 00:42:45 +00:00
|
|
|
void fm_set_parameters(struct audio_device *adev,
|
2013-10-06 21:39:35 +00:00
|
|
|
struct str_parms *parms)
|
|
|
|
{
|
|
|
|
int ret, val;
|
|
|
|
char value[32]={0};
|
|
|
|
float vol =0.0;
|
|
|
|
|
|
|
|
ALOGV("%s: enter", __func__);
|
2014-05-30 05:50:27 +00:00
|
|
|
ret = str_parms_get_str(parms, "SND_CARD_STATUS", value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
char *snd_card_status = value+2;
|
|
|
|
if (strstr(snd_card_status, "OFFLINE")) {
|
2017-05-25 11:55:30 +00:00
|
|
|
fmmod.card_status = CARD_STATUS_OFFLINE;
|
2014-05-30 05:50:27 +00:00
|
|
|
}
|
|
|
|
else if (strstr(snd_card_status, "ONLINE")) {
|
2017-05-25 11:55:30 +00:00
|
|
|
fmmod.card_status = CARD_STATUS_ONLINE;
|
2014-05-30 05:50:27 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-06 21:39:35 +00:00
|
|
|
if(fmmod.is_fm_running) {
|
2017-05-25 11:55:30 +00:00
|
|
|
if (fmmod.card_status == CARD_STATUS_OFFLINE) {
|
2014-05-30 05:50:27 +00:00
|
|
|
ALOGD("sound card is OFFLINE, stop FM");
|
|
|
|
fm_stop(adev);
|
|
|
|
fmmod.restart_fm = 1;
|
|
|
|
}
|
|
|
|
|
2013-10-06 21:39:35 +00:00
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_ROUTING,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
val = atoi(value);
|
|
|
|
if(val > 0)
|
|
|
|
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
|
|
|
|
}
|
|
|
|
}
|
2017-05-25 11:55:30 +00:00
|
|
|
if (fmmod.restart_fm && (fmmod.card_status == CARD_STATUS_ONLINE)) {
|
2014-05-30 05:50:27 +00:00
|
|
|
ALOGD("sound card is ONLINE, restart FM");
|
|
|
|
fmmod.restart_fm = 0;
|
2018-11-01 06:28:08 +00:00
|
|
|
fm_start(adev, fmmod.fm_device);
|
2014-05-30 05:50:27 +00:00
|
|
|
}
|
2013-10-06 21:39:35 +00:00
|
|
|
|
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_HANDLE_FM,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
val = atoi(value);
|
|
|
|
ALOGD("%s: FM usecase", __func__);
|
|
|
|
if (val != 0) {
|
|
|
|
if(val & AUDIO_DEVICE_OUT_FM
|
2014-04-22 22:19:13 +00:00
|
|
|
&& fmmod.is_fm_running == false) {
|
2018-11-01 06:28:08 +00:00
|
|
|
audio_devices_t OutputDevice = val & ~AUDIO_DEVICE_OUT_FM;
|
|
|
|
fm_start(adev, OutputDevice);
|
2014-04-22 22:19:13 +00:00
|
|
|
} else if (!(val & AUDIO_DEVICE_OUT_FM)
|
2015-10-01 08:08:37 +00:00
|
|
|
&& fmmod.is_fm_running == true) {
|
|
|
|
fm_set_volume(adev, 0, false);
|
|
|
|
usleep(FM_LOOPBACK_DRAIN_TIME_MS*1000);
|
2013-10-06 21:39:35 +00:00
|
|
|
fm_stop(adev);
|
2015-10-01 08:08:37 +00:00
|
|
|
}
|
2013-10-06 21:39:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-01 06:28:08 +00:00
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_ROUTING,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0 && fmmod.is_fm_running) {
|
|
|
|
val = atoi(value);
|
|
|
|
ALOGD("%s: FM usecase", __func__);
|
|
|
|
if (val != 0) {
|
|
|
|
if(val & AUDIO_DEVICE_OUT_FM) {
|
|
|
|
audio_devices_t OutputDevice = val & ~AUDIO_DEVICE_OUT_FM;
|
|
|
|
fm_set_volume(adev, 0, false);
|
|
|
|
fm_stop(adev);
|
|
|
|
fm_start(adev, OutputDevice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-06 21:39:35 +00:00
|
|
|
memset(value, 0, sizeof(value));
|
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_VOLUME,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
if (sscanf(value, "%f", &vol) != 1){
|
|
|
|
ALOGE("%s: error in retrieving fm volume", __func__);
|
|
|
|
ret = -EIO;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
ALOGD("%s: set_fm_volume usecase", __func__);
|
2015-10-01 08:08:37 +00:00
|
|
|
fm_set_volume(adev, vol, true);
|
2013-10-06 21:39:35 +00:00
|
|
|
}
|
|
|
|
|
2016-01-25 14:15:19 +00:00
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_MUTE,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
if (value[0] == '1')
|
|
|
|
fmmod.is_fm_muted = true;
|
|
|
|
else
|
|
|
|
fmmod.is_fm_muted = false;
|
|
|
|
ALOGV("%s: set_fm_volume from param mute", __func__);
|
|
|
|
fm_set_volume(adev, fmmod.fm_volume, false);
|
|
|
|
}
|
|
|
|
|
2018-01-23 09:32:30 +00:00
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_FM_RESTORE_VOLUME,
|
|
|
|
value, sizeof(value));
|
|
|
|
if (ret >= 0) {
|
|
|
|
if (value[0] == '1')
|
|
|
|
fm_set_volume(adev, fmmod.fm_volume, false);
|
|
|
|
ALOGV("%s: set_fm_volume from param restore volume", __func__);
|
|
|
|
}
|
|
|
|
|
2014-12-08 11:19:22 +00:00
|
|
|
#ifdef RECORD_PLAY_CONCURRENCY
|
|
|
|
ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_REC_PLAY_CONC,
|
|
|
|
value, sizeof(value));
|
|
|
|
if ((ret >= 0)
|
|
|
|
&& (fmmod.is_fm_running == true)) {
|
|
|
|
|
|
|
|
if (!strncmp("true", value, sizeof("true")))
|
|
|
|
ALOGD("Record play concurrency ON Forcing FM device reroute");
|
|
|
|
else
|
|
|
|
ALOGD("Record play concurrency OFF Forcing FM device reroute");
|
|
|
|
|
|
|
|
select_devices(adev, USECASE_AUDIO_PLAYBACK_FM);
|
2015-10-01 08:08:37 +00:00
|
|
|
fm_set_volume(adev, fmmod.fm_volume, false);
|
2014-12-08 11:19:22 +00:00
|
|
|
}
|
|
|
|
#endif
|
2013-10-06 21:39:35 +00:00
|
|
|
exit:
|
|
|
|
ALOGV("%s: exit", __func__);
|
|
|
|
}
|