From 91e9fad9dff8746a5cd9d44ee4f1313d3ad7cfdc Mon Sep 17 00:00:00 2001 From: "ehgrace.kim" Date: Mon, 2 Jul 2012 18:27:28 -0700 Subject: [PATCH] audio: modify the SPEAKER_RX_ACDB to support both MONO and STEREO speaker Change-Id: I2e66f430b18ecfa3bfcdbb7c9f6d50354e2d0709 --- alsa_sound/alsa_default.cpp | 3 ++- libalsa-intf/alsa_ucm.c | 8 ++++---- libalsa-intf/msm8960_use_cases.h | 3 ++- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/alsa_sound/alsa_default.cpp b/alsa_sound/alsa_default.cpp index 9a53672a..7cc022be 100644 --- a/alsa_sound/alsa_default.cpp +++ b/alsa_sound/alsa_default.cpp @@ -522,7 +522,8 @@ void switchDevice(alsa_handle_t *handle, uint32_t devices, uint32_t mode) strlcat(ident, curRxUCMDevice, sizeof(ident)); rx_dev_id = snd_use_case_get(handle->ucMgr, ident, NULL); - if (rx_dev_id == DEVICE_SPEAKER_RX_ACDB_ID && tx_dev_id == DEVICE_HANDSET_TX_ACDB_ID) { + if (((rx_dev_id == DEVICE_SPEAKER_MONO_RX_ACDB_ID ) || (rx_dev_id == DEVICE_SPEAKER_STEREO_RX_ACDB_ID )) + && tx_dev_id == DEVICE_HANDSET_TX_ACDB_ID) { tx_dev_id = DEVICE_SPEAKER_TX_ACDB_ID; } diff --git a/libalsa-intf/alsa_ucm.c b/libalsa-intf/alsa_ucm.c index b32cc583..8503268d 100644 --- a/libalsa-intf/alsa_ucm.c +++ b/libalsa-intf/alsa_ucm.c @@ -620,11 +620,11 @@ int use_case_index) rx_id = ctrl_list[index].acdb_id; tx_id = ctrl_list[use_case_index].acdb_id; } - if(rx_id == DEVICE_SPEAKER_RX_ACDB_ID && - tx_id == DEVICE_HANDSET_TX_ACDB_ID) { + if(((rx_id == DEVICE_SPEAKER_MONO_RX_ACDB_ID)||(rx_id == DEVICE_SPEAKER_STEREO_RX_ACDB_ID)) + && tx_id == DEVICE_HANDSET_TX_ACDB_ID) { tx_id = DEVICE_SPEAKER_TX_ACDB_ID; - } else if (rx_id == DEVICE_SPEAKER_RX_ACDB_ID && - tx_id == DEVICE_HANDSET_TX_FV5_ACDB_ID) { + } else if (((rx_id == DEVICE_SPEAKER_MONO_RX_ACDB_ID )||(rx_id == DEVICE_SPEAKER_STEREO_RX_ACDB_ID)) + && tx_id == DEVICE_HANDSET_TX_FV5_ACDB_ID) { tx_id = DEVICE_SPEAKER_TX_FV5_ACDB_ID; } diff --git a/libalsa-intf/msm8960_use_cases.h b/libalsa-intf/msm8960_use_cases.h index b74480b8..7e612326 100644 --- a/libalsa-intf/msm8960_use_cases.h +++ b/libalsa-intf/msm8960_use_cases.h @@ -44,7 +44,8 @@ extern "C" { #define CAP_VOICE 0x4 #define DEVICE_HANDSET_RX_ACDB_ID 7 // HANDSET_SPKR #define DEVICE_HANDSET_TX_ACDB_ID 4 // HANDSET_MIC -#define DEVICE_SPEAKER_RX_ACDB_ID 15// SPKR_PHONE_SPKR_STEREO +#define DEVICE_SPEAKER_MONO_RX_ACDB_ID 14// SPKR_PHONE_SPKR_MONO +#define DEVICE_SPEAKER_STEREO_RX_ACDB_ID 15// SPKR_PHONE_SPKR_STEREO #define DEVICE_SPEAKER_TX_ACDB_ID 11// SPKR_PHONE_MIC #define DEVICE_HEADSET_RX_ACDB_ID 10// HEADSET_SPKR_STEREO #define DEVICE_HEADSET_TX_ACDB_ID 8 // HEADSET_MIC