summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2016-01-13 10:09:25 +0900
committerSangchul Lee <sc11.lee@samsung.com>2016-01-13 10:11:38 +0900
commitd7390f6712ffac2c43d1902147150ff587081abb (patch)
tree84ab3abfaa9b05b7079e77de0045b79b8e52077d
parentd23d4688a3ee16b90f1fe6de41a52f75021c79f3 (diff)
downloadaudio-hal-sc7727-d7390f6712ffac2c43d1902147150ff587081abb.tar.gz
audio-hal-sc7727-d7390f6712ffac2c43d1902147150ff587081abb.tar.bz2
audio-hal-sc7727-d7390f6712ffac2c43d1902147150ff587081abb.zip
[Version] 0.1.4 [Profile] Mobile [Issue Type] Bug Fix Change-Id: I92fc4e5043b786dfa5230353cc146ae35bf37a58
-rw-r--r--packaging/audio-hal-sc7727.spec2
-rw-r--r--tizen-audio-device.c88
-rw-r--r--tizen-audio-internal.h6
3 files changed, 69 insertions, 27 deletions
diff --git a/packaging/audio-hal-sc7727.spec b/packaging/audio-hal-sc7727.spec
index 73ee9a9..52f9c7b 100644
--- a/packaging/audio-hal-sc7727.spec
+++ b/packaging/audio-hal-sc7727.spec
@@ -1,6 +1,6 @@
Name: audio-hal-sc7727
Summary: TIZEN Audio HAL for SC7727
-Version: 0.1.3
+Version: 0.1.4
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-device.c b/tizen-audio-device.c
index e8872ea..6ff15bd 100644
--- a/tizen-audio-device.c
+++ b/tizen-audio-device.c
@@ -46,6 +46,13 @@ static device_type_t inDeviceTypes[] = {
{ 0, 0 },
};
+static const char* mode_to_verb_str[] = {
+ AUDIO_USE_CASE_VERB_HIFI,
+ AUDIO_USE_CASE_VERB_VOICECALL,
+ AUDIO_USE_CASE_VERB_VIDEOCALL,
+ AUDIO_USE_CASE_VERB_VOIP,
+};
+
static int _voice_pcm_open(audio_hal_t *ah);
static int _voice_pcm_close(audio_hal_t *ah, uint32_t direction);
static void _reset_pcm_devices(audio_hal_t *ah);
@@ -94,17 +101,23 @@ static audio_return_t set_devices(audio_hal_t *ah, const char *verb, device_info
return AUDIO_ERR_PARAMETER;
}
- if ((devices[0].direction == AUDIO_DIRECTION_OUT) && ah->device.active_in) {
- /* check the active in devices */
- for (j = 0; j < inDeviceTypes[j].type; j++) {
- if (((ah->device.active_in & (~AUDIO_DEVICE_IN)) & inDeviceTypes[j].type))
- active_devices[dev_idx++] = inDeviceTypes[j].name;
+ if (devices[0].direction == AUDIO_DIRECTION_OUT) {
+ ah->device.active_out &= 0x0;
+ if (ah->device.active_in) {
+ /* check the active in devices */
+ for (j = 0; j < inDeviceTypes[j].type; j++) {
+ if (((ah->device.active_in & (~AUDIO_DEVICE_IN)) & inDeviceTypes[j].type))
+ active_devices[dev_idx++] = inDeviceTypes[j].name;
+ }
}
- } else if ((devices[0].direction == AUDIO_DIRECTION_IN) && ah->device.active_out) {
- /* check the active out devices */
- for (j = 0; j < outDeviceTypes[j].type; j++) {
- if (ah->device.active_out & outDeviceTypes[j].type)
- active_devices[dev_idx++] = outDeviceTypes[j].name;
+ } else if (devices[0].direction == AUDIO_DIRECTION_IN) {
+ ah->device.active_in &= 0x0;
+ if (ah->device.active_out) {
+ /* check the active out devices */
+ for (j = 0; j < outDeviceTypes[j].type; j++) {
+ if (ah->device.active_out & outDeviceTypes[j].type)
+ active_devices[dev_idx++] = outDeviceTypes[j].name;
+ }
}
}
@@ -170,14 +183,19 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
{
audio_return_t audio_ret = AUDIO_RET_OK;
device_info_t *devices = NULL;
- const char *verb = NULL;
+ const char *verb = mode_to_verb_str[VERB_NORMAL];
#if 0 /* Disable setting modifiers, because driver does not support it yet */
int mod_idx = 0;
const char *modifiers[MAX_MODIFIERS] = {NULL,};
#endif
+ if (ah->modem.is_connected) {
+ AUDIO_LOG_INFO("modem is connected, skip verb[%s]", verb);
+ return audio_ret;
+ }
+
if (ah->device.mode != VERB_NORMAL) {
- if (ah->device.mode == VERB_CALL) {
+ if (ah->device.mode == VERB_VOICECALL) {
_reset_voice_devices_info(ah);
COND_SIGNAL(ah->device.device_cond, "device_cond");
}
@@ -190,7 +208,6 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
devices = route_info->device_infos;
- verb = AUDIO_USE_CASE_VERB_HIFI;
AUDIO_LOG_INFO("do_route_ap_playback_capture++ ");
audio_ret = set_devices(ah, verb, devices, route_info->num_of_devices);
@@ -226,7 +243,7 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
{
audio_return_t audio_ret = AUDIO_RET_OK;
- const char *verb = AUDIO_USE_CASE_VERB_VOICECALL;
+ const char *verb = mode_to_verb_str[VERB_VOICECALL];
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
/* if both params are 0, return error for invalid state,
@@ -242,9 +259,9 @@ static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *device
return audio_ret;
}
- if (ah->device.mode != VERB_CALL) {
+ if (ah->device.mode != VERB_VOICECALL) {
_voice_pcm_open(ah);
- ah->device.mode = VERB_CALL;
+ ah->device.mode = VERB_VOICECALL;
/* FIXME. Get network info and configure rate in pcm device */
}
@@ -254,8 +271,7 @@ static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *device
static audio_return_t _do_route_voip(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
{
audio_return_t audio_ret = AUDIO_RET_OK;
- const char *verb = NULL;
- verb = AUDIO_USE_CASE_VERB_HIFI;
+ const char *verb = mode_to_verb_str[VERB_NORMAL];
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
AUDIO_RETURN_VAL_IF_FAIL(devices, AUDIO_ERR_PARAMETER);
@@ -277,10 +293,8 @@ static audio_return_t _do_route_voip(audio_hal_t *ah, device_info_t *devices, in
static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
{
audio_return_t audio_ret = AUDIO_RET_OK;
-
- /* FIXME: If you need to reset, set verb inactive */
- /* const char *verb = NULL; */
- /* verb = AUDIO_USE_CASE_VERB_INACTIVE; */
+ const char *active_devices[MAX_DEVICES] = {NULL,};
+ int i = 0, dev_idx = 0;
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
@@ -288,10 +302,28 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
if (direction == AUDIO_DIRECTION_OUT) {
ah->device.active_out &= 0x0;
+ if (ah->device.active_in) {
+ /* check the active in devices */
+ for (i = 0; i < inDeviceTypes[i].type; i++) {
+ if (((ah->device.active_in & (~AUDIO_DEVICE_IN)) & inDeviceTypes[i].type)) {
+ active_devices[dev_idx++] = inDeviceTypes[i].name;
+ AUDIO_LOG_INFO("added for in : %s", inDeviceTypes[i].name);
+ }
+ }
+ }
} else {
ah->device.active_in &= 0x0;
+ if (ah->device.active_out) {
+ /* check the active out devices */
+ for (i = 0; i < outDeviceTypes[i].type; i++) {
+ if (ah->device.active_out & outDeviceTypes[i].type) {
+ active_devices[dev_idx++] = outDeviceTypes[i].name;
+ AUDIO_LOG_INFO("added for out : %s", outDeviceTypes[i].name);
+ }
+ }
+ }
}
- if (ah->device.mode == VERB_CALL) {
+ if (ah->device.mode == VERB_VOICECALL) {
_voice_pcm_close(ah, direction);
if (!ah->device.active_in && !ah->device.active_out)
ah->device.mode = VERB_NORMAL;
@@ -299,7 +331,15 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
COND_SIGNAL(ah->device.device_cond, "device_cond");
}
- /* TO DO: Set Inactive */
+ if (active_devices[0] == NULL) {
+ AUDIO_LOG_DEBUG("active device is NULL, no need to update.");
+ return AUDIO_RET_OK;
+ }
+
+ audio_ret = _audio_ucm_set_devices(ah, mode_to_verb_str[ah->device.mode], active_devices);
+ if (audio_ret)
+ AUDIO_LOG_ERROR("Failed to set device: error = %d", audio_ret);
+
return audio_ret;
}
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index a0e19e6..a850095 100644
--- a/tizen-audio-internal.h
+++ b/tizen-audio-internal.h
@@ -141,8 +141,9 @@ typedef struct device_type {
#define AUDIO_USE_CASE_VERB_INACTIVE "Inactive"
#define AUDIO_USE_CASE_VERB_HIFI "HiFi"
#define AUDIO_USE_CASE_VERB_VOICECALL "Voice"
-#define AUDIO_USE_CASE_VERB_LOOPBACK "Loopback"
#define AUDIO_USE_CASE_VERB_VIDEOCALL "Video"
+#define AUDIO_USE_CASE_VERB_VOIP "VoIP"
+#define AUDIO_USE_CASE_VERB_LOOPBACK "Loopback"
/* Modifiers */
#define AUDIO_USE_CASE_MODIFIER_VOICESEARCH "VoiceSearch"
@@ -208,7 +209,8 @@ typedef struct audio_device_info {
typedef enum audio_route_mode {
VERB_NORMAL,
- VERB_CALL,
+ VERB_VOICECALL,
+ VERB_VIDEOCALL,
VERB_VOIP
} audio_route_mode_t;