#define EXPORT_API __attribute__((__visibility__("default")))
#define RET_IO_CTL_ERR_IF_FAIL(SECTION) { if(AVSYS_FAIL(SECTION)) { \
- avsys_error_r(AVAUDIO,"%s %d\n",__func__,__LINE__); \
- return AVSYS_STATE_ERR_IO_CONTROL; \
- } }
+ avsys_error_r(AVAUDIO,"%s %d\n",__func__,__LINE__); \
+ return AVSYS_STATE_ERR_IO_CONTROL; \
+ } }
static int g_playback_path_select_data[AVSYS_AUDIO_PLAYBACK_GAIN_MAX][AVSYS_AUDIO_PATH_EX_OUTMAX] = {
{ /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
static int g_playback_gain_select_data[AVSYS_AUDIO_PLAYBACK_GAIN_MAX][AVSYS_AUDIO_PLAYBACK_GAIN_MAX] = {
{ /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
- AVSYS_AUDIO_PLAYBACK_GAIN_AP, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
- AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
+ AVSYS_AUDIO_PLAYBACK_GAIN_AP, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
+ AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL */
AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL */
AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT, /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
},
{ /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
- AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
- AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
+ AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
+ AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL */
AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL */
- AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
+ AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
},
{ /* AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL */
AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT, /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
},
{ /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
- AVSYS_AUDIO_PLAYBACK_GAIN_AP, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
- AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
+ AVSYS_AUDIO_PLAYBACK_GAIN_AP, /* AVSYS_AUDIO_PLAYBACK_GAIN_AP */
+ AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO, /* AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO */
AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL */
AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL, /* AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL */
AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT, /* AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT */
},
};
+typedef struct {
+ char headset_detection;
+ char headset_node_number;
+} AudioSystemConf;
+
+
+#ifndef MURPHY_SUPPORT
static int __avsys_audio_path_set_ascn_ap_playback(avsys_audio_path_ex_info_t *control);
static int __avsys_audio_path_set_ascn_voicecall(avsys_audio_path_ex_info_t *control);
return AVSYS_STATE_SUCCESS;
}
+#endif /* MURPHY_SUPPORT */
+
EXPORT_API
int avsys_audio_path_ex_init(void)
{
- avsys_audio_path_ex_info_t *control = NULL;
+ avsys_audio_path_ex_info_t *control = NULL;
avsys_audio_path_ex_info_t **temp = NULL;
gain_info_t default_gain = { AVSYS_AUDIO_PLAYBACK_GAIN_AP, AVSYS_AUDIO_CAPTURE_GAIN_AP };
path_info_t default_path = { AVSYS_AUDIO_PATH_EX_SPK, AVSYS_AUDIO_PATH_EX_MIC };
control->lvol_dev_type = AVSYS_AUDIO_LVOL_DEV_TYPE_SPK;
control->inserted = AVSYS_AUDIO_INSERTED_NONE;
+#ifdef MURPHY_SUPPORT
+ control->gain_debug_mode = 0;
+#else /* MURPHY_SUPPORT */
+
if (AVSYS_FAIL(__load_conf(&conf)))
avsys_error_r(AVAUDIO, "Can not load audio system configuration file\n");
control->control_aif_before_path_set = conf.control_aif_before_path_set;
control->gain_debug_mode = conf.gain_debug_mode;
+#endif /* MURPHY_SUPPORT */
+
control->mute = AVSYS_AUDIO_UNMUTE;
control->path_fixed = PATH_FIXED_NONE;
index++;
} while (index < PATH_FIXED_TYPE_MAX);
+
+#ifdef MURPHY_SUPPORT
+ err = AVSYS_STATE_SUCCESS;
+#else
/* call path control */
err = __avsys_audio_path_set_ascn_ap_playback(control);
if (AVSYS_SUCCESS(err))
if (AVSYS_SUCCESS(err))
err = __avsys_audio_path_set_ascn_ap_capture(control);
+#endif
return err;
}
EXPORT_API
int avsys_audio_path_ex_reset(int forced)
{
+#ifdef MURPHY_SUPPORT
+ (void)forced;
+ return AVSYS_STATE_SUCCESS;
+#else
avsys_audio_path_ex_info_t *control = NULL;
avsys_audio_path_ex_info_t **temp = NULL;
gain_info_t default_gain = { AVSYS_AUDIO_PLAYBACK_GAIN_AP, AVSYS_AUDIO_CAPTURE_GAIN_AP };
}
return err;
+#endif /* MURPHY_SUPPORT */
}
EXPORT_API
fprintf(stdout, "======================================================================\n");
#if defined(_MMFW_I386_ALL_SIMULATOR)
fprintf(stdout, " In simulator, follow informations don`t have means.\n");
+#elif defined(MURPHY_SUPPORT)
+ fprintf(stdout, " Murphy support is enabled. module-murphy-ivi is routing in pulseaudio.\n"
+ " The information below does not make much sense ...\n");
#endif
fprintf(stdout, " GAIN : P (%-s / %-s) - R (%-s / %-s) - C (%-s / %-s)\n",
return AVSYS_STATE_SUCCESS;
}
+#ifndef MURPHY_SUPPORT
static int __avsys_audio_path_get_earjack_type (void)
{
int fd = 0;
close(fd);
return readval;
}
+#endif /* MURPHY_SUPPORT */
int avsys_audio_path_earjack_init(int *init_type, int *outfd)
{
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
+#if !defined(_MMFW_I386_ALL_SIMULATOR) && !defined(MURPHY_SUPPORT)
char eventnode_filename[32] = { 0, };
int fd = 0;
avsys_audio_conf conf = { 0, };
int avsys_audio_path_earjack_wait(int fd, int *current_type, int *new_type, int *is_auto_mute)
{
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
+#if !defined(_MMFW_I386_ALL_SIMULATOR) && !defined(MURPHY_SUPPORT)
fd_set set;
int readtemp;
int select_ret = 0;
int avsys_audio_path_earjack_process(int new_type)
{
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
+#if !defined(_MMFW_I386_ALL_SIMULATOR) && !defined(MURPHY_SUPPORT)
avsys_audio_path_ex_info_t *control = NULL;
avsys_audio_path_ex_info_t **temp = NULL;
int err = AVSYS_STATE_SUCCESS;
int avsys_audio_path_earjack_deinit(int fd)
{
-#if !defined(_MMFW_I386_ALL_SIMULATOR)
+#if !defined(_MMFW_I386_ALL_SIMULATOR) && !defined(MURPHY_SUPPORT)
close(fd);
return AVSYS_STATE_SUCCESS;
#else
int avsys_audio_path_earjack_unlock()
{
-#ifdef EARJACK_LOCK /* currently this is disabled to avoid semapore value increase */
+#if defined(EARJACK_LOCK) && !defined(MURPHY_SUPPORT) /* currently EARJACK_LOCK is disabled to avoid semapore value increase */
if (AVSYS_FAIL(avsys_audio_unlock_sync(AVSYS_AUDIO_SYNC_IDEN_PATH))) {
avsys_error_r(AVAUDIO, "avsys_audio_unlock_sync() failed in %s\n", __func__);
return AVSYS_STATE_ERR_INTERNAL;
CMD_DEVICE_MAX
};
+#ifndef MURPHY_SUPPORT
avsys_audio_alsa_aif_handle_t *g_hAIF[AIF_DEVICE_MAX] = { NULL, NULL, NULL, NULL, NULL };
char *strAIF[AIF_DEVICE_MAX] = { "AIF2 Capture", "AIF2 Playback", "AIF3 Capture", "AIF3 Playback", "AIF4 Playback" };
}
}
+#endif /* MURPHY_SUPPORT */
+
static int __avsys_audio_release_path (gain_info_t local_gain, avsys_audio_path_ex_info_t *control)
{
case AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL:
case AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL:
if (getpid() == control->path_fixed_pid[PATH_FIXED_TYPE_CALL]) {
+#ifndef MURPHY_SUPPORT
if (!control->control_aif_before_path_set) {
__avsys_close_aif();
} else {
if (AVSYS_FAIL(avsys_audio_ascn_single_set(ASCN_CODEC_DISABLE_ON_SUSPEND))) {
avsys_error_r(AVAUDIO, "[%s] failed to set codec_disable_on_suspend\n", __func__);
}
+#endif /* MURPHY_SUPPORT */
} else {
if (control->path_fixed_pid[PATH_FIXED_TYPE_CALL] < 0) {
avsys_warning(AVAUDIO, "Sound path for call released already\n");
case AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO:
/* TODO: Reset & Codec disable on suspend script */
+#ifdef MURPHY_SUPPORT
+ control->p_path_status.playback = PS_PATH_NONE;
+#else
if (AVSYS_FAIL(avsys_audio_ascn_single_set(ASCN_CODEC_DISABLE_ON_SUSPEND))) {
avsys_error_r(AVAUDIO, "[%s] failed to set codec_disable_on_suspend\n", __func__);
}
if (AVSYS_FAIL(avsys_audio_ascn_single_set(ASCN_STR_RESET_CAPTURE))) {
avsys_error_r(AVAUDIO, "[%s] failed to set reset\n", __func__);
}
+#endif
break;
control->path.capture = AVSYS_AUDIO_PATH_EX_HEADSETMIC;
}
+#ifndef MURPHY_SUPPORT
/* Playback */
err = __avsys_audio_path_set_ascn_ap_playback(control);
if (AVSYS_SUCCESS(err)) {
if (AVSYS_FAIL(err)) {
avsys_error(AVAUDIO, "Set ap capture failure\n");
}
+#endif
}
+#ifndef MURPHY_SUPPORT
if (close_aif_later == true) {
__avsys_close_aif();
- }
+#endif
return err;
}
pid_t current_pid;
int err = AVSYS_STATE_SUCCESS;
char req_release_path = 0;
+#ifndef MURPHY_SUPPORT
char AIF_control[AIF_DEVICE_MAX] = { CMD_DEVICE_NONE, CMD_DEVICE_NONE, CMD_DEVICE_NONE, CMD_DEVICE_NONE, CMD_DEVICE_NONE };
int iAIF = 0;
+#endif
avsys_warning(AVAUDIO, "=================== [Input Param] gain %d, out %d, in %d, opt 0x%x ====================\n", gain, out, in, option);
if (req_release_path && (req_gain.playback == local_gain.playback) && (req_gain.capture == local_gain.capture)) {
avsys_warning(AVAUDIO,"Release path for %d %d\n", local_gain.playback, local_gain.capture);
+#ifdef MURPHY_SUPPORT
+ err = AVSYS_STATE_SUCCESS;
+#else
err = __avsys_audio_release_path(local_gain, control);
+#endif
goto FINISHED;
}
if (CHECK_VALID(req_gain.playback)) {
case AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL:
control->path_fixed_pid[PATH_FIXED_TYPE_CALL] = current_pid;
case AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT:
+#ifndef MURPHY_SUPPORT
if (control->path.playback == AVSYS_AUDIO_PATH_EX_BTHEADSET) {
SET_AIF(AIF3_PLAYBACK);
SET_AIF(AIF3_CAPTURE);
}
+#endif
break;
case AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL:
control->path_fixed_pid[PATH_FIXED_TYPE_CALL] = current_pid;
+#ifndef MURPHY_SUPPORT
SET_AIF(AIF2_PLAYBACK);
if (control->path.playback == AVSYS_AUDIO_PATH_EX_BTHEADSET) {
SET_AIF(AIF3_PLAYBACK);
}
+#endif
break;
case AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO:
switch (local_gain.capture) {
case AVSYS_AUDIO_CAPTURE_GAIN_VIDEOCALL:
control->path_fixed_pid[PATH_FIXED_TYPE_CALL] = current_pid;
+#ifndef MURPHY_SUPPORT
if (control->path.capture == AVSYS_AUDIO_PATH_EX_BTMIC) {
SET_AIF(AIF3_CAPTURE);
}
+#endif
break;
case AVSYS_AUDIO_CAPTURE_GAIN_VOICECALL:
control->path_fixed_pid[PATH_FIXED_TYPE_CALL] = current_pid;
+#ifndef MURPHY_SUPPORT
SET_AIF(AIF2_CAPTURE);
if (control->path.capture == AVSYS_AUDIO_PATH_EX_BTMIC) {
SET_AIF(AIF3_CAPTURE);
}
+#endif
break;
case AVSYS_AUDIO_CAPTURE_GAIN_FMRADIO:
/* Open AIFs */
if (control->control_aif_before_path_set) {
+ /* FIXME: this will be moved to after alsa scenraio set */
+#if !defined(MURPHY_SUPPORT)
err = __avsys_open_aif(AIF_control);
+#else
+ err = AVSYS_STATE_SUCCESS;
+#endif
}
/* Do ALSA scenario control based on gain */
/* Playback */
if (local_gain.playback == AVSYS_AUDIO_PLAYBACK_GAIN_AP) {
avsys_warning(AVAUDIO, "playback gain : ap\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_ap_playback(control);
if (AVSYS_SUCCESS(err)) {
err = __avsys_audio_path_set_hw_controls(control);
}
+#endif
} else if(local_gain.playback == AVSYS_AUDIO_PLAYBACK_GAIN_CALLALERT) {
avsys_warning(AVAUDIO,"playback gain : callalert\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_ap_playback(control);
if (AVSYS_SUCCESS(err)) {
err = __avsys_audio_path_set_hw_controls(control);
}
+#endif
} else if (local_gain.playback == AVSYS_AUDIO_PLAYBACK_GAIN_FMRADIO &&
local_gain.capture == AVSYS_AUDIO_CAPTURE_GAIN_FMRADIO) {
avsys_warning(AVAUDIO, "fmradio gain\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_fmradio(control);
+#endif
} else if (local_gain.playback == AVSYS_AUDIO_PLAYBACK_GAIN_VOICECALL &&
local_gain.capture == AVSYS_AUDIO_CAPTURE_GAIN_VOICECALL) {
avsys_warning(AVAUDIO, "voicecall gain\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_voicecall(control);
+#endif
} else if (local_gain.playback == AVSYS_AUDIO_PLAYBACK_GAIN_VIDEOCALL &&
local_gain.capture == AVSYS_AUDIO_CAPTURE_GAIN_VIDEOCALL) {
avsys_warning(AVAUDIO, "videocall gain\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_videocall(control);
+#endif
}
/* Capture */
if (local_gain.capture == AVSYS_AUDIO_CAPTURE_GAIN_AP) {
avsys_warning(AVAUDIO, "capture gain : ap\n");
+#ifndef MURPHY_SUPPORT
err = __avsys_audio_path_set_ascn_ap_capture(control);
+#endif
}
if (!control->control_aif_before_path_set) {
- err = __avsys_open_aif(AIF_control);
+#if !defined(MURPHY_SUPPORT)
+ err = __avsys_open_aif(AIF_control);
+#else
+ err = AVSYS_STATE_SUCCESS;
+#endif
}
FINISHED:
avsys_warning(AVAUDIO, "[Path Mute] run mute ctrl op: %d\n", mute);
}
+#ifndef MURPHY_SUPPORT
if (control->mute) {
if (AVSYS_FAIL(avsys_audio_ascn_single_set(ASCN_STR_PLAYBACK_MUTE))) {
if (AVSYS_FAIL(avsys_audio_unlock_sync(AVSYS_AUDIO_SYNC_IDEN_PATH))) {
return AVSYS_STATE_ERR_IO_CONTROL;
}
}
+#endif
if (AVSYS_FAIL(avsys_audio_unlock_sync(AVSYS_AUDIO_SYNC_IDEN_PATH))) {
avsys_error_r(AVAUDIO, "avsys_audio_unlock_sync() 2 failed in %s\n", __func__);
avsys_warning(AVAUDIO, "[Path Mute] run mute ctrl op: %d\n", mute);
}
+#ifndef MURPHY_SUPPORT
if (control->mute) {
if (AVSYS_FAIL(avsys_audio_ascn_single_set(ASCN_STR_PLAYBACK_MUTE))) {
avsys_error(AVAUDIO, "Mute fail %s\n", __func__);
return AVSYS_STATE_ERR_IO_CONTROL;
}
}
+#endif
}
if (mute == AVSYS_AUDIO_UNMUTE || mute == AVSYS_AUDIO_UNMUTE_NOLOCK)
return AVSYS_STATE_SUCCESS;
}
+#ifndef MURPHY_SUPPORT
static int __avsys_audio_path_set_ascn_ap_playback(avsys_audio_path_ex_info_t *control)
{
int cmd_gain[2] = { 0, 0 };
return AVSYS_STATE_SUCCESS;
}
+#endif /* MURPHY_SUPPORT */
+
static bool __avsys_audio_path_check_cp_audio(int gain)
{
/*If video call uses CP audio, add AVSYS_AUDIO_GAIN_EX_VIDEOCALL to following code. */
if (!str)
return AVSYS_STATE_ERR_INVALID_PARAMETER;
+#ifndef MURPHY_SUPPORT
RET_IO_CTL_ERR_IF_FAIL(avsys_audio_ascn_single_set(str))
+#endif
return AVSYS_STATE_SUCCESS;
}