audio: Remove unused var and unnecessary code
Remove update_mixer (as its unused) and change function signatures
wherever used.
Remove code chunk to set BT sample rate before enabling device as
thats part of the mixer path file now.
Change-Id: I5eb3bce5183acf505596be2b0ec93cdbd728bdaa
CRs-Fixed: 581453
diff --git a/hal/audio_extn/compress_capture.c b/hal/audio_extn/compress_capture.c
index 0a2de36..6559582 100644
--- a/hal/audio_extn/compress_capture.c
+++ b/hal/audio_extn/compress_capture.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 - 2014, The Linux Foundation. All rights reserved.
* Not a Contribution.
*
* Copyright (C) 2013 The Android Open Source Project
diff --git a/hal/audio_extn/fm.c b/hal/audio_extn/fm.c
index 325d3f9..0c5bb07 100644
--- a/hal/audio_extn/fm.c
+++ b/hal/audio_extn/fm.c
@@ -122,11 +122,11 @@
}
/* 2. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 3. Disable the rx and tx devices */
- disable_snd_device(adev, uc_info->out_snd_device, false);
- disable_snd_device(adev, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info->out_snd_device);
+ disable_snd_device(adev, uc_info->in_snd_device);
list_remove(&uc_info->list);
free(uc_info);
diff --git a/hal/audio_extn/hfp.c b/hal/audio_extn/hfp.c
index ed253c2..add4a7c 100644
--- a/hal/audio_extn/hfp.c
+++ b/hal/audio_extn/hfp.c
@@ -1,5 +1,5 @@
/* hfp.c
-Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
+Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -245,11 +245,11 @@
}
/* 2. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 3. Disable the rx and tx devices */
- disable_snd_device(adev, uc_info->out_snd_device, false);
- disable_snd_device(adev, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info->out_snd_device);
+ disable_snd_device(adev, uc_info->in_snd_device);
list_remove(&uc_info->list);
free(uc_info);
diff --git a/hal/audio_extn/spkr_protection.c b/hal/audio_extn/spkr_protection.c
index 6c0eec0..ce673ea 100644
--- a/hal/audio_extn/spkr_protection.c
+++ b/hal/audio_extn/spkr_protection.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013 - 2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -227,8 +227,8 @@
uc_info_rx->out_snd_device = SND_DEVICE_OUT_SPEAKER_PROTECTED;
pthread_mutex_lock(&adev->lock);
disable_rx = true;
- enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true);
- enable_audio_route(adev, uc_info_rx, true);
+ enable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED);
+ enable_audio_route(adev, uc_info_rx);
pthread_mutex_unlock(&adev->lock);
pcm_dev_rx_id = platform_get_pcm_device_id(uc_info_rx->id, PCM_PLAYBACK);
@@ -257,8 +257,8 @@
pthread_mutex_lock(&adev->lock);
disable_tx = true;
- enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true);
- enable_audio_route(adev, uc_info_tx, true);
+ enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
+ enable_audio_route(adev, uc_info_tx);
pthread_mutex_unlock(&adev->lock);
pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx->id, PCM_CAPTURE);
@@ -336,12 +336,12 @@
handle.pcm_tx = NULL;
pthread_mutex_lock(&adev->lock);
if (disable_rx) {
- disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED, true);
- disable_audio_route(adev, uc_info_rx, true);
+ disable_snd_device(adev, SND_DEVICE_OUT_SPEAKER_PROTECTED);
+ disable_audio_route(adev, uc_info_rx);
}
if (disable_tx) {
- disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true);
- disable_audio_route(adev, uc_info_tx, true);
+ disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
+ disable_audio_route(adev, uc_info_tx);
}
pthread_mutex_unlock(&adev->lock);
@@ -598,7 +598,7 @@
}
ALOGV("%s: snd_device(%d: %s)", __func__, snd_device,
platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED));
- audio_route_apply_path(adev->audio_route,
+ audio_route_apply_and_update_path(adev->audio_route,
platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED));
pthread_mutex_lock(&handle.mutex_spkr_prot);
@@ -610,8 +610,8 @@
uc_info_tx.out_snd_device = SND_DEVICE_NONE;
handle.pcm_tx = NULL;
- enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true);
- enable_audio_route(adev, &uc_info_tx, true);
+ enable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
+ enable_audio_route(adev, &uc_info_tx);
pcm_dev_tx_id = platform_get_pcm_device_id(uc_info_tx.id, PCM_CAPTURE);
if (pcm_dev_tx_id < 0) {
@@ -642,8 +642,8 @@
if (handle.pcm_tx)
pcm_close(handle.pcm_tx);
handle.pcm_tx = NULL;
- disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true);
- disable_audio_route(adev, &uc_info_tx, true);
+ disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
+ disable_audio_route(adev, &uc_info_tx);
} else
handle.spkr_processing_state = SPKR_PROCESSING_IN_PROGRESS;
pthread_mutex_unlock(&handle.mutex_spkr_prot);
@@ -667,12 +667,12 @@
if (handle.pcm_tx)
pcm_close(handle.pcm_tx);
handle.pcm_tx = NULL;
- disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK, true);
- disable_audio_route(adev, &uc_info_tx, true);
+ disable_snd_device(adev, SND_DEVICE_IN_CAPTURE_VI_FEEDBACK);
+ disable_audio_route(adev, &uc_info_tx);
}
handle.spkr_processing_state = SPKR_PROCESSING_IN_IDLE;
pthread_mutex_unlock(&handle.mutex_spkr_prot);
- audio_route_reset_path(adev->audio_route,
+ audio_route_reset_and_update_path(adev->audio_route,
platform_get_snd_device_name(SND_DEVICE_OUT_SPEAKER_PROTECTED));
ALOGV("%s: Exit", __func__);
}
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index e8d0d20..97fb87a 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -238,8 +238,7 @@
}
int enable_audio_route(struct audio_device *adev,
- struct audio_usecase *usecase,
- bool __unused update_mixer)
+ struct audio_usecase *usecase)
{
snd_device_t snd_device;
char mixer_path[MIXER_PATH_MAX_LENGTH];
@@ -267,8 +266,7 @@
}
int disable_audio_route(struct audio_device *adev,
- struct audio_usecase *usecase,
- bool __unused update_mixer)
+ struct audio_usecase *usecase)
{
snd_device_t snd_device;
char mixer_path[MIXER_PATH_MAX_LENGTH];
@@ -290,8 +288,7 @@
}
int enable_snd_device(struct audio_device *adev,
- snd_device_t snd_device,
- bool __unused update_mixer)
+ snd_device_t snd_device)
{
char device_name[DEVICE_NAME_MAX_SIZE] = {0};
@@ -313,18 +310,6 @@
return 0;
}
- /* Set BT sample rate before enabling the devices. Adding sample rate mixer
- * control in use-case does not work because rate update takes place after
- * AFE port open due to the limitation of mixer control order execution.
- */
- if ((snd_device == SND_DEVICE_OUT_BT_SCO) ||
- (snd_device == SND_DEVICE_IN_BT_SCO_MIC)) {
- audio_route_apply_and_update_path(adev->audio_route, BT_SCO_SAMPLE_RATE);
- } else if ((snd_device == SND_DEVICE_OUT_BT_SCO_WB) ||
- (snd_device == SND_DEVICE_IN_BT_SCO_MIC_WB)) {
- audio_route_apply_and_update_path(adev->audio_route, BT_SCO_WB_SAMPLE_RATE);
- }
-
/* start usb playback thread */
if(SND_DEVICE_OUT_USB_HEADSET == snd_device ||
SND_DEVICE_OUT_SPEAKER_AND_USB_HEADSET == snd_device)
@@ -360,8 +345,7 @@
}
int disable_snd_device(struct audio_device *adev,
- snd_device_t snd_device,
- bool __unused update_mixer)
+ snd_device_t snd_device)
{
char device_name[DEVICE_NAME_MAX_SIZE] = {0};
@@ -441,7 +425,7 @@
ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
__func__, use_case_table[usecase->id],
platform_get_snd_device_name(usecase->out_snd_device));
- disable_audio_route(adev, usecase, false);
+ disable_audio_route(adev, usecase);
switch_device[usecase->id] = true;
num_uc_to_switch++;
}
@@ -455,14 +439,14 @@
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- disable_snd_device(adev, usecase->out_snd_device, true);
+ disable_snd_device(adev, usecase->out_snd_device);
}
}
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- enable_snd_device(adev, snd_device, true);
+ enable_snd_device(adev, snd_device);
}
}
@@ -473,7 +457,7 @@
/* Update the out_snd_device only before enabling the audio route */
if (switch_device[usecase->id] ) {
usecase->out_snd_device = snd_device;
- enable_audio_route(adev, usecase, false);
+ enable_audio_route(adev, usecase);
}
}
}
@@ -509,7 +493,7 @@
ALOGV("%s: Usecase (%s) is active on (%s) - disabling ..",
__func__, use_case_table[usecase->id],
platform_get_snd_device_name(usecase->in_snd_device));
- disable_audio_route(adev, usecase, false);
+ disable_audio_route(adev, usecase);
switch_device[usecase->id] = true;
num_uc_to_switch++;
}
@@ -523,14 +507,14 @@
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- disable_snd_device(adev, usecase->in_snd_device, true);
+ disable_snd_device(adev, usecase->in_snd_device);
}
}
list_for_each(node, &adev->usecase_list) {
usecase = node_to_item(node, struct audio_usecase, list);
if (switch_device[usecase->id]) {
- enable_snd_device(adev, snd_device, true);
+ enable_snd_device(adev, snd_device);
}
}
@@ -541,7 +525,7 @@
/* Update the in_snd_device only before enabling the audio route */
if (switch_device[usecase->id] ) {
usecase->in_snd_device = snd_device;
- enable_audio_route(adev, usecase, false);
+ enable_audio_route(adev, usecase);
}
}
}
@@ -708,13 +692,13 @@
/* Disable current sound devices */
if (usecase->out_snd_device != SND_DEVICE_NONE) {
- disable_audio_route(adev, usecase, true);
- disable_snd_device(adev, usecase->out_snd_device, true);
+ disable_audio_route(adev, usecase);
+ disable_snd_device(adev, usecase->out_snd_device);
}
if (usecase->in_snd_device != SND_DEVICE_NONE) {
- disable_audio_route(adev, usecase, true);
- disable_snd_device(adev, usecase->in_snd_device, true);
+ disable_audio_route(adev, usecase);
+ disable_snd_device(adev, usecase->in_snd_device);
}
/* Applicable only on the targets that has external modem.
@@ -730,12 +714,12 @@
if (out_snd_device != SND_DEVICE_NONE) {
if (usecase->devices & AUDIO_DEVICE_OUT_ALL_CODEC_BACKEND)
check_usecases_codec_backend(adev, usecase, out_snd_device);
- enable_snd_device(adev, out_snd_device, false);
+ enable_snd_device(adev, out_snd_device);
}
if (in_snd_device != SND_DEVICE_NONE) {
check_and_route_capture_usecases(adev, usecase, in_snd_device);
- enable_snd_device(adev, in_snd_device, false);
+ enable_snd_device(adev, in_snd_device);
}
if (usecase->type == VOICE_CALL || usecase->type == VOIP_CALL)
@@ -746,7 +730,7 @@
usecase->in_snd_device = in_snd_device;
usecase->out_snd_device = out_snd_device;
- enable_audio_route(adev, usecase, true);
+ enable_audio_route(adev, usecase);
/* Applicable only on the targets that has external modem.
* Enable device command should be sent to modem only after
@@ -781,10 +765,10 @@
voice_check_and_stop_incall_rec_usecase(adev, in);
/* 1. Disable stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 2. Disable the tx device */
- disable_snd_device(adev, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info->in_snd_device);
list_remove(&uc_info->list);
free(uc_info);
@@ -1113,7 +1097,7 @@
usecase = node_to_item(node, struct audio_usecase, list);
if (usecase->type == PCM_PLAYBACK &&
usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- disable_audio_route(adev, usecase, true);
+ disable_audio_route(adev, usecase);
}
}
@@ -1125,7 +1109,7 @@
usecase = node_to_item(node, struct audio_usecase, list);
if (usecase->type == PCM_PLAYBACK &&
usecase->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- enable_audio_route(adev, usecase, true);
+ enable_audio_route(adev, usecase);
}
}
@@ -1155,10 +1139,10 @@
}
/* 1. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 2. Disable the rx device */
- disable_snd_device(adev, uc_info->out_snd_device, true);
+ disable_snd_device(adev, uc_info->out_snd_device);
list_remove(&uc_info->list);
free(uc_info);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 01f5a0c..3115f1a 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -256,17 +256,15 @@
int select_devices(struct audio_device *adev,
audio_usecase_t uc_id);
int disable_audio_route(struct audio_device *adev,
- struct audio_usecase *usecase,
- bool update_mixer);
+ struct audio_usecase *usecase);
int disable_snd_device(struct audio_device *adev,
- snd_device_t snd_device,
- bool update_mixer);
+ snd_device_t snd_device);
int enable_snd_device(struct audio_device *adev,
- snd_device_t snd_device,
- bool update_mixer);
+ snd_device_t snd_device);
+
int enable_audio_route(struct audio_device *adev,
- struct audio_usecase *usecase,
- bool update_mixer);
+ struct audio_usecase *usecase);
+
struct audio_usecase *get_usecase_from_list(struct audio_device *adev,
audio_usecase_t uc_id);
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index c6ba144..4a4e408 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -1634,9 +1634,8 @@
str_parms_del(parms, AUDIO_PARAMETER_KEY_BTSCO);
my_data->btsco_sample_rate = val;
if (val == SAMPLE_RATE_16KHZ) {
- audio_route_apply_path(my_data->adev->audio_route,
+ audio_route_apply_and_update_path(my_data->adev->audio_route,
"bt-sco-wb-samplerate");
- audio_route_update_mixer(my_data->adev->audio_route);
}
}
diff --git a/hal/voice.c b/hal/voice.c
index ac067a3..62d01db 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -88,11 +88,11 @@
}
/* 2. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 3. Disable the rx and tx devices */
- disable_snd_device(adev, uc_info->out_snd_device, false);
- disable_snd_device(adev, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info->out_snd_device);
+ disable_snd_device(adev, uc_info->in_snd_device);
list_remove(&uc_info->list);
free(uc_info);
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c
index 47ac2c8..deb3172 100644
--- a/hal/voice_extn/compress_voip.c
+++ b/hal/voice_extn/compress_voip.c
@@ -305,11 +305,11 @@
}
/* 2. Get and set stream specific mixer controls */
- disable_audio_route(adev, uc_info, true);
+ disable_audio_route(adev, uc_info);
/* 3. Disable the rx and tx devices */
- disable_snd_device(adev, uc_info->out_snd_device, false);
- disable_snd_device(adev, uc_info->in_snd_device, true);
+ disable_snd_device(adev, uc_info->out_snd_device);
+ disable_snd_device(adev, uc_info->in_snd_device);
list_remove(&uc_info->list);
free(uc_info);