Skip to content

Commit

Permalink
hal: add support for Fluence Broadside
Browse files Browse the repository at this point in the history
ADSP supports Fluence Broadside algorithm in Speaker Phone mode
for voice call and audio recording usecases. Add support for
the same in audio HAL.

Change-Id: I6682f72f8f47ce1f261511cb150e506de6f3dddb
CRs-fixed: 590495
  • Loading branch information
Narsinga Rao Chella authored and hyperb1iss committed Oct 4, 2014
1 parent 95b1a68 commit e0b8aee
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
48 changes: 42 additions & 6 deletions hal/msm8974/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct platform_data {
bool fluence_in_voice_rec;
bool fluence_in_audio_rec;
int fluence_type;
int fluence_mode;
int btsco_sample_rate;
bool slowtalk;
/* Audio calibration related functions */
Expand Down Expand Up @@ -267,6 +268,11 @@ static char * device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_VOIP_HANDSET_MIC] = "voip-main-mic-comm",
[SND_DEVICE_IN_VOIP_SPEAKER_MIC] = "voip-sub-mic-comm",
[SND_DEVICE_IN_VOIP_HEADSET_MIC] = "voip-headset-mic-comm",
[SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE] = "voice-speaker-dmic-broadside",
[SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE] = "speaker-dmic-broadside",
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE] = "speaker-dmic-broadside",
[SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE] = "speaker-dmic-broadside",
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE] = "speaker-dmic-broadside",
};

/* ACDB IDs (audio DSP path configuration IDs) for each sound device */
Expand Down Expand Up @@ -341,6 +347,11 @@ static int acdb_device_table[SND_DEVICE_MAX] = {
[SND_DEVICE_IN_HANDSET_STEREO_DMIC] = 34,
[SND_DEVICE_IN_SPEAKER_STEREO_DMIC] = 35,
[SND_DEVICE_IN_CAPTURE_VI_FEEDBACK] = 102,
[SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE] = 12,
[SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE] = 12,
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE] = 119,
[SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE] = 121,
[SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE] = 120,
};

struct name_to_index {
Expand Down Expand Up @@ -426,6 +437,11 @@ static struct name_to_index snd_device_name_index[SND_DEVICE_MAX] = {
{TO_NAME_INDEX(SND_DEVICE_IN_VOIP_HANDSET_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOIP_SPEAKER_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOIP_HEADSET_MIC)},
{TO_NAME_INDEX(SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE)},
{TO_NAME_INDEX(SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE)},
};

static char * backend_table[SND_DEVICE_MAX] = {0};
Expand Down Expand Up @@ -691,6 +707,7 @@ void *platform_init(struct audio_device *adev)
my_data->fluence_in_voice_rec = false;
my_data->fluence_in_audio_rec = false;
my_data->fluence_type = FLUENCE_NONE;
my_data->fluence_mode = FLUENCE_ENDFIRE;

property_get("ro.qc.sdk.audio.fluencetype", value, "");
if (!strncmp("fluencepro", value, sizeof("fluencepro"))) {
Expand Down Expand Up @@ -721,6 +738,11 @@ void *platform_init(struct audio_device *adev)
if (!strncmp("true", value, sizeof("true"))) {
my_data->fluence_in_spkr_mode = true;
}

property_get("persist.audio.fluence.mode",value,"");
if (!strncmp("broadside", value, sizeof("broadside"))) {
my_data->fluence_mode = FLUENCE_BROADSIDE;
}
}

my_data->voice_feature_set = VOICE_FEATURE_SET_DEFAULT;
Expand Down Expand Up @@ -1398,7 +1420,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_QMIC;
} else {
adev->acdb_settings |= DMIC_FLAG;
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC;
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE;
else
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_DMIC;
}
} else {
snd_device = SND_DEVICE_IN_VOICE_SPEAKER_MIC;
Expand Down Expand Up @@ -1444,7 +1469,10 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS;
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS;
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC_NS;
Expand All @@ -1460,8 +1488,12 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
set_echo_reference(adev, true);
} else if (adev->active_input->enable_aec) {
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC;
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_AEC;
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_AEC;
Expand All @@ -1477,8 +1509,12 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d
set_echo_reference(adev, true);
} else if (adev->active_input->enable_ns) {
if (in_device & AUDIO_DEVICE_IN_BACK_MIC) {
if (my_data->fluence_type & FLUENCE_DUAL_MIC) {
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS;
if (my_data->fluence_type & FLUENCE_DUAL_MIC &&
my_data->fluence_in_spkr_mode) {
if (my_data->fluence_mode == FLUENCE_BROADSIDE)
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE;
else
snd_device = SND_DEVICE_IN_SPEAKER_DMIC_NS;
adev->acdb_settings |= DMIC_FLAG;
} else
snd_device = SND_DEVICE_IN_SPEAKER_MIC_NS;
Expand Down
12 changes: 11 additions & 1 deletion hal/msm8974/platform.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -26,6 +26,11 @@ enum {
FLUENCE_QUAD_MIC = 0x2,
};

enum {
FLUENCE_ENDFIRE = 0x1,
FLUENCE_BROADSIDE = 0x2,
};

/*
* Below are the devices for which is back end is same, SLIMBUS_0_RX.
* All these devices are handled by the internal HW codec. We can
Expand Down Expand Up @@ -127,6 +132,11 @@ enum {
SND_DEVICE_IN_VOIP_HANDSET_MIC,
SND_DEVICE_IN_VOIP_SPEAKER_MIC,
SND_DEVICE_IN_VOIP_HEADSET_MIC,
SND_DEVICE_IN_VOICE_SPEAKER_DMIC_BROADSIDE,
SND_DEVICE_IN_SPEAKER_DMIC_BROADSIDE,
SND_DEVICE_IN_SPEAKER_DMIC_AEC_BROADSIDE,
SND_DEVICE_IN_SPEAKER_DMIC_NS_BROADSIDE,
SND_DEVICE_IN_SPEAKER_DMIC_AEC_NS_BROADSIDE,
SND_DEVICE_IN_END,

SND_DEVICE_MAX = SND_DEVICE_IN_END,
Expand Down

0 comments on commit e0b8aee

Please sign in to comment.