mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ASoc: msm: Add support for audio recording with EC.
- Add Mixer controls for Reference Rx device to be used as a endpoint2 in adm open for echo cancellation. - Add logic to support echo cancellation for audio recording with fluence topology. Change-Id: I7b83c3fc1a19fef7826bc8c3671e2565e393566a Signed-off-by: Jayasena Sangaraboina <jsanga@codeaurora.org>
This commit is contained in:
parent
23b420290c
commit
6beeb66c9b
3 changed files with 71 additions and 3 deletions
|
@ -43,6 +43,8 @@ int adm_matrix_map(int session_id, int path, int num_copps,
|
|||
int adm_connect_afe_port(int mode, int session_id, int port_id);
|
||||
int adm_disconnect_afe_port(int mode, int session_id, int port_id);
|
||||
|
||||
void adm_ec_ref_rx_id(int port_id);
|
||||
|
||||
#ifdef CONFIG_RTAC
|
||||
int adm_get_copp_id(int port_id);
|
||||
#endif
|
||||
|
|
|
@ -69,7 +69,7 @@ static int msm_route_compressed_vol_control;
|
|||
static const DECLARE_TLV_DB_LINEAR(compressed_rx_vol_gain, 0,
|
||||
INT_RX_VOL_MAX_STEPS);
|
||||
|
||||
|
||||
static int msm_route_ec_ref_rx;
|
||||
|
||||
/* Equal to Frontend after last of the MULTIMEDIA SESSIONS */
|
||||
#define MAX_EQ_SESSIONS MSM_FRONTEND_DAI_CS_VOICE
|
||||
|
@ -1046,6 +1046,45 @@ static int msm_routing_put_eq_band_audio_mixer(struct snd_kcontrol *kcontrol,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int msm_routing_ec_ref_rx_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
pr_debug("%s: ec_ref_rx = %d", __func__, msm_route_ec_ref_rx);
|
||||
ucontrol->value.integer.value[0] = msm_route_ec_ref_rx;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_routing_ec_ref_rx_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
switch (ucontrol->value.integer.value[0]) {
|
||||
case 0:
|
||||
msm_route_ec_ref_rx = SLIMBUS_0_RX;
|
||||
break;
|
||||
case 1:
|
||||
msm_route_ec_ref_rx = PRIMARY_I2S_RX;
|
||||
break;
|
||||
default:
|
||||
msm_route_ec_ref_rx = 0;
|
||||
break;
|
||||
}
|
||||
adm_ec_ref_rx_id(msm_route_ec_ref_rx);
|
||||
pr_debug("%s: msm_route_ec_ref_rx = %d\n",
|
||||
__func__, msm_route_ec_ref_rx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char * const ec_ref_rx[] = {"SLIM_RX", "I2S_RX", "PROXY_RX",
|
||||
"NONE"};
|
||||
static const struct soc_enum msm_route_ec_ref_rx_enum[] = {
|
||||
SOC_ENUM_SINGLE_EXT(4, ec_ref_rx),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new ec_ref_rx_mixer_controls[] = {
|
||||
SOC_ENUM_EXT("EC_REF_RX", msm_route_ec_ref_rx_enum[0],
|
||||
msm_routing_ec_ref_rx_get, msm_routing_ec_ref_rx_put),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new pri_i2s_rx_mixer_controls[] = {
|
||||
SOC_SINGLE_EXT("MultiMedia1", MSM_BACKEND_DAI_PRI_I2S_RX ,
|
||||
MSM_FRONTEND_DAI_MULTIMEDIA1, 1, 0, msm_routing_get_audio_mixer,
|
||||
|
@ -2599,6 +2638,9 @@ static int msm_routing_probe(struct snd_soc_platform *platform)
|
|||
lpa_SRS_trumedia_controls_I2S,
|
||||
ARRAY_SIZE(lpa_SRS_trumedia_controls_I2S));
|
||||
|
||||
snd_soc_add_platform_controls(platform,
|
||||
ec_ref_rx_mixer_controls,
|
||||
ARRAY_SIZE(ec_ref_rx_mixer_controls));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ struct adm_ctl {
|
|||
atomic_t copp_cnt[AFE_MAX_PORTS];
|
||||
atomic_t copp_stat[AFE_MAX_PORTS];
|
||||
wait_queue_head_t wait;
|
||||
int ec_ref_rx;
|
||||
};
|
||||
|
||||
static struct acdb_cal_block mem_addr_audproc[MAX_AUDPROC_TYPES];
|
||||
|
@ -45,6 +46,7 @@ static struct acdb_cal_block mem_addr_audvol[MAX_AUDPROC_TYPES];
|
|||
|
||||
static struct adm_ctl this_adm;
|
||||
|
||||
|
||||
int srs_trumedia_open(int port_id, int srs_tech_id, void *srs_params)
|
||||
{
|
||||
struct asm_pp_params_command *open = NULL;
|
||||
|
@ -642,8 +644,16 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology)
|
|||
|
||||
open.mode = path;
|
||||
open.endpoint_id1 = port_id;
|
||||
open.endpoint_id2 = 0xFFFF;
|
||||
|
||||
if (this_adm.ec_ref_rx == 0) {
|
||||
open.endpoint_id2 = 0xFFFF;
|
||||
} else if (this_adm.ec_ref_rx && (path != 1)) {
|
||||
open.endpoint_id2 = this_adm.ec_ref_rx;
|
||||
this_adm.ec_ref_rx = 0;
|
||||
}
|
||||
|
||||
pr_debug("%s open.endpoint_id1:%d open.endpoint_id2:%d",
|
||||
__func__, open.endpoint_id1, open.endpoint_id2);
|
||||
/* convert path to acdb path */
|
||||
if (path == ADM_PATH_PLAYBACK)
|
||||
open.topology_id = get_adm_rx_topology();
|
||||
|
@ -772,8 +782,16 @@ int adm_multi_ch_copp_open(int port_id, int path, int rate, int channel_mode,
|
|||
|
||||
open.mode = path;
|
||||
open.endpoint_id1 = port_id;
|
||||
open.endpoint_id2 = 0xFFFF;
|
||||
|
||||
if (this_adm.ec_ref_rx == 0) {
|
||||
open.endpoint_id2 = 0xFFFF;
|
||||
} else if (this_adm.ec_ref_rx && (path != 1)) {
|
||||
open.endpoint_id2 = this_adm.ec_ref_rx;
|
||||
this_adm.ec_ref_rx = 0;
|
||||
}
|
||||
|
||||
pr_debug("%s open.endpoint_id1:%d open.endpoint_id2:%d",
|
||||
__func__, open.endpoint_id1, open.endpoint_id2);
|
||||
/* convert path to acdb path */
|
||||
if (path == ADM_PATH_PLAYBACK)
|
||||
open.topology_id = get_adm_rx_topology();
|
||||
|
@ -1073,6 +1091,12 @@ int adm_get_copp_id(int port_index)
|
|||
return atomic_read(&this_adm.copp_id[port_index]);
|
||||
}
|
||||
|
||||
void adm_ec_ref_rx_id(int port_id)
|
||||
{
|
||||
this_adm.ec_ref_rx = port_id;
|
||||
pr_debug("%s ec_ref_rx:%d", __func__, this_adm.ec_ref_rx);
|
||||
}
|
||||
|
||||
int adm_close(int port_id)
|
||||
{
|
||||
struct apr_hdr close;
|
||||
|
|
Loading…
Reference in a new issue